diff --git a/src/Bundle/ChillMainBundle/Controller/CivilityController.php b/src/Bundle/ChillMainBundle/Controller/CivilityController.php new file mode 100644 index 000000000..52b16f634 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/CivilityController.php @@ -0,0 +1,27 @@ +addOrderBy('e.order', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } + +} diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 6a5ea7f5f..43d85f052 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -13,6 +13,7 @@ namespace Chill\MainBundle\DependencyInjection; use Chill\MainBundle\Controller\AddressApiController; use Chill\MainBundle\Controller\CivilityApiController; +use Chill\MainBundle\Controller\CivilityController; use Chill\MainBundle\Controller\CountryController; use Chill\MainBundle\Controller\LanguageController; use Chill\MainBundle\Controller\LocationController; @@ -32,12 +33,14 @@ use Chill\MainBundle\Doctrine\DQL\Unaccent; use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator; use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType; use Chill\MainBundle\Doctrine\Type\PointType; +use Chill\MainBundle\Entity\Civility; use Chill\MainBundle\Entity\Country; use Chill\MainBundle\Entity\Language; use Chill\MainBundle\Entity\Location; use Chill\MainBundle\Entity\LocationType; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\UserJob; +use Chill\MainBundle\Form\CivilityType; use Chill\MainBundle\Form\CountryType; use Chill\MainBundle\Form\LanguageType; use Chill\MainBundle\Form\LocationFormType; @@ -410,6 +413,28 @@ class ChillMainExtension extends Extension implements ], ], ], + [ + 'class' => Civility::class, + 'name' => 'main_civility', + 'base_path' => '/admin/main/civility', + 'base_role' => 'ROLE_ADMIN', + 'form_class' => CivilityType::class, + 'controller' => CivilityController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillMain/Admin/Civility/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillMain/Admin/Civility/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillMain/Admin/Civility/edit.html.twig', + ], + ], + ], [ 'class' => Language::class, 'name' => 'main_language', diff --git a/src/Bundle/ChillMainBundle/Form/CivilityType.php b/src/Bundle/ChillMainBundle/Form/CivilityType.php new file mode 100644 index 000000000..7dc7959f5 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Form/CivilityType.php @@ -0,0 +1,36 @@ +add('name', TranslatableStringFormType::class, [ + 'required' => true, + ]) + ->add('abbreviation', TranslatableStringFormType::class) + ->add('active', ChoiceType::class, [ + 'choices' => [ + 'Active' => true, + 'Inactive' => false, + ], + ]) + ->add('order', IntegerType::class); + } +} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Admin/Civility/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Admin/Civility/edit.html.twig new file mode 100644 index 000000000..1160220a3 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Admin/Civility/edit.html.twig @@ -0,0 +1,7 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block content -%} + {% embed '@ChillMain/CRUD/_edit_content.html.twig' %} + {% block content_form_actions_save_and_show %}{% endblock %} + {% endembed %} +{% endblock content %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Admin/Civility/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Admin/Civility/index.html.twig new file mode 100644 index 000000000..278f53ba2 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Admin/Civility/index.html.twig @@ -0,0 +1,33 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block content %} + {% embed '@ChillMain/CRUD/_index.html.twig' %} + {% block table_entities_thead_tr %} + id + name + abbreviation + active + ordering + + {% endblock %} + {% block table_entities_tbody %} + {% for entity in entities %} + + {{ entity.id }} + {{ entity.name|localize_translatable_string }} + {{ entity.abbreviation|localize_translatable_string }} + {{ entity.active }} + {{ entity.order }} + + + + + {% endfor %} + {% endblock %} + {% endembed %} +{% endblock content %} + diff --git a/src/Bundle/ChillMainBundle/Resources/views/Admin/Civility/new.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Admin/Civility/new.html.twig new file mode 100644 index 000000000..643de1ff4 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Admin/Civility/new.html.twig @@ -0,0 +1,7 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block content -%} + {% embed '@ChillMain/CRUD/_new_content.html.twig' %} + {% block content_form_actions_save_and_show %}{% endblock %} + {% endembed %} +{% endblock content %} diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 8c1d981b9..f23fa7382 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -365,6 +365,12 @@ crud: add_new: Ajouter un pays title_new: Nouveau pays title_edit: Modifier un pays + main_civility: + index: + title: Liste des civilités + add_new: Ajouter une civilité + title_new: Nouvelle civilité + title_edit: Modifier une civilité No entities: Aucun élément