mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-11-04 03:08:25 +00:00 
			
		
		
		
	Merge branch 'master' of gitlab.com:Chill-Projet/chill-bundles
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -3,6 +3,7 @@ composer
 | 
			
		||||
composer.phar
 | 
			
		||||
composer.lock
 | 
			
		||||
docs/build/
 | 
			
		||||
node_modules/*
 | 
			
		||||
.php_cs.cache
 | 
			
		||||
 | 
			
		||||
###> symfony/framework-bundle ###
 | 
			
		||||
 
 | 
			
		||||
@@ -52,7 +52,6 @@
 | 
			
		||||
        "symfony/translation": "^4.4",
 | 
			
		||||
        "symfony/twig-bundle": "^4.4",
 | 
			
		||||
        "symfony/validator": "^4.4",
 | 
			
		||||
        "symfony/web-link": "*",
 | 
			
		||||
        "symfony/webpack-encore-bundle": "^1.11",
 | 
			
		||||
        "symfony/workflow": "^4.4",
 | 
			
		||||
        "symfony/yaml": "^4.4",
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
 | 
			
		||||
    {
 | 
			
		||||
        $where = $qb->getDQLPart('where');
 | 
			
		||||
        $join = $qb->getDQLPart('join');
 | 
			
		||||
        $clause = $qb->expr()->in('reasons', ':selected_activity_reasons');
 | 
			
		||||
        $clause = $qb->expr()->in('actreasons', ':selected_activity_reasons');
 | 
			
		||||
 | 
			
		||||
        if (!in_array('actreasons', $qb->getAllAliases(), true)) {
 | 
			
		||||
            $qb->join('activity.reasons', 'actreasons');
 | 
			
		||||
@@ -77,6 +77,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt
 | 
			
		||||
            'class' => ActivityReason::class,
 | 
			
		||||
            'choice_label' => fn (ActivityReason $reason) => $this->translatableStringHelper->localize($reason->getName()),
 | 
			
		||||
            'group_by' => fn (ActivityReason $reason) => $this->translatableStringHelper->localize($reason->getCategory()->getName()),
 | 
			
		||||
            'attr' => ['class' => 'select2 '],
 | 
			
		||||
            'multiple' => true,
 | 
			
		||||
            'expanded' => false,
 | 
			
		||||
        ]);
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,6 @@ final class AdminMenuBuilder implements LocalMenuBuilderInterface
 | 
			
		||||
            ->setAttribute('class', 'list-group-item-header')
 | 
			
		||||
            ->setExtras([
 | 
			
		||||
                'order' => 5000,
 | 
			
		||||
                'icons' => ['exchange'],
 | 
			
		||||
            ]);
 | 
			
		||||
 | 
			
		||||
        $menu->addChild('Activity Reasons', [
 | 
			
		||||
 
 | 
			
		||||
@@ -156,7 +156,7 @@
 | 
			
		||||
                <dd>
 | 
			
		||||
                    <section class="chill-entity entity-comment-embeddable">
 | 
			
		||||
                        <blockquote class="chill-user-quote private-quote">
 | 
			
		||||
                            {{ entity.privateComment.comments[userId] }}
 | 
			
		||||
                            {{ entity.privateComment.comments[userId]|chill_markdown_to_html }}
 | 
			
		||||
                        </blockquote>
 | 
			
		||||
                    </section>
 | 
			
		||||
                </dd>
 | 
			
		||||
@@ -172,7 +172,7 @@
 | 
			
		||||
                            {% endfor %}
 | 
			
		||||
                        </ul>
 | 
			
		||||
                    {% else %}
 | 
			
		||||
                        <span class="chill-no-data-statement">{{ 'Any document found'|trans }}</span>
 | 
			
		||||
                        <span class="chill-no-data-statement">{{ 'No document found'|trans }}</span>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                </dd>
 | 
			
		||||
            {% endif %}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,8 +12,7 @@ declare(strict_types=1);
 | 
			
		||||
namespace Chill\AsideActivityBundle\Form;
 | 
			
		||||
 | 
			
		||||
use Chill\AsideActivityBundle\Entity\AsideActivity;
 | 
			
		||||
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
 | 
			
		||||
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
 | 
			
		||||
use Chill\AsideActivityBundle\Form\Type\PickAsideActivityCategoryType;
 | 
			
		||||
use Chill\MainBundle\Form\Type\ChillDateType;
 | 
			
		||||
use Chill\MainBundle\Form\Type\ChillTextareaType;
 | 
			
		||||
use Chill\MainBundle\Form\Type\PickUserDynamicType;
 | 
			
		||||
@@ -21,8 +20,6 @@ use DateInterval;
 | 
			
		||||
use DateTime;
 | 
			
		||||
use DateTimeImmutable;
 | 
			
		||||
use DateTimeZone;
 | 
			
		||||
use Doctrine\ORM\EntityRepository;
 | 
			
		||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
 | 
			
		||||
use Symfony\Component\Form\AbstractType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
 | 
			
		||||
@@ -37,20 +34,16 @@ use function in_array;
 | 
			
		||||
 | 
			
		||||
final class AsideActivityFormType extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
    private CategoryRender $categoryRender;
 | 
			
		||||
 | 
			
		||||
    private TokenStorageInterface $storage;
 | 
			
		||||
 | 
			
		||||
    private array $timeChoices;
 | 
			
		||||
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        ParameterBagInterface $parameterBag,
 | 
			
		||||
        TokenStorageInterface $storage,
 | 
			
		||||
        CategoryRender $categoryRender
 | 
			
		||||
        TokenStorageInterface $storage
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->timeChoices = $parameterBag->get('chill_aside_activity.form.time_duration');
 | 
			
		||||
        $this->storage = $storage;
 | 
			
		||||
        $this->categoryRender = $categoryRender;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options)
 | 
			
		||||
@@ -81,28 +74,10 @@ final class AsideActivityFormType extends AbstractType
 | 
			
		||||
                    'required' => true,
 | 
			
		||||
                ]
 | 
			
		||||
            )
 | 
			
		||||
            ->add(
 | 
			
		||||
                'type',
 | 
			
		||||
                EntityType::class,
 | 
			
		||||
                [
 | 
			
		||||
                    'label' => 'Type',
 | 
			
		||||
                    'required' => true,
 | 
			
		||||
                    'class' => AsideActivityCategory::class,
 | 
			
		||||
                    'placeholder' => 'Choose the activity category',
 | 
			
		||||
                    'query_builder' => static function (EntityRepository $er) {
 | 
			
		||||
                        $qb = $er->createQueryBuilder('ac');
 | 
			
		||||
                        $qb->where($qb->expr()->eq('ac.isActive', 'TRUE'))
 | 
			
		||||
                            ->addOrderBy('ac.ordering', 'ASC');
 | 
			
		||||
 | 
			
		||||
                        return $qb;
 | 
			
		||||
                    },
 | 
			
		||||
                    'choice_label' => function (AsideActivityCategory $asideActivityCategory) {
 | 
			
		||||
                        $options = [];
 | 
			
		||||
 | 
			
		||||
                        return $this->categoryRender->renderString($asideActivityCategory, $options);
 | 
			
		||||
                    },
 | 
			
		||||
                ]
 | 
			
		||||
            )
 | 
			
		||||
            ->add('type', PickAsideActivityCategoryType::class, [
 | 
			
		||||
                'label' => 'Type',
 | 
			
		||||
                'required' => true,
 | 
			
		||||
            ])
 | 
			
		||||
            ->add('duration', ChoiceType::class, $durationTimeOptions)
 | 
			
		||||
            ->add('note', ChillTextareaType::class, [
 | 
			
		||||
                'label' => 'Note',
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,57 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\AsideActivityBundle\Form\Type;
 | 
			
		||||
 | 
			
		||||
use Chill\AsideActivityBundle\Entity\AsideActivityCategory;
 | 
			
		||||
use Chill\AsideActivityBundle\Templating\Entity\CategoryRender;
 | 
			
		||||
use Doctrine\ORM\EntityRepository;
 | 
			
		||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
 | 
			
		||||
use Symfony\Component\Form\AbstractType;
 | 
			
		||||
use Symfony\Component\OptionsResolver\OptionsResolver;
 | 
			
		||||
 | 
			
		||||
final class PickAsideActivityCategoryType extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
    private CategoryRender $categoryRender;
 | 
			
		||||
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        CategoryRender $categoryRender
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->categoryRender = $categoryRender;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function configureOptions(OptionsResolver $resolver)
 | 
			
		||||
    {
 | 
			
		||||
        $resolver
 | 
			
		||||
            ->setDefaults([
 | 
			
		||||
                'class' => AsideActivityCategory::class,
 | 
			
		||||
                'placeholder' => 'Choose the activity category',
 | 
			
		||||
                'query_builder' => static function (EntityRepository $er) {
 | 
			
		||||
                    $qb = $er->createQueryBuilder('ac');
 | 
			
		||||
                    $qb->where($qb->expr()->eq('ac.isActive', 'TRUE'))
 | 
			
		||||
                        ->addOrderBy('ac.ordering', 'ASC');
 | 
			
		||||
 | 
			
		||||
                    return $qb;
 | 
			
		||||
                },
 | 
			
		||||
                'choice_label' => function (AsideActivityCategory $asideActivityCategory) {
 | 
			
		||||
                    $options = [];
 | 
			
		||||
 | 
			
		||||
                    return $this->categoryRender->renderString($asideActivityCategory, $options);
 | 
			
		||||
                },
 | 
			
		||||
                'attr' => ['class' => 'select2'],
 | 
			
		||||
            ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getParent(): string
 | 
			
		||||
    {
 | 
			
		||||
        return EntityType::class;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
 | 
			
		||||
 | 
			
		||||
	{% block crud_content_header %}
 | 
			
		||||
		<h1>{{ ('crud.'~crud_name~'.title_delete')|trans({ '%as_string%': 'Aside Activity' }) }}</h1>
 | 
			
		||||
	{% endblock crud_content_header %}
 | 
			
		||||
@@ -27,4 +27,4 @@
 | 
			
		||||
	</ul>
 | 
			
		||||
 | 
			
		||||
	{{ form_end(form) }}
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -87,5 +87,5 @@
 | 
			
		||||
				</li>
 | 
			
		||||
			</ul>
 | 
			
		||||
		{% endif %}
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
	{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
{% extends '@ChillMain/Admin/layout.html.twig' %}
 | 
			
		||||
{% extends '@ChillMain/layout.html.twig' %}
 | 
			
		||||
 | 
			
		||||
{% block js %}
 | 
			
		||||
    {{ parent() }}
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content %}
 | 
			
		||||
{% block content %}
 | 
			
		||||
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
 | 
			
		||||
    {% block content_form_actions_save_and_show %}{% endblock %}
 | 
			
		||||
{% endembed %}
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,26 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\Controller\Admin;
 | 
			
		||||
 | 
			
		||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
 | 
			
		||||
use Symfony\Component\Routing\Annotation\Route;
 | 
			
		||||
 | 
			
		||||
class AdminController extends AbstractController
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @Route("/{_locale}/admin/budget", name="chill_admin_budget")
 | 
			
		||||
     */
 | 
			
		||||
    public function indexAdminAction()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->render('@ChillBudget/Admin/index.html.twig');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,28 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\Controller\Admin;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
 | 
			
		||||
use Chill\MainBundle\Pagination\PaginatorInterface;
 | 
			
		||||
use Doctrine\ORM\QueryBuilder;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
 | 
			
		||||
class ChargeKindController extends CRUDController
 | 
			
		||||
{
 | 
			
		||||
    protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
 | 
			
		||||
    {
 | 
			
		||||
        /** @var QueryBuilder $query */
 | 
			
		||||
        $query->addOrderBy('e.ordering', 'ASC');
 | 
			
		||||
 | 
			
		||||
        return $query;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,28 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\Controller\Admin;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
 | 
			
		||||
use Chill\MainBundle\Pagination\PaginatorInterface;
 | 
			
		||||
use Doctrine\ORM\QueryBuilder;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
 | 
			
		||||
class ResourceKindController extends CRUDController
 | 
			
		||||
{
 | 
			
		||||
    protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
 | 
			
		||||
    {
 | 
			
		||||
        /** @var QueryBuilder $query */
 | 
			
		||||
        $query->addOrderBy('e.ordering', 'ASC');
 | 
			
		||||
 | 
			
		||||
        return $query;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -11,6 +11,10 @@ declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\DependencyInjection;
 | 
			
		||||
 | 
			
		||||
use Chill\BudgetBundle\Controller\Admin\ChargeKindController;
 | 
			
		||||
use Chill\BudgetBundle\Controller\Admin\ResourceKindController;
 | 
			
		||||
use Chill\BudgetBundle\Entity\ChargeKind;
 | 
			
		||||
use Chill\BudgetBundle\Entity\ResourceKind;
 | 
			
		||||
use Chill\BudgetBundle\Security\Authorization\BudgetElementVoter;
 | 
			
		||||
use Symfony\Component\Config\FileLocator;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
 | 
			
		||||
@@ -33,6 +37,7 @@ class ChillBudgetExtension extends Extension implements PrependExtensionInterfac
 | 
			
		||||
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../config'));
 | 
			
		||||
        $loader->load('services/config.yaml');
 | 
			
		||||
        $loader->load('services/form.yaml');
 | 
			
		||||
        $loader->load('services/repository.yaml');
 | 
			
		||||
        $loader->load('services/security.yaml');
 | 
			
		||||
        $loader->load('services/controller.yaml');
 | 
			
		||||
        $loader->load('services/templating.yaml');
 | 
			
		||||
@@ -48,6 +53,7 @@ class ChillBudgetExtension extends Extension implements PrependExtensionInterfac
 | 
			
		||||
    {
 | 
			
		||||
        $this->prependAuthorization($container);
 | 
			
		||||
        $this->prependRoutes($container);
 | 
			
		||||
        $this->prependCruds($container);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** (non-PHPdoc).
 | 
			
		||||
@@ -75,6 +81,56 @@ class ChillBudgetExtension extends Extension implements PrependExtensionInterfac
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function prependCruds(ContainerBuilder $container)
 | 
			
		||||
    {
 | 
			
		||||
        $container->prependExtensionConfig('chill_main', [
 | 
			
		||||
            'cruds' => [
 | 
			
		||||
                [
 | 
			
		||||
                    'class' => ChargeKind::class,
 | 
			
		||||
                    'name' => 'charge_kind',
 | 
			
		||||
                    'base_path' => '/admin/budget/charge-kind',
 | 
			
		||||
                    'form_class' => \Chill\BudgetBundle\Form\Admin\ChargeKindType::class,
 | 
			
		||||
                    'controller' => ChargeKindController::class,
 | 
			
		||||
                    'actions' => [
 | 
			
		||||
                        'index' => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillBudget/Admin/Charge/index.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                        'new' => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillBudget/Admin/Charge/new.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                        'edit' => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillBudget/Admin/Charge/edit.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                    ],
 | 
			
		||||
                ],
 | 
			
		||||
                [
 | 
			
		||||
                    'class' => ResourceKind::class,
 | 
			
		||||
                    'name' => 'resource_kind',
 | 
			
		||||
                    'base_path' => '/admin/budget/resource-kind',
 | 
			
		||||
                    'form_class' => \Chill\BudgetBundle\Form\Admin\ResourceKindType::class,
 | 
			
		||||
                    'controller' => ResourceKindController::class,
 | 
			
		||||
                    'actions' => [
 | 
			
		||||
                        'index' => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillBudget/Admin/Resource/index.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                        'new' => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillBudget/Admin/Resource/new.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                        'edit' => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillBudget/Admin/Resource/edit.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                    ],
 | 
			
		||||
                ],
 | 
			
		||||
            ],
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    protected function storeConfig($position, array $config, ContainerBuilder $container)
 | 
			
		||||
    {
 | 
			
		||||
        $container
 | 
			
		||||
 
 | 
			
		||||
@@ -26,6 +26,7 @@ class Configuration implements ConfigurationInterface
 | 
			
		||||
 | 
			
		||||
                // ressources
 | 
			
		||||
            ->arrayNode('resources')->defaultValue([])
 | 
			
		||||
            ->setDeprecated('Chill', '2.0', 'Since the introduction of budget admin entities, config is no longer used')
 | 
			
		||||
            ->arrayPrototype()
 | 
			
		||||
            ->children()
 | 
			
		||||
            ->scalarNode('key')->isRequired()->cannotBeEmpty()
 | 
			
		||||
@@ -49,6 +50,7 @@ class Configuration implements ConfigurationInterface
 | 
			
		||||
            ->end()
 | 
			
		||||
            ->end()
 | 
			
		||||
            ->arrayNode('charges')->defaultValue([])
 | 
			
		||||
            ->setDeprecated('Chill', '2.0', 'Since the introduction of budget admin entities, config is no longer used')
 | 
			
		||||
            ->arrayPrototype()
 | 
			
		||||
            ->children()
 | 
			
		||||
            ->scalarNode('key')->isRequired()->cannotBeEmpty()
 | 
			
		||||
 
 | 
			
		||||
@@ -39,6 +39,12 @@ class Charge extends AbstractElement implements HasCentersInterface
 | 
			
		||||
        self::HELP_NOT_RELEVANT,
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\ManyToOne(targetEntity=ChargeKind::class, inversedBy="AbstractElement")
 | 
			
		||||
     * @ORM\JoinColumn
 | 
			
		||||
     */
 | 
			
		||||
    private ?ChargeKind $charge = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string
 | 
			
		||||
     * @ORM\Column(name="help", type="string", nullable=true)
 | 
			
		||||
@@ -66,6 +72,11 @@ class Charge extends AbstractElement implements HasCentersInterface
 | 
			
		||||
        return $this->getHousehold()->getCurrentPersons()->map(static fn (Person $p) => $p->getCenter())->toArray();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getCharge(): ?ChargeKind
 | 
			
		||||
    {
 | 
			
		||||
        return $this->charge;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getHelp()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->help;
 | 
			
		||||
@@ -91,6 +102,13 @@ class Charge extends AbstractElement implements HasCentersInterface
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setCharge(?ChargeKind $charge): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->charge = $charge;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setHelp($help)
 | 
			
		||||
    {
 | 
			
		||||
        $this->help = $help;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										108
									
								
								src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								src/Bundle/ChillBudgetBundle/Entity/ChargeKind.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,108 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\Entity;
 | 
			
		||||
 | 
			
		||||
use Doctrine\ORM\Mapping as ORM;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Type of charge.
 | 
			
		||||
 *
 | 
			
		||||
 * @ORM\Table(name="chill_budget.charge_type")
 | 
			
		||||
 * @ORM\Entity
 | 
			
		||||
 */
 | 
			
		||||
class ChargeKind
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Id
 | 
			
		||||
     * @ORM\GeneratedValue
 | 
			
		||||
     * @ORM\Column(type="integer")
 | 
			
		||||
     */
 | 
			
		||||
    private ?int $id = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="boolean", options={"default": true})
 | 
			
		||||
     */
 | 
			
		||||
    private bool $isActive = true;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", length=255, options={"default": ""}, nullable=false)
 | 
			
		||||
     */
 | 
			
		||||
    private string $kind = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="json", length=255, options={"default": "[]"})
 | 
			
		||||
     */
 | 
			
		||||
    private array $name = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="float", options={"default": 0.00})
 | 
			
		||||
     */
 | 
			
		||||
    private float $ordering = 0.00;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="json", length=255, options={"default": "[]"})
 | 
			
		||||
     */
 | 
			
		||||
    private array $tags = [];
 | 
			
		||||
 | 
			
		||||
    public function getId(): ?int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getIsActive(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->isActive;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getKind(): ?string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->kind;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getName(): ?array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getOrdering(): float
 | 
			
		||||
    {
 | 
			
		||||
        return $this->ordering;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setIsActive(bool $isActive): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->isActive = $isActive;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setKind(?string $kind): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->kind = $kind;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setName(array $name): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->name = $name;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setOrdering(float $ordering): ChargeKind
 | 
			
		||||
    {
 | 
			
		||||
        $this->ordering = $ordering;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -31,6 +31,12 @@ class Resource extends AbstractElement implements HasCentersInterface
 | 
			
		||||
     */
 | 
			
		||||
    private ?int $id = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\ManyToOne(targetEntity=ResourceKind::class, inversedBy="AbstractElement")
 | 
			
		||||
     * @ORM\JoinColumn
 | 
			
		||||
     */
 | 
			
		||||
    private ?ResourceKind $resource = null;
 | 
			
		||||
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->setStartDate(new DateTimeImmutable('today'));
 | 
			
		||||
@@ -55,6 +61,11 @@ class Resource extends AbstractElement implements HasCentersInterface
 | 
			
		||||
        return $this->id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getResource(): ?ResourceKind
 | 
			
		||||
    {
 | 
			
		||||
        return $this->resource;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function isCharge(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return false;
 | 
			
		||||
@@ -64,4 +75,11 @@ class Resource extends AbstractElement implements HasCentersInterface
 | 
			
		||||
    {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setResource(?ResourceKind $resource): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->resource = $resource;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										108
									
								
								src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								src/Bundle/ChillBudgetBundle/Entity/ResourceKind.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,108 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\Entity;
 | 
			
		||||
 | 
			
		||||
use Doctrine\ORM\Mapping as ORM;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Type of resource.
 | 
			
		||||
 *
 | 
			
		||||
 * @ORM\Table(name="chill_budget.resource_type")
 | 
			
		||||
 * @ORM\Entity
 | 
			
		||||
 */
 | 
			
		||||
class ResourceKind
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Id
 | 
			
		||||
     * @ORM\GeneratedValue
 | 
			
		||||
     * @ORM\Column(type="integer")
 | 
			
		||||
     */
 | 
			
		||||
    private ?int $id = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="boolean", options={"default": true})
 | 
			
		||||
     */
 | 
			
		||||
    private bool $isActive = true;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", length=255, nullable=false, options={"default": ""})
 | 
			
		||||
     */
 | 
			
		||||
    private string $kind = '';
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="json", length=255, options={"default": "[]"})
 | 
			
		||||
     */
 | 
			
		||||
    private array $name = [];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="float", options={"default": 0.00})
 | 
			
		||||
     */
 | 
			
		||||
    private float $ordering = 0.00;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="json", length=255, options={"default": "[]"})
 | 
			
		||||
     */
 | 
			
		||||
    private array $tags = [];
 | 
			
		||||
 | 
			
		||||
    public function getId(): ?int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getIsActive(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->isActive;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getKind(): ?string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->kind;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getName(): ?array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getOrdering(): float
 | 
			
		||||
    {
 | 
			
		||||
        return $this->ordering;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setIsActive(bool $isActive): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->isActive = $isActive;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setKind(?string $kind): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->kind = $kind;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setName(array $name): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->name = $name;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setOrdering(float $ordering): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->ordering = $ordering;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										42
									
								
								src/Bundle/ChillBudgetBundle/Form/Admin/ChargeKindType.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								src/Bundle/ChillBudgetBundle/Form/Admin/ChargeKindType.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\Form\Admin;
 | 
			
		||||
 | 
			
		||||
use Chill\BudgetBundle\Entity\ChargeKind;
 | 
			
		||||
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\NumberType;
 | 
			
		||||
use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
use Symfony\Component\OptionsResolver\OptionsResolver;
 | 
			
		||||
 | 
			
		||||
class ChargeKindType extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options)
 | 
			
		||||
    {
 | 
			
		||||
        $builder
 | 
			
		||||
            ->add('name', TranslatableStringFormType::class, [
 | 
			
		||||
                'label' => 'Nom',
 | 
			
		||||
            ])
 | 
			
		||||
            ->add('ordering', NumberType::class)
 | 
			
		||||
            ->add('isActive', CheckboxType::class, [
 | 
			
		||||
                'label' => 'Actif ?',
 | 
			
		||||
                'required' => false,
 | 
			
		||||
            ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function configureOptions(OptionsResolver $resolver)
 | 
			
		||||
    {
 | 
			
		||||
        $resolver
 | 
			
		||||
            ->setDefault('class', ChargeKind::class);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										42
									
								
								src/Bundle/ChillBudgetBundle/Form/Admin/ResourceKindType.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								src/Bundle/ChillBudgetBundle/Form/Admin/ResourceKindType.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\Form\Admin;
 | 
			
		||||
 | 
			
		||||
use Chill\BudgetBundle\Entity\ResourceKind;
 | 
			
		||||
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\NumberType;
 | 
			
		||||
use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
use Symfony\Component\OptionsResolver\OptionsResolver;
 | 
			
		||||
 | 
			
		||||
class ResourceKindType extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options)
 | 
			
		||||
    {
 | 
			
		||||
        $builder
 | 
			
		||||
            ->add('name', TranslatableStringFormType::class, [
 | 
			
		||||
                'label' => 'Nom',
 | 
			
		||||
            ])
 | 
			
		||||
            ->add('ordering', NumberType::class)
 | 
			
		||||
            ->add('isActive', CheckboxType::class, [
 | 
			
		||||
                'label' => 'Actif ?',
 | 
			
		||||
                'required' => false,
 | 
			
		||||
            ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function configureOptions(OptionsResolver $resolver)
 | 
			
		||||
    {
 | 
			
		||||
        $resolver
 | 
			
		||||
            ->setDefault('class', ResourceKind::class);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -13,15 +13,18 @@ namespace Chill\BudgetBundle\Form;
 | 
			
		||||
 | 
			
		||||
use Chill\BudgetBundle\Config\ConfigRepository;
 | 
			
		||||
use Chill\BudgetBundle\Entity\Charge;
 | 
			
		||||
use Chill\BudgetBundle\Entity\ChargeKind;
 | 
			
		||||
use Chill\BudgetBundle\Repository\ChargeKindRepository;
 | 
			
		||||
use Chill\MainBundle\Form\Type\ChillDateType;
 | 
			
		||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
 | 
			
		||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
 | 
			
		||||
use Symfony\Component\Form\AbstractType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
 | 
			
		||||
use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
use Symfony\Component\OptionsResolver\OptionsResolver;
 | 
			
		||||
 | 
			
		||||
use Symfony\Contracts\Translation\TranslatorInterface;
 | 
			
		||||
use function array_flip;
 | 
			
		||||
use function asort;
 | 
			
		||||
 | 
			
		||||
@@ -31,21 +34,35 @@ class ChargeType extends AbstractType
 | 
			
		||||
 | 
			
		||||
    protected TranslatableStringHelperInterface $translatableStringHelper;
 | 
			
		||||
 | 
			
		||||
    private ChargeKindRepository $repository;
 | 
			
		||||
 | 
			
		||||
    private TranslatorInterface $translator;
 | 
			
		||||
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        ConfigRepository $configRepository,
 | 
			
		||||
        TranslatableStringHelperInterface $translatableStringHelper
 | 
			
		||||
        TranslatableStringHelperInterface $translatableStringHelper,
 | 
			
		||||
        ChargeKindRepository $repository,
 | 
			
		||||
        TranslatorInterface $translator
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->configRepository = $configRepository;
 | 
			
		||||
        $this->translatableStringHelper = $translatableStringHelper;
 | 
			
		||||
        $this->repository = $repository;
 | 
			
		||||
        $this->translator = $translator;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options)
 | 
			
		||||
    {
 | 
			
		||||
        $builder
 | 
			
		||||
            ->add('type', ChoiceType::class, [
 | 
			
		||||
                'choices' => $this->getTypes(),
 | 
			
		||||
                'placeholder' => 'Choose a charge type',
 | 
			
		||||
                'attr' => ['class' => ' select2 '],
 | 
			
		||||
            ->add('charge', EntityType::class, [
 | 
			
		||||
                'class' => ChargeKind::class,
 | 
			
		||||
                'choices' => $this->repository->findAllActive(),
 | 
			
		||||
                'label' => 'Charge type',
 | 
			
		||||
                'required' => true,
 | 
			
		||||
                'placeholder' => $this->translator->trans('admin.form.Choose the type of charge'),
 | 
			
		||||
                'choice_label' => function (ChargeKind $resource) {
 | 
			
		||||
                    return $this->translatableStringHelper->localize($resource->getName());
 | 
			
		||||
                },
 | 
			
		||||
                'attr' => ['class' => 'select2'],
 | 
			
		||||
            ])
 | 
			
		||||
            ->add('amount', MoneyType::class)
 | 
			
		||||
            ->add('comment', TextareaType::class, [
 | 
			
		||||
 
 | 
			
		||||
@@ -13,15 +13,17 @@ namespace Chill\BudgetBundle\Form;
 | 
			
		||||
 | 
			
		||||
use Chill\BudgetBundle\Config\ConfigRepository;
 | 
			
		||||
use Chill\BudgetBundle\Entity\Resource;
 | 
			
		||||
use Chill\BudgetBundle\Entity\ResourceKind;
 | 
			
		||||
use Chill\BudgetBundle\Repository\ResourceKindRepository;
 | 
			
		||||
use Chill\MainBundle\Form\Type\ChillDateType;
 | 
			
		||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
 | 
			
		||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
 | 
			
		||||
use Symfony\Component\Form\AbstractType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
 | 
			
		||||
use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
use Symfony\Component\OptionsResolver\OptionsResolver;
 | 
			
		||||
 | 
			
		||||
use Symfony\Contracts\Translation\TranslatorInterface;
 | 
			
		||||
use function array_flip;
 | 
			
		||||
 | 
			
		||||
class ResourceType extends AbstractType
 | 
			
		||||
@@ -30,22 +32,35 @@ class ResourceType extends AbstractType
 | 
			
		||||
 | 
			
		||||
    protected TranslatableStringHelperInterface $translatableStringHelper;
 | 
			
		||||
 | 
			
		||||
    private ResourceKindRepository $repository;
 | 
			
		||||
 | 
			
		||||
    private TranslatorInterface $translator;
 | 
			
		||||
 | 
			
		||||
    public function __construct(
 | 
			
		||||
        ConfigRepository $configRepository,
 | 
			
		||||
        TranslatableStringHelperInterface $translatableStringHelper
 | 
			
		||||
        TranslatableStringHelperInterface $translatableStringHelper,
 | 
			
		||||
        ResourceKindRepository $repository,
 | 
			
		||||
        TranslatorInterface $translator
 | 
			
		||||
    ) {
 | 
			
		||||
        $this->configRepository = $configRepository;
 | 
			
		||||
        $this->translatableStringHelper = $translatableStringHelper;
 | 
			
		||||
        $this->repository = $repository;
 | 
			
		||||
        $this->translator = $translator;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options)
 | 
			
		||||
    {
 | 
			
		||||
        $builder
 | 
			
		||||
            ->add('type', ChoiceType::class, [
 | 
			
		||||
                'choices' => $this->getTypes(),
 | 
			
		||||
                'placeholder' => 'Choose a resource type',
 | 
			
		||||
                'label' => 'Resource element type',
 | 
			
		||||
                'attr' => ['class' => ' select2 '],
 | 
			
		||||
            ->add('resource', EntityType::class, [
 | 
			
		||||
                'class' => ResourceKind::class,
 | 
			
		||||
                'choices' => $this->repository->findAllActive(),
 | 
			
		||||
                'label' => 'Resource type',
 | 
			
		||||
                'required' => true,
 | 
			
		||||
                'placeholder' => $this->translator->trans('admin.form.Choose the type of resource'),
 | 
			
		||||
                'choice_label' => function (ResourceKind $resource) {
 | 
			
		||||
                    return $this->translatableStringHelper->localize($resource->getName());
 | 
			
		||||
                },
 | 
			
		||||
                'attr' => ['class' => 'select2'],
 | 
			
		||||
            ])
 | 
			
		||||
            ->add('amount', MoneyType::class)
 | 
			
		||||
            ->add('comment', TextareaType::class, [
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										62
									
								
								src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								src/Bundle/ChillBudgetBundle/Menu/AdminMenuBuilder.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,62 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\Menu;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
 | 
			
		||||
use Knp\Menu\MenuItem;
 | 
			
		||||
use Symfony\Component\Security\Core\Security;
 | 
			
		||||
 | 
			
		||||
final class AdminMenuBuilder implements LocalMenuBuilderInterface
 | 
			
		||||
{
 | 
			
		||||
    private Security $security;
 | 
			
		||||
 | 
			
		||||
    public function __construct(Security $security)
 | 
			
		||||
    {
 | 
			
		||||
        $this->security = $security;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function buildMenu($menuId, MenuItem $menu, array $parameters)
 | 
			
		||||
    {
 | 
			
		||||
        // all the entries below must have ROLE_ADMIN permissions
 | 
			
		||||
        if (!$this->security->isGranted('ROLE_ADMIN')) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $menu->addChild('Budget', [
 | 
			
		||||
            'route' => 'chill_admin_budget',
 | 
			
		||||
        ])
 | 
			
		||||
            ->setAttribute('class', 'list-group-item-header')
 | 
			
		||||
            ->setExtras([
 | 
			
		||||
                'order' => 7050,
 | 
			
		||||
                'explain' => 'Budget resource and charge type configuration',
 | 
			
		||||
            ]);
 | 
			
		||||
        $menu
 | 
			
		||||
            ->addChild('admin.menu.Resource types', [
 | 
			
		||||
                'route' => 'chill_crud_resource_kind_index',
 | 
			
		||||
            ])
 | 
			
		||||
            ->setExtras([
 | 
			
		||||
                'order' => 7060,
 | 
			
		||||
            ]);
 | 
			
		||||
        $menu
 | 
			
		||||
            ->addChild('admin.menu.Charge types', [
 | 
			
		||||
                'route' => 'chill_crud_charge_kind_index',
 | 
			
		||||
            ])
 | 
			
		||||
            ->setExtras([
 | 
			
		||||
                'order' => 7070,
 | 
			
		||||
            ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static function getMenuIds(): array
 | 
			
		||||
    {
 | 
			
		||||
        return ['admin_section', 'admin_budget'];
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,84 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\Repository;
 | 
			
		||||
 | 
			
		||||
use Chill\BudgetBundle\Entity\ChargeKind;
 | 
			
		||||
use Doctrine\ORM\EntityManagerInterface;
 | 
			
		||||
use Doctrine\ORM\EntityRepository;
 | 
			
		||||
use Doctrine\Persistence\ObjectRepository;
 | 
			
		||||
 | 
			
		||||
class ChargeKindRepository implements ObjectRepository
 | 
			
		||||
{
 | 
			
		||||
    private EntityRepository $repository;
 | 
			
		||||
 | 
			
		||||
    public function __construct(EntityManagerInterface $entityManager)
 | 
			
		||||
    {
 | 
			
		||||
        $this->repository = $entityManager->getRepository(ChargeKind::class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function find($id): ?ChargeKind
 | 
			
		||||
    {
 | 
			
		||||
        return $this->repository->find($id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     */
 | 
			
		||||
    public function findAll(): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->repository->findAll();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllActive(): array
 | 
			
		||||
    {
 | 
			
		||||
        $qb = $this->repository->createQueryBuilder('c');
 | 
			
		||||
 | 
			
		||||
        return $qb
 | 
			
		||||
            ->select('c')
 | 
			
		||||
            ->where($qb->expr()->eq('c.isActive', 'true'))
 | 
			
		||||
            ->orderBy('c.ordering', 'ASC')
 | 
			
		||||
            ->getQuery()
 | 
			
		||||
            ->getResult();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllByType(string $type): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->findBy(['elementType' => $type]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param mixed|null $limit
 | 
			
		||||
     * @param mixed|null $offset
 | 
			
		||||
     *
 | 
			
		||||
     * @return ChargeType[]
 | 
			
		||||
     */
 | 
			
		||||
    public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function findOneBy(array $criteria): ?ChargeKind
 | 
			
		||||
    {
 | 
			
		||||
        return $this->repository->findOneBy($criteria);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getClassName(): string
 | 
			
		||||
    {
 | 
			
		||||
        return ChargeKind::class;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,84 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\Repository;
 | 
			
		||||
 | 
			
		||||
use Chill\BudgetBundle\Entity\ResourceKind;
 | 
			
		||||
use Doctrine\ORM\EntityManagerInterface;
 | 
			
		||||
use Doctrine\ORM\EntityRepository;
 | 
			
		||||
use Doctrine\Persistence\ObjectRepository;
 | 
			
		||||
 | 
			
		||||
class ResourceKindRepository implements ObjectRepository
 | 
			
		||||
{
 | 
			
		||||
    private EntityRepository $repository;
 | 
			
		||||
 | 
			
		||||
    public function __construct(EntityManagerInterface $entityManager)
 | 
			
		||||
    {
 | 
			
		||||
        $this->repository = $entityManager->getRepository(ResourceKind::class);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function find($id): ?ResourceKind
 | 
			
		||||
    {
 | 
			
		||||
        return $this->repository->find($id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     */
 | 
			
		||||
    public function findAll(): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->repository->findAll();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllActive(): array
 | 
			
		||||
    {
 | 
			
		||||
        $qb = $this->repository->createQueryBuilder('r');
 | 
			
		||||
 | 
			
		||||
        return $qb
 | 
			
		||||
            ->select('r')
 | 
			
		||||
            ->where($qb->expr()->eq('r.isActive', 'true'))
 | 
			
		||||
            ->orderBy('r.ordering', 'ASC')
 | 
			
		||||
            ->getQuery()
 | 
			
		||||
            ->getResult();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     */
 | 
			
		||||
    public function findAllByType(string $type): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->findBy(['elementType' => $type]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param mixed|null $limit
 | 
			
		||||
     * @param mixed|null $offset
 | 
			
		||||
     *
 | 
			
		||||
     * @return ResourceType[]
 | 
			
		||||
     */
 | 
			
		||||
    public function findBy(array $criteria, ?array $orderBy = null, ?int $limit = null, ?int $offset = null): array
 | 
			
		||||
    {
 | 
			
		||||
        return $this->repository->findBy($criteria, $orderBy, $limit, $offset);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function findOneBy(array $criteria): ?ResourceKind
 | 
			
		||||
    {
 | 
			
		||||
        return $this->repository->findOneBy($criteria);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getClassName(): string
 | 
			
		||||
    {
 | 
			
		||||
        return ResourceKind::class;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
{% 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_view %}{% endblock %}
 | 
			
		||||
        {% block content_form_actions_save_and_show %}{% endblock %}
 | 
			
		||||
    {% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,49 @@
 | 
			
		||||
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
 | 
			
		||||
 | 
			
		||||
{% block title %}{{ 'admin.title.Charge Type List'|trans }}{% endblock title %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content %}
 | 
			
		||||
 | 
			
		||||
    <h1>{{ 'admin.title.Charge Type List'|trans }}</h1>
 | 
			
		||||
 | 
			
		||||
	<table class="records_list table table-bordered border-dark">
 | 
			
		||||
		<thead>
 | 
			
		||||
			<tr>
 | 
			
		||||
                <th>{{ 'Ordering'|trans }}</th>
 | 
			
		||||
				<th>{{ 'Name'|trans }}</th>
 | 
			
		||||
				<th>{{ 'Active'|trans }}</th>
 | 
			
		||||
                <th> </th>
 | 
			
		||||
			</tr>
 | 
			
		||||
		</thead>
 | 
			
		||||
		<tbody>
 | 
			
		||||
			{% for entity in entities %}
 | 
			
		||||
				<tr>
 | 
			
		||||
                    <td>{{ entity.ordering }}</td>
 | 
			
		||||
					<td>{{ entity|chill_entity_render_box }}</td>
 | 
			
		||||
					<td style="text-align:center;">
 | 
			
		||||
						{%- if entity.isActive -%}
 | 
			
		||||
							<i class="fa fa-check-square-o"></i>
 | 
			
		||||
						{%- else -%}
 | 
			
		||||
							<i class="fa fa-square-o"></i>
 | 
			
		||||
						{%- endif -%}
 | 
			
		||||
					</td>
 | 
			
		||||
					<td>
 | 
			
		||||
						<ul class="record_actions">
 | 
			
		||||
							<li>
 | 
			
		||||
								<a href="{{ path('chill_crud_charge_kind_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
 | 
			
		||||
							</li>
 | 
			
		||||
						</ul>
 | 
			
		||||
					</td>
 | 
			
		||||
				</tr>
 | 
			
		||||
			{% endfor %}
 | 
			
		||||
		</tbody>
 | 
			
		||||
	</table>
 | 
			
		||||
 | 
			
		||||
	<ul class="record_actions sticky-form-buttons">
 | 
			
		||||
		<li>
 | 
			
		||||
			<a href="{{ path('chill_crud_charge_kind_new') }}" class="btn btn-create">
 | 
			
		||||
				{{ 'admin.new.Create a new charge type'|trans }}
 | 
			
		||||
			</a>
 | 
			
		||||
		</li>
 | 
			
		||||
	</ul>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
{% 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 %}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
{% 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_view %}{% endblock %}
 | 
			
		||||
        {% block content_form_actions_save_and_show %}{% endblock %}
 | 
			
		||||
    {% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,49 @@
 | 
			
		||||
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
 | 
			
		||||
 | 
			
		||||
{% block title %}{{ 'admin.title.Resource Type List'|trans }}{% endblock title %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content %}
 | 
			
		||||
 | 
			
		||||
    <h1>{{ 'admin.title.Resource Type List'|trans }}</h1>
 | 
			
		||||
 | 
			
		||||
	<table class="records_list table table-bordered border-dark">
 | 
			
		||||
		<thead>
 | 
			
		||||
			<tr>
 | 
			
		||||
                <th>{{ 'Ordering'|trans }}</th>
 | 
			
		||||
				<th>{{ 'Name'|trans }}</th>
 | 
			
		||||
				<th>{{ 'Active'|trans }}</th>
 | 
			
		||||
                <th> </th>
 | 
			
		||||
			</tr>
 | 
			
		||||
		</thead>
 | 
			
		||||
		<tbody>
 | 
			
		||||
			{% for entity in entities %}
 | 
			
		||||
				<tr>
 | 
			
		||||
                    <td>{{ entity.ordering }}</td>
 | 
			
		||||
					<td>{{ entity|chill_entity_render_box }}</td>
 | 
			
		||||
					<td style="text-align:center;">
 | 
			
		||||
						{%- if entity.isActive -%}
 | 
			
		||||
							<i class="fa fa-check-square-o"></i>
 | 
			
		||||
						{%- else -%}
 | 
			
		||||
							<i class="fa fa-square-o"></i>
 | 
			
		||||
						{%- endif -%}
 | 
			
		||||
					</td>
 | 
			
		||||
					<td>
 | 
			
		||||
						<ul class="record_actions">
 | 
			
		||||
							<li>
 | 
			
		||||
								<a href="{{ path('chill_crud_resource_kind_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
 | 
			
		||||
							</li>
 | 
			
		||||
						</ul>
 | 
			
		||||
					</td>
 | 
			
		||||
				</tr>
 | 
			
		||||
			{% endfor %}
 | 
			
		||||
		</tbody>
 | 
			
		||||
	</table>
 | 
			
		||||
 | 
			
		||||
	<ul class="record_actions sticky-form-buttons">
 | 
			
		||||
		<li>
 | 
			
		||||
			<a href="{{ path('chill_crud_resource_kind_new') }}" class="btn btn-create">
 | 
			
		||||
				{{ 'admin.new.Create a new resource type'|trans }}
 | 
			
		||||
			</a>
 | 
			
		||||
		</li>
 | 
			
		||||
	</ul>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
{% 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 %}
 | 
			
		||||
@@ -0,0 +1,14 @@
 | 
			
		||||
{% extends "@ChillMain/Admin/layoutWithVerticalMenu.html.twig" %}
 | 
			
		||||
 | 
			
		||||
{% block vertical_menu_content %}
 | 
			
		||||
    {{ chill_menu('admin_budget', {
 | 
			
		||||
        'layout': '@ChillMain/Admin/menu_admin_section.html.twig',
 | 
			
		||||
    }) }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block layout_wvm_content %}
 | 
			
		||||
    {% block admin_content %}
 | 
			
		||||
        <!-- block content empty -->
 | 
			
		||||
        <h1>{{ 'admin.title.Budget configuration'|trans }}</h1>
 | 
			
		||||
    {% endblock %}
 | 
			
		||||
{% endblock  %}
 | 
			
		||||
@@ -16,7 +16,11 @@
 | 
			
		||||
            <td class="column-wide el-type">
 | 
			
		||||
                <span class="badge-title">
 | 
			
		||||
                    <span class="title_label title_label_{{ family }}"></span>
 | 
			
		||||
                    <span class="title_action">{{ f.type|budget_element_type_display(family) }}<span>
 | 
			
		||||
                    {% if f.isResource %}
 | 
			
		||||
                        <span class="title_action">{{ f.resource.name|localize_translatable_string }}<span>
 | 
			
		||||
                    {% else %}
 | 
			
		||||
                        <span class="title_action">{{ f.charge.name|localize_translatable_string }}<span>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                </span>
 | 
			
		||||
            </td>
 | 
			
		||||
            <td class="column-small">{{ f.amount|format_currency('EUR') }}</td>
 | 
			
		||||
 
 | 
			
		||||
@@ -3,13 +3,13 @@
 | 
			
		||||
    {% set indexPage = 'chill_budget_elements_index' %}
 | 
			
		||||
    {% set activeRouteKey = '' %}
 | 
			
		||||
    {% set person = element.person %}
 | 
			
		||||
    {% set confirm_question = 'Are you sure you want to remove the charge "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.type|budget_element_type_display('charge') } ) %}
 | 
			
		||||
    {% set confirm_question = 'Are you sure you want to remove the charge "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.charge.getName | localize_translatable_string } ) %}
 | 
			
		||||
{% else %}
 | 
			
		||||
    {% set template = '@ChillPerson/Household/layout.html.twig' %}
 | 
			
		||||
    {% set indexPage = 'chill_budget_elements_household_index' %}
 | 
			
		||||
    {% set activeRouteKey = '' %}
 | 
			
		||||
    {% set household = element.household %}
 | 
			
		||||
    {% set confirm_question = 'Are you sure you want to remove the charge "%type%" associated to household "%household%" ?'|trans({ '%household%' : household.id, '%type%': element.type|budget_element_type_display('charge') } ) %}
 | 
			
		||||
    {% set confirm_question = 'Are you sure you want to remove the charge "%type%" associated to household "%household%" ?'|trans({ '%household%' : household.id, '%type%': element.charge.getName | localize_translatable_string } ) %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% extends template %}
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@
 | 
			
		||||
 | 
			
		||||
{{ form_start(form) }}
 | 
			
		||||
 | 
			
		||||
{{ form_row(form.type) }}
 | 
			
		||||
{{ form_row(form.charge) }}
 | 
			
		||||
{{ form_row(form.amount) }}
 | 
			
		||||
{{ form_row(form.help) }}
 | 
			
		||||
{{ form_row(form.comment) }}
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,7 @@
 | 
			
		||||
 | 
			
		||||
{{ form_start(form) }}
 | 
			
		||||
 | 
			
		||||
{{ form_row(form.type) }}
 | 
			
		||||
{{ form_row(form.charge) }}
 | 
			
		||||
{{ form_row(form.amount) }}
 | 
			
		||||
{{ form_row(form.help) }}
 | 
			
		||||
{{ form_row(form.comment) }}
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@
 | 
			
		||||
            <div class="item-row">
 | 
			
		||||
                <h2 class="badge-title">
 | 
			
		||||
                    <span class="title_label title_label_charge"></span>
 | 
			
		||||
                    <span class="title_action">{{ element.type|budget_element_type_display('charge') }}</span>
 | 
			
		||||
                    <span class="title_action">{{ element.charge.getName | localize_translatable_string }}</span>
 | 
			
		||||
                </h2>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="item-row separator">
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1 @@
 | 
			
		||||
<span class="chill-entity">{{ entity.name|localize_translatable_string }}</span>
 | 
			
		||||
@@ -3,13 +3,13 @@
 | 
			
		||||
    {% set indexPage = 'chill_budget_elements_index' %}
 | 
			
		||||
    {% set activeRouteKey = '' %}
 | 
			
		||||
    {% set person = element.person %}
 | 
			
		||||
    {% set confirm_question = 'Are you sure you want to remove the ressource "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.type|budget_element_type_display('resource') } ) %}
 | 
			
		||||
    {% set confirm_question = 'Are you sure you want to remove the ressource "%type%" associated to "%name%" ?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%type%': element.resource.getName | localize_translatable_string } ) %}
 | 
			
		||||
{% else %}
 | 
			
		||||
    {% set template = '@ChillPerson/Household/layout.html.twig' %}
 | 
			
		||||
    {% set indexPage = 'chill_budget_elements_household_index' %}
 | 
			
		||||
    {% set activeRouteKey = '' %}
 | 
			
		||||
    {% set household = element.household %}
 | 
			
		||||
    {% set confirm_question = 'Are you sure you want to remove the ressource "%type%" associated to household "%household%" ?'|trans({ '%household%' : household.id, '%type%': element.type|budget_element_type_display('resource') } ) %}
 | 
			
		||||
    {% set confirm_question = 'Are you sure you want to remove the ressource "%type%" associated to household "%household%" ?'|trans({ '%household%' : household.id, '%type%': element.resource.getName | localize_translatable_string} ) %}
 | 
			
		||||
{% endif %}
 | 
			
		||||
 | 
			
		||||
{% extends template %}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@
 | 
			
		||||
 | 
			
		||||
{{ form_start(form) }}
 | 
			
		||||
 | 
			
		||||
{{ form_row(form.type) }}
 | 
			
		||||
{{ form_row(form.resource) }}
 | 
			
		||||
{{ form_row(form.amount) }}
 | 
			
		||||
{{ form_row(form.comment) }}
 | 
			
		||||
{{ form_row(form.startDate) }}
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,7 @@
 | 
			
		||||
<h1>{{ title }}</h1>
 | 
			
		||||
 | 
			
		||||
{{ form_start(form) }}
 | 
			
		||||
 | 
			
		||||
{{ form_row(form.type) }}
 | 
			
		||||
{{ form_row(form.resource) }}
 | 
			
		||||
{{ form_row(form.amount) }}
 | 
			
		||||
{{ form_row(form.comment) }}
 | 
			
		||||
{{ form_row(form.startDate) }}
 | 
			
		||||
 
 | 
			
		||||
@@ -25,7 +25,7 @@
 | 
			
		||||
            <div class="item-row">
 | 
			
		||||
                <h2 class="badge-title">
 | 
			
		||||
                    <span class="title_label title_label_resource"></span>
 | 
			
		||||
                    <span class="title_action title_action">{{ element.type|budget_element_type_display('resource') }}</span>
 | 
			
		||||
                    <span class="title_action title_action">{{ element.resource.getName | localize_translatable_string }}</span>
 | 
			
		||||
                </h2>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="item-row separator">
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,55 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\BudgetBundle\Templating;
 | 
			
		||||
 | 
			
		||||
use Chill\BudgetBundle\Entity\ChargeKind;
 | 
			
		||||
use Chill\BudgetBundle\Entity\ResourceKind;
 | 
			
		||||
use Chill\MainBundle\Templating\Entity\ChillEntityRenderInterface;
 | 
			
		||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
 | 
			
		||||
use Symfony\Component\Templating\EngineInterface;
 | 
			
		||||
 | 
			
		||||
final class BudgetElementTypeRender implements ChillEntityRenderInterface
 | 
			
		||||
{
 | 
			
		||||
    private EngineInterface $engine;
 | 
			
		||||
 | 
			
		||||
    private TranslatableStringHelperInterface $translatableStringHelper;
 | 
			
		||||
 | 
			
		||||
    public function __construct(TranslatableStringHelperInterface $translatableStringHelper, EngineInterface $engine)
 | 
			
		||||
    {
 | 
			
		||||
        $this->translatableStringHelper = $translatableStringHelper;
 | 
			
		||||
        $this->engine = $engine;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function renderBox($entity, array $options): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->engine->render('@ChillBudget/Entity/budget_element_type.html.twig', [
 | 
			
		||||
            'entity' => $entity,
 | 
			
		||||
            'options' => $options,
 | 
			
		||||
        ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function renderString($entity, array $options): string
 | 
			
		||||
    {
 | 
			
		||||
        $title = '';
 | 
			
		||||
 | 
			
		||||
        if (null !== $entity->getName()) {
 | 
			
		||||
            return $this->translatableStringHelper->localize($entity->getName());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $title;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function supports($entity, array $options): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $entity instanceof ChargeKind || $entity instanceof ResourceKind;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -3,3 +3,7 @@ services:
 | 
			
		||||
        autowire: true
 | 
			
		||||
        resource: '../../Controller'
 | 
			
		||||
        tags: ['controller.service_arguments']
 | 
			
		||||
    Chill\BudgetBundle\Controller\Admin\:
 | 
			
		||||
        autowire: true
 | 
			
		||||
        autoconfigure: true
 | 
			
		||||
        resource: '../../Controller/Admin'
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,9 @@
 | 
			
		||||
services:
 | 
			
		||||
    Chill\BudgetBundle\Form\ResourceType:
 | 
			
		||||
        arguments:
 | 
			
		||||
            $configRepository: '@Chill\BudgetBundle\Config\ConfigRepository'
 | 
			
		||||
            $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
 | 
			
		||||
        tags:
 | 
			
		||||
            - { name: 'form.type' }
 | 
			
		||||
 | 
			
		||||
    Chill\BudgetBundle\Form\ChargeType:
 | 
			
		||||
        arguments:
 | 
			
		||||
            $configRepository: '@Chill\BudgetBundle\Config\ConfigRepository'
 | 
			
		||||
            $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
 | 
			
		||||
    Chill\BudgetBundle\Form\:
 | 
			
		||||
        autowire: true
 | 
			
		||||
        resource: '../../Form'
 | 
			
		||||
        tags:
 | 
			
		||||
            - { name: 'form.type' }
 | 
			
		||||
#    Chill\BudgetBundle\Form\Admin\:
 | 
			
		||||
#        autowire: true
 | 
			
		||||
#        resource: '../../Form/Admin'
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,5 @@
 | 
			
		||||
services:
 | 
			
		||||
    Chill\BudgetBundle\Menu\PersonMenuBuilder:
 | 
			
		||||
        autowire: true
 | 
			
		||||
        autoconfigure: true
 | 
			
		||||
 | 
			
		||||
    Chill\BudgetBundle\Menu\HouseholdMenuBuilder:
 | 
			
		||||
    Chill\BudgetBundle\Menu\:
 | 
			
		||||
        autowire: true
 | 
			
		||||
        autoconfigure: true
 | 
			
		||||
        resource: './../../Menu'
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,5 @@
 | 
			
		||||
services:
 | 
			
		||||
  Chill\BudgetBundle\Repository\:
 | 
			
		||||
    autowire: true
 | 
			
		||||
    autoconfigure: true
 | 
			
		||||
    resource: './../../Repository'
 | 
			
		||||
@@ -1,7 +1,5 @@
 | 
			
		||||
services:
 | 
			
		||||
    Chill\BudgetBundle\Templating\Twig:
 | 
			
		||||
        arguments:
 | 
			
		||||
            $configRepository: '@Chill\BudgetBundle\Config\ConfigRepository'
 | 
			
		||||
            $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper'
 | 
			
		||||
        tags:
 | 
			
		||||
            - { name: 'twig.extension' }
 | 
			
		||||
    Chill\BudgetBundle\Templating\:
 | 
			
		||||
        autowire: true
 | 
			
		||||
        autoconfigure: true
 | 
			
		||||
        resource: '../../Templating'
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,39 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\Migrations\Budget;
 | 
			
		||||
 | 
			
		||||
use Doctrine\DBAL\Schema\Schema;
 | 
			
		||||
use Doctrine\Migrations\AbstractMigration;
 | 
			
		||||
 | 
			
		||||
final class Version20221116163445 extends AbstractMigration
 | 
			
		||||
{
 | 
			
		||||
    public function down(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql('DROP SEQUENCE chill_budget.charge_type_id_seq CASCADE');
 | 
			
		||||
        $this->addSql('DROP SEQUENCE chill_budget.resource_type_id_seq CASCADE');
 | 
			
		||||
        $this->addSql('DROP TABLE chill_budget.charge_type');
 | 
			
		||||
        $this->addSql('DROP TABLE chill_budget.resource_type');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getDescription(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'Create resource type and charge type';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function up(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql('CREATE SEQUENCE chill_budget.charge_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
 | 
			
		||||
        $this->addSql('CREATE SEQUENCE chill_budget.resource_type_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
 | 
			
		||||
        $this->addSql('CREATE TABLE chill_budget.charge_type (id INT NOT NULL, isActive BOOLEAN DEFAULT TRUE NOT NULL, name JSONB DEFAULT \'{}\'::jsonb NOT NULL, ordering DOUBLE PRECISION DEFAULT \'0\' NOT NULL, PRIMARY KEY(id))');
 | 
			
		||||
        $this->addSql('CREATE TABLE chill_budget.resource_type (id INT NOT NULL, isActive BOOLEAN DEFAULT TRUE NOT NULL, name JSONB DEFAULT \'{}\'::jsonb NOT NULL, ordering DOUBLE PRECISION DEFAULT \'0\' NOT NULL, PRIMARY KEY(id))');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,41 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\Migrations\Budget;
 | 
			
		||||
 | 
			
		||||
use Doctrine\DBAL\Schema\Schema;
 | 
			
		||||
use Doctrine\Migrations\AbstractMigration;
 | 
			
		||||
 | 
			
		||||
final class Version20221130101659 extends AbstractMigration
 | 
			
		||||
{
 | 
			
		||||
    public function down(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.resource_type DROP kind');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.resource_type DROP tags');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.charge_type DROP kind');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.charge_type DROP tags');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getDescription(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'Add kind and tags property to charge and resource types';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function up(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.charge_type ADD kind VARCHAR(255) DEFAULT \'\' NOT NULL');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.charge_type ADD tags JSONB DEFAULT \'{}\'::jsonb NOT NULL');
 | 
			
		||||
        $this->addSql('COMMENT ON COLUMN chill_budget.charge_type.tags IS \'(DC2Type:jsonb)\'');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.resource_type ADD kind VARCHAR(255) DEFAULT \'\' NOT NULL');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.resource_type ADD tags JSONB DEFAULT \'{}\'::jsonb NOT NULL');
 | 
			
		||||
        $this->addSql('COMMENT ON COLUMN chill_budget.resource_type.tags IS \'(DC2Type:jsonb)\'');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,41 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\Migrations\Budget;
 | 
			
		||||
 | 
			
		||||
use Doctrine\DBAL\Schema\Schema;
 | 
			
		||||
use Doctrine\Migrations\AbstractMigration;
 | 
			
		||||
 | 
			
		||||
final class Version20221202165608 extends AbstractMigration
 | 
			
		||||
{
 | 
			
		||||
    public function down(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.charge DROP CONSTRAINT FK_5C99D2C355284914');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.charge DROP charge_id');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.resource DROP CONSTRAINT FK_5E0A5E9789329D25');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.resource DROP resource_id');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getDescription(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'Integrate budget admin entity';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function up(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.charge ADD charge_id INT DEFAULT NULL');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.charge ADD CONSTRAINT FK_5C99D2C355284914 FOREIGN KEY (charge_id) REFERENCES chill_budget.charge_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
 | 
			
		||||
        $this->addSql('CREATE INDEX IDX_5C99D2C355284914 ON chill_budget.charge (charge_id)');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.resource ADD resource_id INT DEFAULT NULL');
 | 
			
		||||
        $this->addSql('ALTER TABLE chill_budget.resource ADD CONSTRAINT FK_5E0A5E9789329D25 FOREIGN KEY (resource_id) REFERENCES chill_budget.resource_type (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
 | 
			
		||||
        $this->addSql('CREATE INDEX IDX_5E0A5E9789329D25 ON chill_budget.resource (resource_id)');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,81 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\Migrations\Budget;
 | 
			
		||||
 | 
			
		||||
use Doctrine\DBAL\Schema\Schema;
 | 
			
		||||
use Doctrine\DBAL\Types\Types;
 | 
			
		||||
use Doctrine\Migrations\AbstractMigration;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
 | 
			
		||||
use Symfony\Component\DependencyInjection\ContainerInterface;
 | 
			
		||||
 | 
			
		||||
final class Version20221207105407 extends AbstractMigration implements ContainerAwareInterface
 | 
			
		||||
{
 | 
			
		||||
    public ContainerInterface $container;
 | 
			
		||||
 | 
			
		||||
    public function down(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $this->addSql('DELETE FROM chill_budget.resource_type;');
 | 
			
		||||
        $this->addSql('DELETE FROM chill_budget.charge_type;');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getDescription(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'Use new budget admin entities';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setContainer(?ContainerInterface $container = null)
 | 
			
		||||
    {
 | 
			
		||||
        $this->container = $container;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function up(Schema $schema): void
 | 
			
		||||
    {
 | 
			
		||||
        $resources = $this->container->getParameter('chill_budget.resources');
 | 
			
		||||
        $charges = $this->container->getParameter('chill_budget.charges');
 | 
			
		||||
 | 
			
		||||
        foreach ($resources as $value) {
 | 
			
		||||
            $lang = $value['labels'][0]['lang'];
 | 
			
		||||
            $label = $value['labels'][0]['label'];
 | 
			
		||||
            $kind = $value['key'];
 | 
			
		||||
            $this->addSql(
 | 
			
		||||
                'INSERT INTO chill_budget.resource_type (id, isActive, name, ordering, kind) VALUES (
 | 
			
		||||
                        nextval(\'chill_budget.resource_type_id_seq\'), true, jsonb_build_object(:lang::text, :label::text), 0, :kind::text)',
 | 
			
		||||
                ['lang' => $lang, 'label' => $label, 'kind' => $kind],
 | 
			
		||||
                ['lang' => Types::STRING, 'label' => Types::STRING, 'kind' => Types::STRING]
 | 
			
		||||
            );
 | 
			
		||||
            $this->addSql(
 | 
			
		||||
                'UPDATE chill_budget.resource SET resource_id = resource_type.id
 | 
			
		||||
                          FROM chill_budget.resource_type WHERE resource.type = :kind AND resource_type.kind = resource.type;',
 | 
			
		||||
                ['kind' => $kind],
 | 
			
		||||
                ['kind' => Types::STRING]
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        foreach ($charges as $value) {
 | 
			
		||||
            $lang = $value['labels'][0]['lang'];
 | 
			
		||||
            $label = $value['labels'][0]['label'];
 | 
			
		||||
            $kind = $value['key'];
 | 
			
		||||
            $this->addSql(
 | 
			
		||||
                'INSERT INTO chill_budget.charge_type VALUES (nextval(\'chill_budget.charge_type_id_seq\'), true,
 | 
			
		||||
                                             jsonb_build_object(:lang::text, :label::text), 0, :kind::text);',
 | 
			
		||||
                ['lang' => $lang, 'label' => $label, 'kind' => $kind],
 | 
			
		||||
                ['lang' => Types::STRING, 'label' => Types::STRING, 'kind' => Types::STRING]
 | 
			
		||||
            );
 | 
			
		||||
            $this->addSql(
 | 
			
		||||
                'UPDATE chill_budget.charge SET charge_id = charge_type.id
 | 
			
		||||
                          FROM chill_budget.charge_type WHERE charge.type = :kind AND charge_type.kind = charge.type;',
 | 
			
		||||
                ['kind' => $kind],
 | 
			
		||||
                ['kind' => Types::STRING]
 | 
			
		||||
            );
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -58,6 +58,8 @@ Charge updated: charge mise à jour
 | 
			
		||||
 | 
			
		||||
Choose a resource type: Choisissez un type de ressource
 | 
			
		||||
Choose a charge type: Choisissez un type de charge
 | 
			
		||||
Resource type: Type de ressource
 | 
			
		||||
Charge type: Type de charge
 | 
			
		||||
Amount: Montant
 | 
			
		||||
Comment: Commentaire
 | 
			
		||||
 | 
			
		||||
@@ -74,3 +76,28 @@ The balance: Différence entre ressources et charges
 | 
			
		||||
 | 
			
		||||
Valid since %startDate% until %endDate%: Valide depuis le %startDate% jusqu'au %endDate%
 | 
			
		||||
Valid since %startDate%: Valide depuis le %startDate%
 | 
			
		||||
 | 
			
		||||
## admin
 | 
			
		||||
 | 
			
		||||
crud:
 | 
			
		||||
    resource_kind:
 | 
			
		||||
        title_new: Nouveau type de ressource
 | 
			
		||||
        title_edit: Modifier le type de ressource
 | 
			
		||||
    charge_kind:
 | 
			
		||||
        title_new: Nouveau type de charge
 | 
			
		||||
        title_edit: Modifier le type de charge
 | 
			
		||||
 | 
			
		||||
admin:
 | 
			
		||||
    menu:
 | 
			
		||||
        Resource types: Types de ressource
 | 
			
		||||
        Charge types: Types de charge
 | 
			
		||||
    title:
 | 
			
		||||
        Charge Type List: Liste des types de charge
 | 
			
		||||
        Resource Type List: Liste des types de ressource
 | 
			
		||||
        Budget configuration: Configuration des éléments de budget
 | 
			
		||||
    new:
 | 
			
		||||
        Create a new charge type: Créér un nouveau type de charge
 | 
			
		||||
        Create a new resource type: Créér un nouveau type de ressource
 | 
			
		||||
    form:
 | 
			
		||||
        Choose the type of resource: Choisissez une type de ressource
 | 
			
		||||
        Choose the type of charge: Choisissez une type de charge
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,6 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
 | 
			
		||||
            ->setAttribute('class', 'list-group-item-header')
 | 
			
		||||
            ->setExtras([
 | 
			
		||||
                'order' => 6000,
 | 
			
		||||
                'icons' => ['calendar'],
 | 
			
		||||
            ]);
 | 
			
		||||
 | 
			
		||||
        $menu->addChild('Cancel reason', [
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
 | 
			
		||||
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
 | 
			
		||||
 | 
			
		||||
<div class="accompanying_course_work-list">
 | 
			
		||||
<div class="accompanying-course-work">
 | 
			
		||||
    <table class="obj-res-eval my-3">
 | 
			
		||||
        <thead>
 | 
			
		||||
        <th class="eval">
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,6 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
 | 
			
		||||
            ->setAttribute('class', 'list-group-item-header')
 | 
			
		||||
            ->setExtras([
 | 
			
		||||
                'order' => 4500,
 | 
			
		||||
                'icons' => ['plus'],
 | 
			
		||||
            ]);
 | 
			
		||||
 | 
			
		||||
        $menu->addChild('Custom fields group', [
 | 
			
		||||
 
 | 
			
		||||
@@ -39,7 +39,6 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
 | 
			
		||||
            ->setAttribute('class', 'list-group-item-header')
 | 
			
		||||
            ->setExtras([
 | 
			
		||||
                'order' => 4000,
 | 
			
		||||
                'icons' => ['file-pdf-o'],
 | 
			
		||||
            ]);
 | 
			
		||||
 | 
			
		||||
        $menu->addChild('Document category list', [
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
        {{ 'workflow.Document deleted'|trans }}
 | 
			
		||||
    </div>
 | 
			
		||||
{% else %}
 | 
			
		||||
    <div class="flex-table accompanying_course_work-list">
 | 
			
		||||
    <div class="flex-table accompanying-course-work">
 | 
			
		||||
        <div class="item-bloc document-item bg-chill-llight-gray">
 | 
			
		||||
            <div class="row justify-content-center my-4">
 | 
			
		||||
                <div class="col-2">
 | 
			
		||||
@@ -22,7 +22,6 @@
 | 
			
		||||
                            {{ document.description }}
 | 
			
		||||
                        </blockquote>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -13,3 +13,19 @@
 | 
			
		||||
            {{ 'Download'|trans }}</a>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
{% endmacro %}
 | 
			
		||||
 | 
			
		||||
{% macro download_button_small(storedObject, filename = null) %}
 | 
			
		||||
    {% if storedObject is null %}
 | 
			
		||||
        <!-- No document to download -->
 | 
			
		||||
    {% else %}
 | 
			
		||||
        <a class="btn btn-sm btn-download"
 | 
			
		||||
           data-label-preparing="{{ ('Preparing'|trans ~ '...')|escape('html_attr') }}"
 | 
			
		||||
           data-label-ready="{{ 'Ready to show'|trans|escape('html_attr') }}"
 | 
			
		||||
           data-download-button
 | 
			
		||||
           data-key="{{ storedObject.keyInfos|json_encode|escape('html_attr') }}"
 | 
			
		||||
           data-iv="{{ storedObject.iv|json_encode|escape('html_attr') }}"
 | 
			
		||||
           data-temp-url-get-generator="{{ storedObject|generate_url|escape('html_attr') }}"
 | 
			
		||||
           data-mime-type="{{ storedObject.type|escape('html_attr') }}" {% if filename is not null %}data-filename="{{ filename|escape('html_attr') }}"{% endif %}>
 | 
			
		||||
            {{ 'Download'|trans }}</a>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
{% endmacro %}
 | 
			
		||||
@@ -48,8 +48,8 @@
 | 
			
		||||
        {% endif %}
 | 
			
		||||
    {% endfor %}
 | 
			
		||||
    
 | 
			
		||||
    <div class="metadata">
 | 
			
		||||
    <span class="metadata">
 | 
			
		||||
        <i class="fa {{ icon }} fa-lg me-1"></i>
 | 
			
		||||
        {{ label|capitalize }}
 | 
			
		||||
    </div>
 | 
			
		||||
    </span>
 | 
			
		||||
{% endmacro %}
 | 
			
		||||
@@ -14,7 +14,7 @@ Edit attributes: Modifier les propriétés du document
 | 
			
		||||
Existing document: Document existant
 | 
			
		||||
No document to download: Aucun document à télécharger
 | 
			
		||||
'Choose a document category': Choisissez une catégorie de document
 | 
			
		||||
Any document found: Aucun document trouvé
 | 
			
		||||
No document found: Aucun document trouvé
 | 
			
		||||
The document is successfully registered: Le document est enregistré
 | 
			
		||||
The document is successfully updated: Le document est mis à jour
 | 
			
		||||
Any description: Aucune description
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,26 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\MainBundle\Controller;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
 | 
			
		||||
use Chill\MainBundle\Pagination\PaginatorInterface;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
 | 
			
		||||
class RegroupmentController extends CRUDController
 | 
			
		||||
{
 | 
			
		||||
    protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator)
 | 
			
		||||
    {
 | 
			
		||||
        $query->addOrderBy('e.id', 'ASC');
 | 
			
		||||
 | 
			
		||||
        return parent::orderQuery($action, $query, $request, $paginator);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										25
									
								
								src/Bundle/ChillMainBundle/Controller/ScopeApiController.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								src/Bundle/ChillMainBundle/Controller/ScopeApiController.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\MainBundle\Controller;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\CRUD\Controller\ApiController;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
 | 
			
		||||
class ScopeApiController extends ApiController
 | 
			
		||||
{
 | 
			
		||||
    protected function customizeQuery(string $action, Request $request, $query): void
 | 
			
		||||
    {
 | 
			
		||||
        if ('_index' === $action) {
 | 
			
		||||
            $query->andWhere($query->expr()->eq('e.active', "'TRUE'"));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -12,6 +12,7 @@ declare(strict_types=1);
 | 
			
		||||
namespace Chill\MainBundle\Controller;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\CRUD\Controller\ApiController;
 | 
			
		||||
use Chill\MainBundle\Pagination\PaginatorInterface;
 | 
			
		||||
use Doctrine\ORM\QueryBuilder;
 | 
			
		||||
use Symfony\Component\HttpFoundation\JsonResponse;
 | 
			
		||||
use Symfony\Component\HttpFoundation\Request;
 | 
			
		||||
@@ -70,4 +71,13 @@ class UserApiController extends ApiController
 | 
			
		||||
            $query->andWhere($query->expr()->eq('e.enabled', "'TRUE'"));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @param mixed $query
 | 
			
		||||
     * @param mixed $_format
 | 
			
		||||
     */
 | 
			
		||||
    protected function orderQuery(string $action, $query, Request $request, PaginatorInterface $paginator, $_format)
 | 
			
		||||
    {
 | 
			
		||||
        return $query->orderBy('e.label', 'ASC');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,6 @@ class WorkflowController extends AbstractController
 | 
			
		||||
            ->setRelatedEntityClass($request->query->get('entityClass'))
 | 
			
		||||
            ->setRelatedEntityId($request->query->getInt('entityId'))
 | 
			
		||||
            ->setWorkflowName($request->query->get('workflow'))
 | 
			
		||||
            ->addSubscriberToStep($this->getUser())
 | 
			
		||||
            ->addSubscriberToFinal($this->getUser());
 | 
			
		||||
 | 
			
		||||
        $errors = $this->validator->validate($entityWorkflow, null, ['creation']);
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,7 @@ use Chill\MainBundle\Controller\CountryController;
 | 
			
		||||
use Chill\MainBundle\Controller\LanguageController;
 | 
			
		||||
use Chill\MainBundle\Controller\LocationController;
 | 
			
		||||
use Chill\MainBundle\Controller\LocationTypeController;
 | 
			
		||||
use Chill\MainBundle\Controller\RegroupmentController;
 | 
			
		||||
use Chill\MainBundle\Controller\UserController;
 | 
			
		||||
use Chill\MainBundle\Controller\UserJobApiController;
 | 
			
		||||
use Chill\MainBundle\Controller\UserJobController;
 | 
			
		||||
@@ -48,6 +49,7 @@ use Chill\MainBundle\Entity\Country;
 | 
			
		||||
use Chill\MainBundle\Entity\Language;
 | 
			
		||||
use Chill\MainBundle\Entity\Location;
 | 
			
		||||
use Chill\MainBundle\Entity\LocationType;
 | 
			
		||||
use Chill\MainBundle\Entity\Regroupment;
 | 
			
		||||
use Chill\MainBundle\Entity\User;
 | 
			
		||||
use Chill\MainBundle\Entity\UserJob;
 | 
			
		||||
use Chill\MainBundle\Form\CivilityType;
 | 
			
		||||
@@ -55,6 +57,7 @@ use Chill\MainBundle\Form\CountryType;
 | 
			
		||||
use Chill\MainBundle\Form\LanguageType;
 | 
			
		||||
use Chill\MainBundle\Form\LocationFormType;
 | 
			
		||||
use Chill\MainBundle\Form\LocationTypeType;
 | 
			
		||||
use Chill\MainBundle\Form\RegroupmentType;
 | 
			
		||||
use Chill\MainBundle\Form\UserJobType;
 | 
			
		||||
use Chill\MainBundle\Form\UserType;
 | 
			
		||||
use Exception;
 | 
			
		||||
@@ -499,6 +502,27 @@ class ChillMainExtension extends Extension implements
 | 
			
		||||
                        ],
 | 
			
		||||
                    ],
 | 
			
		||||
                ],
 | 
			
		||||
                [
 | 
			
		||||
                    'class' => Regroupment::class,
 | 
			
		||||
                    'name' => 'regroupment',
 | 
			
		||||
                    'base_path' => '/admin/regroupment',
 | 
			
		||||
                    'form_class' => RegroupmentType::class,
 | 
			
		||||
                    'controller' => RegroupmentController::class,
 | 
			
		||||
                    'actions' => [
 | 
			
		||||
                        'index' => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillMain/Admin/Regroupment/index.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                        'new' => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillMain/Admin/Regroupment/new.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                        'edit' => [
 | 
			
		||||
                            'role' => 'ROLE_ADMIN',
 | 
			
		||||
                            'template' => '@ChillMain/Admin/Regroupment/edit.html.twig',
 | 
			
		||||
                        ],
 | 
			
		||||
                    ],
 | 
			
		||||
                ],
 | 
			
		||||
            ],
 | 
			
		||||
            'apis' => [
 | 
			
		||||
                [
 | 
			
		||||
@@ -631,6 +655,7 @@ class ChillMainExtension extends Extension implements
 | 
			
		||||
                ],
 | 
			
		||||
                [
 | 
			
		||||
                    'class' => \Chill\MainBundle\Entity\Scope::class,
 | 
			
		||||
                    'controller' => \Chill\MainBundle\Controller\ScopeApiController::class,
 | 
			
		||||
                    'name' => 'scope',
 | 
			
		||||
                    'base_path' => '/api/1.0/main/scope',
 | 
			
		||||
                    'base_role' => 'ROLE_USER',
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										95
									
								
								src/Bundle/ChillMainBundle/Entity/Regroupment.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								src/Bundle/ChillMainBundle/Entity/Regroupment.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,95 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\MainBundle\Entity;
 | 
			
		||||
 | 
			
		||||
use Doctrine\Common\Collections\ArrayCollection;
 | 
			
		||||
use Doctrine\Common\Collections\Collection;
 | 
			
		||||
use Doctrine\ORM\Mapping as ORM;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @ORM\Entity
 | 
			
		||||
 * @ORM\Table(name="regroupment")
 | 
			
		||||
 */
 | 
			
		||||
class Regroupment
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * @var Center
 | 
			
		||||
     * @ORM\ManyToMany(
 | 
			
		||||
     *     targetEntity="Chill\MainBundle\Entity\Center"
 | 
			
		||||
     * )
 | 
			
		||||
     * @ORM\Id
 | 
			
		||||
     */
 | 
			
		||||
    private Collection $centers;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Id
 | 
			
		||||
     * @ORM\GeneratedValue
 | 
			
		||||
     * @ORM\Column(type="integer")
 | 
			
		||||
     */
 | 
			
		||||
    private ?int $id = null;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="boolean")
 | 
			
		||||
     */
 | 
			
		||||
    private bool $isActive = true;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @ORM\Column(type="string", length=15, options={"default": ""}, nullable=false)
 | 
			
		||||
     */
 | 
			
		||||
    private string $name = '';
 | 
			
		||||
 | 
			
		||||
    public function __construct()
 | 
			
		||||
    {
 | 
			
		||||
        $this->centers = new ArrayCollection();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getCenters(): ?Collection
 | 
			
		||||
    {
 | 
			
		||||
        return $this->centers;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getId(): ?int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->id;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getIsActive(): bool
 | 
			
		||||
    {
 | 
			
		||||
        return $this->isActive;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getName(): string
 | 
			
		||||
    {
 | 
			
		||||
        return $this->name;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setCenters(?Collection $centers): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->centers = $centers;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setIsActive(bool $isActive): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->isActive = $isActive;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function setName(string $name): self
 | 
			
		||||
    {
 | 
			
		||||
        $this->name = $name;
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -224,7 +224,7 @@ class User implements UserInterface
 | 
			
		||||
    /**
 | 
			
		||||
     * Get id.
 | 
			
		||||
     */
 | 
			
		||||
    public function getId(): int
 | 
			
		||||
    public function getId(): ?int
 | 
			
		||||
    {
 | 
			
		||||
        return $this->id;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -132,8 +132,6 @@ class EntityWorkflowStep
 | 
			
		||||
    {
 | 
			
		||||
        if (!$this->destUser->contains($user)) {
 | 
			
		||||
            $this->destUser[] = $user;
 | 
			
		||||
            $this->getEntityWorkflow()
 | 
			
		||||
                ->addSubscriberToFinal($user);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
@@ -143,8 +141,6 @@ class EntityWorkflowStep
 | 
			
		||||
    {
 | 
			
		||||
        if (!$this->destUserByAccessKey->contains($user) && !$this->destUser->contains($user)) {
 | 
			
		||||
            $this->destUserByAccessKey[] = $user;
 | 
			
		||||
            $this->getEntityWorkflow()
 | 
			
		||||
                ->addSubscriberToFinal($user);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $this;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										47
									
								
								src/Bundle/ChillMainBundle/Form/RegroupmentType.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								src/Bundle/ChillMainBundle/Form/RegroupmentType.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,47 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
declare(strict_types=1);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * 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.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
namespace Chill\MainBundle\Form;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\Entity\Center;
 | 
			
		||||
use Chill\MainBundle\Entity\Regroupment;
 | 
			
		||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
 | 
			
		||||
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 RegroupmentType extends AbstractType
 | 
			
		||||
{
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options)
 | 
			
		||||
    {
 | 
			
		||||
        $builder
 | 
			
		||||
            ->add('name', TextType::class, [
 | 
			
		||||
                'label' => 'Nom',
 | 
			
		||||
            ])
 | 
			
		||||
            ->add('centers', EntityType::class, [
 | 
			
		||||
                'class' => Center::class,
 | 
			
		||||
                'multiple' => true,
 | 
			
		||||
                'attr' => ['class' => 'select2'],
 | 
			
		||||
            ])
 | 
			
		||||
            ->add('isActive', CheckboxType::class, [
 | 
			
		||||
                'label' => 'Actif ?',
 | 
			
		||||
                'required' => false,
 | 
			
		||||
            ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function configureOptions(OptionsResolver $resolver)
 | 
			
		||||
    {
 | 
			
		||||
        $resolver
 | 
			
		||||
            ->setDefault('class', Regroupment::class);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Form;
 | 
			
		||||
 | 
			
		||||
use Chill\MainBundle\Form\Type\TranslatableStringFormType;
 | 
			
		||||
use Symfony\Component\Form\AbstractType;
 | 
			
		||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
 | 
			
		||||
use Symfony\Component\Form\FormBuilderInterface;
 | 
			
		||||
use Symfony\Component\OptionsResolver\OptionsResolver;
 | 
			
		||||
 | 
			
		||||
@@ -21,7 +22,12 @@ class ScopeType extends AbstractType
 | 
			
		||||
    public function buildForm(FormBuilderInterface $builder, array $options)
 | 
			
		||||
    {
 | 
			
		||||
        $builder
 | 
			
		||||
            ->add('name', TranslatableStringFormType::class);
 | 
			
		||||
            ->add('name', TranslatableStringFormType::class)
 | 
			
		||||
            ->add('active', ChoiceType::class, [
 | 
			
		||||
                'choices' => [
 | 
			
		||||
                    'Active' => true,
 | 
			
		||||
                    'Inactive' => false,
 | 
			
		||||
                ], ]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -221,12 +221,8 @@ footer.footer {
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
 div.admin {
 | 
			
		||||
   flex-direction: row-reverse;
 | 
			
		||||
   div.vertical-menu {
 | 
			
		||||
      font-size: 0.9em;
 | 
			
		||||
      .list-group-item {
 | 
			
		||||
         padding: 0.3rem 0.7rem;
 | 
			
		||||
      }
 | 
			
		||||
      .list-group-item {}
 | 
			
		||||
   }
 | 
			
		||||
 }
 | 
			
		||||
 | 
			
		||||
@@ -307,12 +303,12 @@ table.table-bordered {
 | 
			
		||||
/// meta-data
 | 
			
		||||
div.createdBy,
 | 
			
		||||
div.updatedBy,
 | 
			
		||||
div.metadata {
 | 
			
		||||
.metadata {
 | 
			
		||||
    span.user, span.date {
 | 
			
		||||
        text-decoration: underline dotted;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
div.metadata {
 | 
			
		||||
.metadata {
 | 
			
		||||
   font-size: smaller;
 | 
			
		||||
   color: $gray-600;
 | 
			
		||||
   span.user, span.date {
 | 
			
		||||
@@ -368,6 +364,19 @@ div#flashMessages {
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// unbullet lists
 | 
			
		||||
ul.unbullet {
 | 
			
		||||
    list-style-type: none;
 | 
			
		||||
    padding-left: 0;
 | 
			
		||||
}
 | 
			
		||||
/// libellé
 | 
			
		||||
span.dt {
 | 
			
		||||
    font-size: 90%;
 | 
			
		||||
    font-weight: bolder;
 | 
			
		||||
    background-color: var(--bs-chill-light-gray);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *    SPECIFIC RULES
 | 
			
		||||
 */
 | 
			
		||||
 
 | 
			
		||||
@@ -106,18 +106,5 @@ section.chill-entity {
 | 
			
		||||
    // used for comment-embeddable
 | 
			
		||||
    &.entity-comment-embeddable {
 | 
			
		||||
        width: 100%;
 | 
			
		||||
        
 | 
			
		||||
        /* already defined !!
 | 
			
		||||
        div.metadata {
 | 
			
		||||
            font-size: smaller;
 | 
			
		||||
            color: $gray-600;
 | 
			
		||||
            span.user, span.date {
 | 
			
		||||
                text-decoration: underline dotted;
 | 
			
		||||
                &:hover {
 | 
			
		||||
                    color: $gray-700;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        */
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -48,33 +48,35 @@
 | 
			
		||||
 | 
			
		||||
      </modal>
 | 
			
		||||
   </teleport>
 | 
			
		||||
   <div class="mt-4" v-else>
 | 
			
		||||
      <suggest-pane v-if="flag.suggestPane"
 | 
			
		||||
         v-bind:context="this.context"
 | 
			
		||||
         v-bind:options="this.options"
 | 
			
		||||
         v-bind:defaultz="this.defaultz"
 | 
			
		||||
         v-bind:entity="this.entity"
 | 
			
		||||
         v-bind:flag="this.flag"
 | 
			
		||||
         v-bind:insideModal="false"
 | 
			
		||||
         @pick-address="this.pickAddress"
 | 
			
		||||
         ref="suggestAddress">
 | 
			
		||||
 | 
			
		||||
         <template v-slot:before v-if="!bypassFirstStep">
 | 
			
		||||
            <a class="btn btn-cancel" @click="resetPane">
 | 
			
		||||
               {{ $t('action.cancel') }}
 | 
			
		||||
            </a>
 | 
			
		||||
         </template>
 | 
			
		||||
         <template v-slot:action>
 | 
			
		||||
            <li>
 | 
			
		||||
               <button @click="openEditPane"
 | 
			
		||||
                  class="btn btn-create">
 | 
			
		||||
                  {{ $t('create_a_new_address')}}
 | 
			
		||||
               </button>
 | 
			
		||||
            </li>
 | 
			
		||||
         </template>
 | 
			
		||||
 | 
			
		||||
      </suggest-pane>
 | 
			
		||||
   </div>
 | 
			
		||||
   <template v-else>
 | 
			
		||||
      <div v-if="flag.suggestPane" class="mt-4 flex-grow-1">
 | 
			
		||||
         <suggest-pane
 | 
			
		||||
            v-bind:context="this.context"
 | 
			
		||||
            v-bind:options="this.options"
 | 
			
		||||
            v-bind:defaultz="this.defaultz"
 | 
			
		||||
            v-bind:entity="this.entity"
 | 
			
		||||
            v-bind:flag="this.flag"
 | 
			
		||||
            v-bind:insideModal="false"
 | 
			
		||||
            @pick-address="this.pickAddress"
 | 
			
		||||
            ref="suggestAddress">
 | 
			
		||||
   
 | 
			
		||||
            <template v-slot:before v-if="!bypassFirstStep">
 | 
			
		||||
               <a class="btn btn-cancel" @click="resetPane">
 | 
			
		||||
                  {{ $t('action.cancel') }}
 | 
			
		||||
               </a>
 | 
			
		||||
            </template>
 | 
			
		||||
            <template v-slot:action>
 | 
			
		||||
               <li>
 | 
			
		||||
                  <button @click="openEditPane"
 | 
			
		||||
                     class="btn btn-create">
 | 
			
		||||
                     {{ $t('create_a_new_address')}}
 | 
			
		||||
                  </button>
 | 
			
		||||
               </li>
 | 
			
		||||
            </template>
 | 
			
		||||
   
 | 
			
		||||
         </suggest-pane>
 | 
			
		||||
      </div>
 | 
			
		||||
   </template>
 | 
			
		||||
 | 
			
		||||
   <!-- step 2 -->
 | 
			
		||||
   <teleport to="body" v-if="inModal">
 | 
			
		||||
@@ -118,40 +120,42 @@
 | 
			
		||||
 | 
			
		||||
      </modal>
 | 
			
		||||
   </teleport>
 | 
			
		||||
   <div class="mt-4" v-else>
 | 
			
		||||
      <edit-pane v-if="flag.editPane"
 | 
			
		||||
         v-bind:context="this.context"
 | 
			
		||||
         v-bind:options="this.options"
 | 
			
		||||
         v-bind:defaultz="this.defaultz"
 | 
			
		||||
         v-bind:entity="this.entity"
 | 
			
		||||
         v-bind:flag="this.flag"
 | 
			
		||||
         v-bind:errors="this.errors"
 | 
			
		||||
         v-bind:checkErrors="this.checkErrors"
 | 
			
		||||
         v-bind:insideModal="false"
 | 
			
		||||
         @getCities="getCities"
 | 
			
		||||
         @getReferenceAddresses="getReferenceAddresses">
 | 
			
		||||
 | 
			
		||||
         <template v-slot:before>
 | 
			
		||||
            <a class="btn btn-cancel" @click="resetPane">
 | 
			
		||||
               {{ $t('action.cancel') }}
 | 
			
		||||
            </a>
 | 
			
		||||
         </template>
 | 
			
		||||
         <template v-slot:action>
 | 
			
		||||
            <li v-if="!this.context.edit && this.useDatePane">
 | 
			
		||||
               <button class="btn btn-update change-icon" @click="closeEditPane">
 | 
			
		||||
                  {{ $t('nav.next')}}
 | 
			
		||||
                  <i class="fa fa-fw fa-arrow-right"></i>
 | 
			
		||||
               </button>
 | 
			
		||||
            </li>
 | 
			
		||||
            <li v-else>
 | 
			
		||||
               <button class="btn btn-save" @click="closeEditPane">
 | 
			
		||||
                  {{ $t('action.save')}}
 | 
			
		||||
               </button>
 | 
			
		||||
            </li>
 | 
			
		||||
         </template>
 | 
			
		||||
 | 
			
		||||
      </edit-pane>
 | 
			
		||||
   </div>
 | 
			
		||||
   <template v-else>
 | 
			
		||||
      <div v-if="flag.editPane" class="mt-4 flex-grow-1">
 | 
			
		||||
         <edit-pane
 | 
			
		||||
            v-bind:context="this.context"
 | 
			
		||||
            v-bind:options="this.options"
 | 
			
		||||
            v-bind:defaultz="this.defaultz"
 | 
			
		||||
            v-bind:entity="this.entity"
 | 
			
		||||
            v-bind:flag="this.flag"
 | 
			
		||||
            v-bind:errors="this.errors"
 | 
			
		||||
            v-bind:checkErrors="this.checkErrors"
 | 
			
		||||
            v-bind:insideModal="false"
 | 
			
		||||
            @getCities="getCities"
 | 
			
		||||
            @getReferenceAddresses="getReferenceAddresses">
 | 
			
		||||
   
 | 
			
		||||
            <template v-slot:before>
 | 
			
		||||
               <a class="btn btn-cancel" @click="resetPane">
 | 
			
		||||
                  {{ $t('action.cancel') }}
 | 
			
		||||
               </a>
 | 
			
		||||
            </template>
 | 
			
		||||
            <template v-slot:action>
 | 
			
		||||
               <li v-if="!this.context.edit && this.useDatePane">
 | 
			
		||||
                  <button class="btn btn-update change-icon" @click="closeEditPane">
 | 
			
		||||
                     {{ $t('nav.next')}}
 | 
			
		||||
                     <i class="fa fa-fw fa-arrow-right"></i>
 | 
			
		||||
                  </button>
 | 
			
		||||
               </li>
 | 
			
		||||
               <li v-else>
 | 
			
		||||
                  <button class="btn btn-save" @click="closeEditPane">
 | 
			
		||||
                     {{ $t('action.save')}}
 | 
			
		||||
                  </button>
 | 
			
		||||
               </li>
 | 
			
		||||
            </template>
 | 
			
		||||
   
 | 
			
		||||
         </edit-pane>
 | 
			
		||||
      </div>
 | 
			
		||||
   </template>
 | 
			
		||||
 | 
			
		||||
   <!-- step 3 -->
 | 
			
		||||
   <teleport to="body" v-if="inModal">
 | 
			
		||||
@@ -192,32 +196,34 @@
 | 
			
		||||
 | 
			
		||||
      </modal>
 | 
			
		||||
   </teleport>
 | 
			
		||||
   <div class="mt-4" v-else>
 | 
			
		||||
      <date-pane v-if="flag.datePane"
 | 
			
		||||
         v-bind:context="this.context"
 | 
			
		||||
         v-bind:options="this.options"
 | 
			
		||||
         v-bind:defaultz="this.defaultz"
 | 
			
		||||
         v-bind:entity="this.entity"
 | 
			
		||||
         v-bind:flag="this.flag"
 | 
			
		||||
         v-bind:insideModal="false"
 | 
			
		||||
         ref="dateAddress">
 | 
			
		||||
 | 
			
		||||
         <template v-slot:before>
 | 
			
		||||
            <button class="btn btn-misc" @click="openEditPane">
 | 
			
		||||
               <i class="fa fa-fw fa-arrow-left"></i>
 | 
			
		||||
               {{ $t('nav.previous')}}
 | 
			
		||||
            </button>
 | 
			
		||||
         </template>
 | 
			
		||||
         <template v-slot:action>
 | 
			
		||||
            <li>
 | 
			
		||||
               <button class="btn btn-save" @click="closeDatePane">
 | 
			
		||||
                  {{ $t('action.save')}}
 | 
			
		||||
   <template v-else>
 | 
			
		||||
      <div v-if="flag.datePane" class="mt-4 flex-grow-1">
 | 
			
		||||
         <date-pane
 | 
			
		||||
            v-bind:context="this.context"
 | 
			
		||||
            v-bind:options="this.options"
 | 
			
		||||
            v-bind:defaultz="this.defaultz"
 | 
			
		||||
            v-bind:entity="this.entity"
 | 
			
		||||
            v-bind:flag="this.flag"
 | 
			
		||||
            v-bind:insideModal="false"
 | 
			
		||||
            ref="dateAddress">
 | 
			
		||||
         
 | 
			
		||||
            <template v-slot:before>
 | 
			
		||||
               <button class="btn btn-misc" @click="openEditPane">
 | 
			
		||||
                  <i class="fa fa-fw fa-arrow-left"></i>
 | 
			
		||||
                  {{ $t('nav.previous')}}
 | 
			
		||||
               </button>
 | 
			
		||||
            </li>
 | 
			
		||||
         </template>
 | 
			
		||||
 | 
			
		||||
      </date-pane>
 | 
			
		||||
   </div>
 | 
			
		||||
            </template>
 | 
			
		||||
            <template v-slot:action>
 | 
			
		||||
               <li>
 | 
			
		||||
                  <button class="btn btn-save" @click="closeDatePane">
 | 
			
		||||
                     {{ $t('action.save')}}
 | 
			
		||||
                  </button>
 | 
			
		||||
               </li>
 | 
			
		||||
            </template>
 | 
			
		||||
      
 | 
			
		||||
         </date-pane>
 | 
			
		||||
      </div>
 | 
			
		||||
   </template>
 | 
			
		||||
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -98,6 +98,11 @@ export default {
 | 
			
		||||
         }
 | 
			
		||||
      },
 | 
			
		||||
   },
 | 
			
		||||
   mounted() {
 | 
			
		||||
      if (typeof this.value.point !== 'undefined') {
 | 
			
		||||
         this.updateMapCenter(this.value.point);
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   methods: {
 | 
			
		||||
      transName(value) {
 | 
			
		||||
         return value.streetNumber === undefined ? value.street : `${value.streetNumber}, ${value.street}`
 | 
			
		||||
 
 | 
			
		||||
@@ -187,6 +187,7 @@ div.address-form {
 | 
			
		||||
   div#address_map {
 | 
			
		||||
      height: 400px;
 | 
			
		||||
      width: 100%;
 | 
			
		||||
      z-index: 1;
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
</style>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
<template>
 | 
			
		||||
 | 
			
		||||
   <div v-if="!onlyButton">
 | 
			
		||||
   <div v-if="!onlyButton" class="mt-4 flex-grow-1">
 | 
			
		||||
      <div class="loading">
 | 
			
		||||
         <i v-if="flag.loading" class="fa fa-circle-o-notch fa-spin fa-2x fa-fw"></i>
 | 
			
		||||
         <span class="sr-only">{{ $t('loading') }}</span>
 | 
			
		||||
@@ -36,21 +36,16 @@
 | 
			
		||||
            </action-buttons>
 | 
			
		||||
         </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <div v-if="this.context.edit" class="mb-3 row">
 | 
			
		||||
         <div class="col-sm-4"></div>
 | 
			
		||||
         <div class="address-container col-sm-8">
 | 
			
		||||
            <address-render-box :address="address" :isMultiline="false" :useDatePane="useDatePane"></address-render-box>
 | 
			
		||||
         </div>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
   
 | 
			
		||||
      <address-render-box :address="address" :isMultiline="false" :useDatePane="useDatePane"></address-render-box>
 | 
			
		||||
   
 | 
			
		||||
      <div v-if="this.context.target.name === 'household' || this.context.edit">
 | 
			
		||||
         <action-buttons
 | 
			
		||||
            :options="this.options"
 | 
			
		||||
            :defaultz="this.defaultz">
 | 
			
		||||
            <template v-slot:action>
 | 
			
		||||
               <button @click.prevent="$emit('openEditPane')"
 | 
			
		||||
                  class="btn btn-sm" :class="getClassButton"
 | 
			
		||||
                  class="btn" :class="getClassButton"
 | 
			
		||||
                  type="button" name="button" :title="$t(getTextButton)">
 | 
			
		||||
                  <span v-if="displayTextButton">{{ $t(getTextButton) }}</span>
 | 
			
		||||
               </button>
 | 
			
		||||
@@ -58,10 +53,6 @@
 | 
			
		||||
         </action-buttons>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
      <div v-if="!this.context.edit">
 | 
			
		||||
         <address-render-box :address="address" :isMultiline="false" :useDatePane="useDatePane"></address-render-box>
 | 
			
		||||
      </div>
 | 
			
		||||
 | 
			
		||||
   </div>
 | 
			
		||||
 | 
			
		||||
   <div v-if="onlyButton">
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
<template>
 | 
			
		||||
<div class="accompanying_course_work">
 | 
			
		||||
<div class="accompanying-course-work">
 | 
			
		||||
   <div class="alert alert-light">{{ $t('my_evaluations.description') }}</div>
 | 
			
		||||
   <span v-if="noResults" class="chill-no-data-statement">{{ $t('no_data') }}</span>
 | 
			
		||||
   <tab-table v-else>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
// CURRENTLY NOT IN USE
 | 
			
		||||
<template>
 | 
			
		||||
<div class="accompanying_course_work">
 | 
			
		||||
<div class="accompanying-course-work">
 | 
			
		||||
   <div class="alert alert-light">{{ $t('my_works.description') }}</div>
 | 
			
		||||
   <span v-if="noResults" class="chill-no-data-statement">{{ $t('no_data') }}</span>
 | 
			
		||||
   <tab-table v-else>
 | 
			
		||||
 
 | 
			
		||||
@@ -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 %}
 | 
			
		||||
@@ -0,0 +1,39 @@
 | 
			
		||||
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content %}
 | 
			
		||||
    {% embed '@ChillMain/CRUD/_index.html.twig' %}
 | 
			
		||||
        {% block table_entities_thead_tr %}
 | 
			
		||||
            <th>{{ 'Label'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Active'|trans }}</th>
 | 
			
		||||
            <th> </th>
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
 | 
			
		||||
        {% block table_entities_tbody %}
 | 
			
		||||
            {% for entity in entities %}
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td>{{ entity.name }}</td>
 | 
			
		||||
                    <td style="text-align:center">
 | 
			
		||||
                        {% if entity.isActive %}
 | 
			
		||||
                            <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_regroupment_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 %}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
{% 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 %}
 | 
			
		||||
@@ -28,10 +28,15 @@
 | 
			
		||||
 | 
			
		||||
            </div>
 | 
			
		||||
            {% endif %}
 | 
			
		||||
 | 
			
		||||
            {% block admin_content %}
 | 
			
		||||
                <!-- block admin content empty -->
 | 
			
		||||
            {% endblock %}
 | 
			
		||||
    
 | 
			
		||||
            <div class="row justify-content-center">
 | 
			
		||||
                <div class="col-md-10 col-xxl">
 | 
			
		||||
                    {% block admin_content %}
 | 
			
		||||
                        <!-- block admin content empty -->
 | 
			
		||||
                    {% endblock %}
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="col-md-3">
 | 
			
		||||
            {% block vertical_menu_content %}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
 | 
			
		||||
 | 
			
		||||
    {% block crud_content_header %}
 | 
			
		||||
        <h1>{{ ('crud.'~crud_name~'.title_delete')|trans({ '%as_string%': entity|chill_entity_render_string }) }}</h1>
 | 
			
		||||
    {% endblock crud_content_header %}
 | 
			
		||||
@@ -34,4 +34,4 @@
 | 
			
		||||
    </ul>
 | 
			
		||||
 | 
			
		||||
    {{ form_end(form) }}
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
{% set formId = crudMainFormId|default('crud_main_form') %}
 | 
			
		||||
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
 | 
			
		||||
    {% set formId = crudMainFormId|default('crud_main_form') %}
 | 
			
		||||
    
 | 
			
		||||
    {% block crud_content_header %}
 | 
			
		||||
        <h1>{{ ('crud.'~crud_name~'.title_edit')|trans }}</h1>
 | 
			
		||||
    {% endblock crud_content_header %}
 | 
			
		||||
@@ -64,4 +64,4 @@
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
 | 
			
		||||
    {% endblock %}
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,3 @@
 | 
			
		||||
<div class="col-10 centered">
 | 
			
		||||
 | 
			
		||||
{% block index_header %}
 | 
			
		||||
<h1>{{ ('crud.' ~ crud_name ~ '.index.title')|trans({'%crud_name%': crud_name}) }}</h1>
 | 
			
		||||
{% endblock index_header %}
 | 
			
		||||
@@ -16,7 +14,7 @@
 | 
			
		||||
    {% endblock %}
 | 
			
		||||
{% else %}
 | 
			
		||||
    {% block table_entities %}
 | 
			
		||||
    <table>
 | 
			
		||||
    <table class="table table-bordered border-dark">
 | 
			
		||||
        <thead>
 | 
			
		||||
            <tr>
 | 
			
		||||
                {% block table_entities_thead_tr %}
 | 
			
		||||
@@ -54,4 +52,3 @@
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
    </ul>
 | 
			
		||||
{% endblock list_actions %}
 | 
			
		||||
</div>
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
{% set formId = crudMainFormId|default('crud_main_form') %}
 | 
			
		||||
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
 | 
			
		||||
    {% set formId = crudMainFormId|default('crud_main_form') %}
 | 
			
		||||
 | 
			
		||||
    {% block crud_content_header %}
 | 
			
		||||
        <h1>{{ ('crud.' ~ crud_name ~ '.title_new')|trans({'%crud_name%' : crud_name }) }}</h1>
 | 
			
		||||
    {% endblock crud_content_header %}
 | 
			
		||||
@@ -52,4 +52,4 @@
 | 
			
		||||
 | 
			
		||||
        {{ form_end(form) }}
 | 
			
		||||
    {% endblock %}
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
<div class="{% block crud_content_main_div_class %}col-10 centered{% endblock %}">
 | 
			
		||||
 | 
			
		||||
    {% block crud_content_header %}
 | 
			
		||||
        <h1>{{ 'crud.%crud_name%.title_view'|trans({'%crud_name%' : crud_name }) }}</h1>
 | 
			
		||||
    {% endblock crud_content_header %}
 | 
			
		||||
@@ -60,4 +60,4 @@
 | 
			
		||||
        {% endblock crud_content_view_actions  %}
 | 
			
		||||
 | 
			
		||||
    {% endblock crud_content_view %}
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,8 +7,6 @@
 | 
			
		||||
 | 
			
		||||
    {{ form_start(edit_form) }}
 | 
			
		||||
    {{ form_row(edit_form.name) }}
 | 
			
		||||
    {{ form_row(edit_form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
 | 
			
		||||
    {{ form_end(edit_form) }}
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
        <li class='cancel'>
 | 
			
		||||
@@ -16,5 +14,10 @@
 | 
			
		||||
                {{ 'Back to the list'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            {{ form_widget(edit_form.submit, { 'attr' : { 'class' : 'btn btn-update' }}) }}
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    
 | 
			
		||||
    {{ form_end(edit_form) }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,39 +1,50 @@
 | 
			
		||||
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
 | 
			
		||||
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
 | 
			
		||||
 | 
			
		||||
{% block title %}{{ 'Center list'|trans }}{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content -%}
 | 
			
		||||
    <h1>{{ 'Center list'|trans }}</h1>
 | 
			
		||||
 | 
			
		||||
    <table class="records_list">
 | 
			
		||||
        <thead>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <th>{{ 'Name'|trans }}</th>
 | 
			
		||||
                <th>{{ 'Actions'|trans }}</th>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </thead>
 | 
			
		||||
        <tbody>
 | 
			
		||||
        {% for entity in entities %}
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>{{ entity.name }}</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <ul class="record_actions">
 | 
			
		||||
                        <li>
 | 
			
		||||
                            <a href="{{ path('admin_center_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'edit'|trans }}</a>
 | 
			
		||||
                        </li>
 | 
			
		||||
                    </ul>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        {% endfor %}
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
        <li class='cancel'>
 | 
			
		||||
            <a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('admin_center_new') }}" class="btn btn-create">{{ 'Create a new center'|trans }}</a>
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    {% embed '@ChillMain/CRUD/_index.html.twig' %}
 | 
			
		||||
    
 | 
			
		||||
        {% block index_header %}
 | 
			
		||||
            <h1>{{ 'Center list'|trans }}</h1>
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block filter_order %}{% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block table_entities_thead_tr %}
 | 
			
		||||
            <th>id</th>
 | 
			
		||||
            <th>{{ 'Name'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Actions'|trans }}</th>
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block table_entities_tbody %}
 | 
			
		||||
            {% for entity in entities %}
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td>{{ entity.id }}</td>
 | 
			
		||||
                    <td>{{ entity.name }}</td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <ul class="record_actions">
 | 
			
		||||
                            <li>
 | 
			
		||||
                                <a href="{{ path('admin_center_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'edit'|trans }}</a>
 | 
			
		||||
                            </li>
 | 
			
		||||
                        </ul>
 | 
			
		||||
                    </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
            {% endfor %}
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block pagination %}{% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block list_actions %}
 | 
			
		||||
            <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
                <li class='cancel'>
 | 
			
		||||
                    <a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li>
 | 
			
		||||
                    <a href="{{ path('admin_center_new') }}" class="btn btn-create">{{ 'Create a new center'|trans }}</a>
 | 
			
		||||
                </li>
 | 
			
		||||
            </ul>
 | 
			
		||||
        {% endblock list_actions %}
 | 
			
		||||
    
 | 
			
		||||
    {% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,8 +7,6 @@
 | 
			
		||||
 | 
			
		||||
    {{ form_start(form) }}
 | 
			
		||||
    {{ form_row(form.name) }}
 | 
			
		||||
    {{ form_row(form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
 | 
			
		||||
    {{ form_end(form) }}
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
        <li class='cancel'>
 | 
			
		||||
@@ -16,5 +14,10 @@
 | 
			
		||||
                {{ 'Back to the list'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            {{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-save' }}) }}
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    
 | 
			
		||||
    {{ form_end(form) }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,8 +7,7 @@
 | 
			
		||||
 | 
			
		||||
    {{ form_start(edit_form) }}
 | 
			
		||||
    {{ form_row(edit_form.name) }}
 | 
			
		||||
    {{ form_row(edit_form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
 | 
			
		||||
    {{ form_end(edit_form) }}
 | 
			
		||||
    {{ form_row(edit_form.active) }}
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
        <li class='cancel'>
 | 
			
		||||
@@ -16,5 +15,11 @@
 | 
			
		||||
                {{ 'Back to the list'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            {{ form_widget(edit_form.submit, { 'attr' : { 'class' : 'btn btn-update' }}) }}
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    
 | 
			
		||||
    {{ form_end(edit_form) }}
 | 
			
		||||
    
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,39 +1,58 @@
 | 
			
		||||
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
 | 
			
		||||
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
 | 
			
		||||
 | 
			
		||||
{% block title %}{{ 'List circles'|trans }}{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content -%}
 | 
			
		||||
    <h1>{{ 'List circles'|trans }}</h1>
 | 
			
		||||
    {% embed '@ChillMain/CRUD/_index.html.twig' %}
 | 
			
		||||
    
 | 
			
		||||
        {% block index_header %}
 | 
			
		||||
            <h1>{{ 'List circles'|trans }}</h1>
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
        
 | 
			
		||||
        {% block filter_order %}{% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block table_entities_thead_tr %}
 | 
			
		||||
            <th>id</th>
 | 
			
		||||
            <th>{{ 'Name'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Active'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Actions'|trans }}</th>
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block table_entities_tbody %}
 | 
			
		||||
            {% for entity in entities %}
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td>{{ entity.id }}</td>
 | 
			
		||||
                    <td>{{ entity.name|localize_translatable_string }}</td>
 | 
			
		||||
                    <td style="text-align:center;">
 | 
			
		||||
                        {%- if entity.active -%}
 | 
			
		||||
                            <i class="fa fa-check-square-o"></i>
 | 
			
		||||
                        {%- else -%}
 | 
			
		||||
                            <i class="fa fa-square-o"></i>
 | 
			
		||||
                        {%- endif -%}
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <ul class="record_actions">
 | 
			
		||||
                            <li>
 | 
			
		||||
                                <a href="{{ path('admin_scope_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'edit'|trans }}</a>
 | 
			
		||||
                            </li>
 | 
			
		||||
                        </ul>
 | 
			
		||||
                    </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
            {% endfor %}
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block pagination %}{% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block list_actions %}
 | 
			
		||||
            <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
                <li class='cancel'>
 | 
			
		||||
                    <a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li>
 | 
			
		||||
                    <a href="{{ path('admin_scope_new') }}" class="btn btn-create">{{ 'Create a new circle'|trans }}</a>
 | 
			
		||||
                </li>
 | 
			
		||||
            </ul>
 | 
			
		||||
        {% endblock list_actions %}
 | 
			
		||||
 | 
			
		||||
    <table class="records_list">
 | 
			
		||||
        <thead>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <th>{{ 'Name'|trans }}</th>
 | 
			
		||||
                <th>{{ 'Actions'|trans }}</th>
 | 
			
		||||
            </tr>
 | 
			
		||||
        </thead>
 | 
			
		||||
        <tbody>
 | 
			
		||||
        {% for entity in entities %}
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>{{ entity.name|localize_translatable_string }}</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <ul class="record_actions">
 | 
			
		||||
                        <li>
 | 
			
		||||
                            <a href="{{ path('admin_scope_edit', { 'id': entity.id }) }}" class="btn btn-edit">{{ 'edit'|trans }}</a>
 | 
			
		||||
                        </li>
 | 
			
		||||
                    </ul>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
        {% endfor %}
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
 | 
			
		||||
     <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
        <li class='cancel'>
 | 
			
		||||
            <a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('admin_scope_new') }}" class="btn btn-create">{{ 'Create a new circle'|trans }}</a>
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    {% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,8 +7,7 @@
 | 
			
		||||
 | 
			
		||||
    {{ form_start(form) }}
 | 
			
		||||
    {{ form_row(form.name) }}
 | 
			
		||||
    {{ form_row(form.submit, { 'attr' : { 'class' : 'btn btn-chill-green' } } ) }}
 | 
			
		||||
    {{ form_end(form) }}
 | 
			
		||||
    {{ form_row(form.active) }}
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
        <li class='cancel'>
 | 
			
		||||
@@ -16,5 +15,9 @@
 | 
			
		||||
                {{ 'Back to the list'|trans }}
 | 
			
		||||
            </a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            {{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-save' }}) }}
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
    {{ form_end(form) }}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,83 +1,99 @@
 | 
			
		||||
{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %}
 | 
			
		||||
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
 | 
			
		||||
 | 
			
		||||
{% block admin_content %}
 | 
			
		||||
 | 
			
		||||
    <h1>{{"Users"|trans}}</h1>
 | 
			
		||||
 | 
			
		||||
    {{ filter_order|chill_render_filter_order_helper }}
 | 
			
		||||
 | 
			
		||||
    {% for entity in entities %}
 | 
			
		||||
    <div class="flex-table">
 | 
			
		||||
        <div class="item-bloc">
 | 
			
		||||
            <div class="item-row">
 | 
			
		||||
                <div class="item-col">
 | 
			
		||||
                    {% if entity.civility is not null %}
 | 
			
		||||
                        {% if entity.civility.name|length > 0 %}
 | 
			
		||||
                            {{ entity.civility.name|first }}
 | 
			
		||||
    {% embed '@ChillMain/CRUD/_index.html.twig' %}
 | 
			
		||||
    
 | 
			
		||||
        {% block index_header %}
 | 
			
		||||
            <h1>{{"Users"|trans}}</h1>
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block filter_order %}{{ filter_order|chill_render_filter_order_helper }}{% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block table_entities_thead_tr %}
 | 
			
		||||
            <th>{{ 'Active'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Username'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Datas'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Actions'|trans }}</th>
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block table_entities_tbody %}
 | 
			
		||||
            {% for entity in entities %}
 | 
			
		||||
                <tr>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        {% if entity.isEnabled %}
 | 
			
		||||
                            <i class="fa fa-check-square-o"></i>
 | 
			
		||||
                        {% else %}
 | 
			
		||||
                            <i class="fa fa-square-o"></i>
 | 
			
		||||
                        {% endif %}
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                    {{ entity.label }}
 | 
			
		||||
                    {% if entity.isEnabled %}
 | 
			
		||||
                        <i class="fa fa-check chill-green"></i>
 | 
			
		||||
                    {% else %}
 | 
			
		||||
                        <i class="fa fa-times chill-red"></i>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="item-col"><i>{{ entity.email }}</i></div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="item-row">
 | 
			
		||||
                <div class="item-col">
 | 
			
		||||
                    login: {{ entity.username|e('html_attr') }}
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="item-col">
 | 
			
		||||
                    {% if entity.userJob %}
 | 
			
		||||
                        {{ entity.userJob.label|localize_translatable_string }}
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="item-row">
 | 
			
		||||
                <div class="item-col">
 | 
			
		||||
                    {% if entity.mainScope %}
 | 
			
		||||
                        {{ entity.mainScope.name|localize_translatable_string }}
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                    {% if entity.mainCenter %}
 | 
			
		||||
                        , {{ entity.mainCenter.name }}
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="item-row">
 | 
			
		||||
               <ul class="record_actions">
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <a class="btn btn-edit" href="{{ path('chill_crud_admin_user_edit', { 'id': entity.id }) }}"></a>
 | 
			
		||||
                    </li>
 | 
			
		||||
 | 
			
		||||
                    {% if allow_change_password is same as(true) %}
 | 
			
		||||
                    <li>
 | 
			
		||||
                        <a class="btn btn-chill-red" href="{{ path('admin_user_edit_password',  { 'id' : entity.id }) }}" title="{{ 'Edit password'|trans|e('html_attr') }}"><i class="fa fa-ellipsis-h"></i></a>
 | 
			
		||||
                    </li>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
 | 
			
		||||
                    {% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}
 | 
			
		||||
                        <li>
 | 
			
		||||
                            <a class="btn btn-chill-blue" href="{{ path('chill_main_homepage', {'_switch_user': entity.username }) }}" title="{{ "Impersonate"|trans|e('html_attr') }}"><i class="fa fa-user-secret"></i></a>
 | 
			
		||||
                        </li>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                </ul>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
    {% endfor %}
 | 
			
		||||
 | 
			
		||||
    {{ chill_pagination(paginator) }}
 | 
			
		||||
 | 
			
		||||
    <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
        <li class='cancel'>
 | 
			
		||||
            <a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
 | 
			
		||||
        </li>
 | 
			
		||||
        <li>
 | 
			
		||||
            <a href="{{ path('chill_crud_admin_user_new') }}" class="btn btn-create">{{ 'Create'|trans }}</a>
 | 
			
		||||
        </li>
 | 
			
		||||
    </ul>
 | 
			
		||||
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        {#
 | 
			
		||||
                        {% if entity.civility is not null %}
 | 
			
		||||
                            {% if entity.civility.name|length > 0 %}
 | 
			
		||||
                                {{ entity.civility.name|first }}
 | 
			
		||||
                            {% endif %}
 | 
			
		||||
                        {% endif %}
 | 
			
		||||
                        #}
 | 
			
		||||
                        {{ entity.label }}
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <ul class="unbullet">
 | 
			
		||||
                            <li>
 | 
			
		||||
                                <span class="dt">login:</span>
 | 
			
		||||
                                {{ entity.username|e('html_attr') }}
 | 
			
		||||
                            </li>
 | 
			
		||||
                            <li>
 | 
			
		||||
                                <span class="dt">email:</span>
 | 
			
		||||
                                {{ entity.email }}
 | 
			
		||||
                            </li>
 | 
			
		||||
                            <li>
 | 
			
		||||
                                <span class="dt">métier:</span>
 | 
			
		||||
                                {% if entity.userJob %}{{ entity.userJob.label|localize_translatable_string }}{% endif %}
 | 
			
		||||
                            </li>
 | 
			
		||||
                            <li>
 | 
			
		||||
                                <span class="dt">cercle/centre:</span>
 | 
			
		||||
                                {% if entity.mainScope %}
 | 
			
		||||
                                    {{ entity.mainScope.name|localize_translatable_string }}
 | 
			
		||||
                                {% endif %}
 | 
			
		||||
                                {% if entity.mainCenter %}, {{ entity.mainCenter.name }}{% endif %}
 | 
			
		||||
                            </li>
 | 
			
		||||
                        </ul>
 | 
			
		||||
                    </td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <ul class="record_actions">
 | 
			
		||||
                            <li>
 | 
			
		||||
                                <a class="btn btn-edit" title="{{ 'Edit'|trans }}" href="{{ path('chill_crud_admin_user_edit', { 'id': entity.id }) }}"></a>
 | 
			
		||||
                            </li>
 | 
			
		||||
        
 | 
			
		||||
                            {% if allow_change_password is same as(true) %}
 | 
			
		||||
                                <li>
 | 
			
		||||
                                    <a class="btn btn-chill-red" href="{{ path('admin_user_edit_password',  { 'id' : entity.id }) }}" title="{{ 'Edit password'|trans|e('html_attr') }}"><i class="fa fa-ellipsis-h"></i></a>
 | 
			
		||||
                                </li>
 | 
			
		||||
                            {% endif %}
 | 
			
		||||
        
 | 
			
		||||
                            {% if is_granted('ROLE_ALLOWED_TO_SWITCH') %}
 | 
			
		||||
                                <li>
 | 
			
		||||
                                    <a class="btn btn-chill-blue" href="{{ path('chill_main_homepage', {'_switch_user': entity.username }) }}" title="{{ "Impersonate"|trans|e('html_attr') }}"><i class="fa fa-user-secret"></i></a>
 | 
			
		||||
                                </li>
 | 
			
		||||
                            {% endif %}
 | 
			
		||||
                        </ul>
 | 
			
		||||
                    </td>
 | 
			
		||||
                </tr>
 | 
			
		||||
            {% endfor %}
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block pagination %}{{ chill_pagination(paginator) }}{% endblock %}
 | 
			
		||||
    
 | 
			
		||||
        {% block list_actions %}
 | 
			
		||||
            <ul class="record_actions sticky-form-buttons">
 | 
			
		||||
                <li class='cancel'>
 | 
			
		||||
                    <a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li>
 | 
			
		||||
                    <a href="{{ path('chill_crud_admin_user_new') }}" class="btn btn-create">{{ 'Create'|trans }}</a>
 | 
			
		||||
                </li>
 | 
			
		||||
            </ul>
 | 
			
		||||
        {% endblock list_actions %}
 | 
			
		||||
    
 | 
			
		||||
    {% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,12 +2,14 @@
 | 
			
		||||
 | 
			
		||||
{% block admin_content %}
 | 
			
		||||
    {% embed '@ChillMain/CRUD/_index.html.twig' %}
 | 
			
		||||
        
 | 
			
		||||
        {% block table_entities_thead_tr %}
 | 
			
		||||
            <th>id</th>
 | 
			
		||||
            <th>{{ 'label'|trans }}</th>
 | 
			
		||||
            <th>{{ 'active'|trans }}</th>
 | 
			
		||||
            <th> </th>
 | 
			
		||||
            <th>{{ 'Label'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Active'|trans }}</th>
 | 
			
		||||
            <th>{{ 'Actions'|trans }}</th>
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
        
 | 
			
		||||
        {% block table_entities_tbody %}
 | 
			
		||||
            {% for entity in entities %}
 | 
			
		||||
                <tr>
 | 
			
		||||
@@ -30,11 +32,12 @@
 | 
			
		||||
                </tr>
 | 
			
		||||
             {% endfor %}
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
 | 
			
		||||
        
 | 
			
		||||
        {% block actions_before %}
 | 
			
		||||
            <li class='cancel'>
 | 
			
		||||
                <a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
 | 
			
		||||
            </li>
 | 
			
		||||
        {% endblock %}
 | 
			
		||||
        
 | 
			
		||||
    {% endembed %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,7 @@
 | 
			
		||||
{# TODO Adapt condition #}
 | 
			
		||||
{# TODO
 | 
			
		||||
    Check if this template is used
 | 
			
		||||
    Adapt condition or Delete it
 | 
			
		||||
#}
 | 
			
		||||
{% if random(1) == 0 %}
 | 
			
		||||
 | 
			
		||||
    {# For a document #}
 | 
			
		||||
@@ -22,7 +25,7 @@
 | 
			
		||||
    {# For an action #}
 | 
			
		||||
    <h2>{{ 'Accompanying Course Action'|trans ~ 'target'|trans }}</h2>
 | 
			
		||||
 | 
			
		||||
    <div class="flex-table accompanying_course_work-list">
 | 
			
		||||
    <div class="flex-table accompanying-course-work">
 | 
			
		||||
        {# dynamic insertion
 | 
			
		||||
            ::: TODO delete all static insertion, remove condition and pass work object in inclusion
 | 
			
		||||
        #}{% if dynamic is defined %}
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,6 @@ class AdminLanguageMenuBuilder implements LocalMenuBuilderInterface
 | 
			
		||||
            ->setAttribute('class', 'list-group-item-header')
 | 
			
		||||
            ->setExtras([
 | 
			
		||||
                'order' => 1200,
 | 
			
		||||
                'icons' => ['globe-w'],
 | 
			
		||||
            ]);
 | 
			
		||||
        $menu->addChild('Language list', [
 | 
			
		||||
            'route' => 'chill_crud_main_language_index',
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,6 @@ class AdminLocationMenuBuilder implements LocalMenuBuilderInterface
 | 
			
		||||
            ->setAttribute('class', 'list-group-item-header')
 | 
			
		||||
            ->setExtras([
 | 
			
		||||
                'order' => 1300,
 | 
			
		||||
                'icons' => ['map-marker'],
 | 
			
		||||
            ]);
 | 
			
		||||
 | 
			
		||||
        $menu->addChild('Location type list', [
 | 
			
		||||
 
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user