Feature: allow to administrate budget resources and charges from the admin

This commit is contained in:
2023-01-23 20:40:01 +00:00
parent 99482edf0d
commit c4eb45edcc
57 changed files with 1546 additions and 49 deletions

View File

@@ -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