diff --git a/src/Bundle/ChillMainBundle/Controller/UserJobHistoryController.php b/src/Bundle/ChillMainBundle/Controller/UserJobHistoryController.php deleted file mode 100644 index eb181f252..000000000 --- a/src/Bundle/ChillMainBundle/Controller/UserJobHistoryController.php +++ /dev/null @@ -1,29 +0,0 @@ -addOrderBy('e.startDate', 'DESC') - ->addOrderBy('e.user', 'ASC') - ; - - return parent::orderQuery($action, $query, $request, $paginator); - } -} diff --git a/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php b/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php new file mode 100644 index 000000000..4014e0593 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Controller/UserJobScopeHistoriesController.php @@ -0,0 +1,43 @@ +getUserJobHistories(); + $scopeHistories = $user->getMainScopeHistories(); + + + return new Response( + $this->engine->render('@ChillMain/User/history.html.twig', [ + 'user' => $user, + 'jobHistories' => $jobHistories, + 'scopeHistories' => $scopeHistories, + ] + )); + } +} diff --git a/src/Bundle/ChillMainBundle/Controller/UserScopeHistoryController.php b/src/Bundle/ChillMainBundle/Controller/UserScopeHistoryController.php deleted file mode 100644 index 2d425456f..000000000 --- a/src/Bundle/ChillMainBundle/Controller/UserScopeHistoryController.php +++ /dev/null @@ -1,29 +0,0 @@ -addOrderBy('e.startDate', 'DESC') - ->addOrderBy('e.user', '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 80febcae9..4d81c3980 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -375,32 +375,6 @@ class ChillMainExtension extends Extension implements ], ], ], - [ - 'class' => UserJobHistory::class, - 'controller' => UserJobHistoryController::class, - 'name' => 'admin_user_job_history', - 'base_path' => '/admin/main/user-job-history', - 'base_role' => 'ROLE_ADMIN', - 'actions' => [ - 'index' => [ - 'role' => 'ROLE_ADMIN', - 'template' => '@ChillMain/UserJob/history.html.twig', - ], - ], - ], - [ - 'class' => UserScopeHistory::class, - 'controller' => UserScopeHistoryController::class, - 'name' => 'admin_user_scope_history', - 'base_path' => '/admin/main/user-scope-history', - 'base_role' => 'ROLE_ADMIN', - 'actions' => [ - 'index' => [ - 'role' => 'ROLE_ADMIN', - 'template' => '@ChillMain/Scope/history.html.twig', - ], - ], - ], [ 'class' => User::class, 'controller' => UserController::class, diff --git a/src/Bundle/ChillMainBundle/Resources/views/Scope/history.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Scope/history.html.twig deleted file mode 100644 index b7d4d6d18..000000000 --- a/src/Bundle/ChillMainBundle/Resources/views/Scope/history.html.twig +++ /dev/null @@ -1,51 +0,0 @@ -{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} - -{% block admin_content %} - {% embed '@ChillMain/CRUD/_index.html.twig' %} - - {% block table_entities_thead_tr %} - {{ 'crud.admin_user_scope_history.index.start'|trans }} - {{ 'crud.admin_user_scope_history.index.end'|trans }} - {{ 'crud.admin_user_scope_history.index.user'|trans }} - {{ 'crud.admin_user_scope_history.index.scope'|trans }} - {% endblock %} - - {% block table_entities_tbody %} - {% for entity in entities %} - - {{ entity.startDate|format_datetime('medium') }} - - {% if entity.endDate is not null %} - {{ entity.endDate|format_datetime('medium') }} - {% else %} - {{ "crud.admin_user_scope_history.index.today"|trans }} - {% endif %} - - {{ entity.user.usernameCanonical }} - - {% if entity.scope %} - {{ entity.scope.name|localize_translatable_string }} - {% else %} - {{ 'crud.admin_user_scope_history.index.undefined'|trans }} - {% endif %} - - - {% endfor %} - {% endblock %} - - {% block actions_before %} -
  • - {{'Back to the admin'|trans }} -
  • - {% endblock %} - - {% block list_actions %} - - {% endblock %} - {% endembed %} -{% endblock %} - diff --git a/src/Bundle/ChillMainBundle/Resources/views/Scope/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Scope/index.html.twig index ac52afa30..38493201e 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Scope/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Scope/index.html.twig @@ -48,9 +48,6 @@
  • {{'Back to the admin'|trans}}
  • -
  • - {{ 'crud.admin_user_scope_history.Show scope history'|trans }} -
  • {{ 'Create a new circle'|trans }}
  • diff --git a/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig b/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig index 4ac863ee6..4c90915ed 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/User/edit.html.twig @@ -1,7 +1,8 @@ -{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} {% block admin_content -%} {% embed '@ChillMain/CRUD/_edit_content.html.twig' %} + {% block crud_content_after_form %} {% if access_permissions_group_list %}

    {{ 'Permissions granted'|trans }}

    @@ -54,5 +55,14 @@ {% endblock %} {% block content_form_actions_save_and_show %}{% endblock %} + + {% block content_form_actions_view %} +
  • + + {{ 'admin.users.job_scope_histories.Show history'|trans }} + +
  • + {% endblock %} + {% endembed %} {% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/User/history.html.twig b/src/Bundle/ChillMainBundle/Resources/views/User/history.html.twig new file mode 100644 index 000000000..ec38ec388 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/User/history.html.twig @@ -0,0 +1,81 @@ +{% extends '@ChillMain/Admin/layoutWithVerticalMenu.html.twig' %} + +{% block title %}{{ 'admin.users.job_scope_histories.index.histories'|trans }}{% endblock title %} + +{% block admin_content %} +

    {{ user.usernameCanonical }}

    +

    {{ 'admin.users.job_scope_histories.index.histories'|trans }}

    + +

    {{ 'admin.users.job_scope_histories.index.job_history.title'|trans }}

    + + + + + + + + + + {% for entity in jobHistories|reverse %} + + + + + + {% endfor %} + +
    {{ 'admin.users.job_scope_histories.index.job_history.start'|trans }}{{ 'admin.users.job_scope_histories.index.job_history.end'|trans }}{{ 'admin.users.job_scope_histories.index.job_history.job'|trans }}
    {{ entity.startDate|format_datetime('medium') }} + {% if entity.endDate is not null %} + {{ entity.endDate|format_datetime('medium') }} + {% else %} + {{ "admin.users.job_scope_histories.index.job_history.today"|trans }} + {% endif %} + + {% if entity.job %} + {{ entity.job.label|localize_translatable_string }} + {% else %} + {{ 'admin.users.job_scope_histories.index.job_history.undefined'|trans }} + {% endif %} +
    + +

    {{ 'admin.users.job_scope_histories.index.scope_history.title'|trans }}

    + + + + + + + + + + {% for entity in scopeHistories|reverse %} + + + + + + {% endfor %} + +
    {{ 'admin.users.job_scope_histories.index.scope_history.start'|trans }}{{ 'admin.users.job_scope_histories.index.scope_history.end'|trans }}{{ 'admin.users.job_scope_histories.index.scope_history.scope'|trans }}
    {{ entity.startDate|format_datetime('medium') }} + {% if entity.endDate is not null %} + {{ entity.endDate|format_datetime('medium') }} + {% else %} + {{ "admin.users.job_scope_histories.index.scope_history.today"|trans }} + {% endif %} + + {% if entity.scope %} + {{ entity.scope.name|localize_translatable_string }} + {% else %} + {{ 'admin.users.job_scope_histories.index.scope_history.undefined'|trans }} + {% endif %} +
    + + + +{% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/UserJob/history.html.twig b/src/Bundle/ChillMainBundle/Resources/views/UserJob/history.html.twig deleted file mode 100644 index a0adf3e30..000000000 --- a/src/Bundle/ChillMainBundle/Resources/views/UserJob/history.html.twig +++ /dev/null @@ -1,51 +0,0 @@ -{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} - -{% block admin_content %} - {% embed '@ChillMain/CRUD/_index.html.twig' %} - - {% block table_entities_thead_tr %} - {{ 'crud.admin_user_job_history.index.start'|trans }} - {{ 'crud.admin_user_job_history.index.end'|trans }} - {{ 'crud.admin_user_job_history.index.user'|trans }} - {{ 'crud.admin_user_job_history.index.job'|trans }} - {% endblock %} - - {% block table_entities_tbody %} - {% for entity in entities %} - - {{ entity.startDate|format_datetime('medium') }} - - {% if entity.endDate is not null %} - {{ entity.endDate|format_datetime('medium') }} - {% else %} - {{ "crud.admin_user_job_history.index.today"|trans }} - {% endif %} - - {{ entity.user.usernameCanonical }} - - {% if entity.job %} - {{ entity.job.label|localize_translatable_string }} - {% else %} - {{ 'crud.admin_user_job_history.index.undefined'|trans }} - {% endif %} - - - {% endfor %} - {% endblock %} - - {% block actions_before %} -
  • - {{'Back to the admin'|trans }} -
  • - {% endblock %} - - {% block list_actions %} - - {% endblock %} - {% endembed %} -{% endblock %} - diff --git a/src/Bundle/ChillMainBundle/Resources/views/UserJob/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/UserJob/index.html.twig index 7ec15f14d..a0c66ccdc 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/UserJob/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/UserJob/index.html.twig @@ -37,9 +37,6 @@
  • {{'Back to the admin'|trans }}
  • -
  • - {{ 'crud.admin_user_job_history.Show job history'|trans }} -
  • {% endblock %} {% endembed %} diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 05a02bde1..28615bc75 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -389,28 +389,6 @@ crud: add_new: Créer title_new: Nouveau métier title_edit: Modifier un métier - admin_user_job_history: - index: - title: Historique des métiers - start: Du - end: Jusque - today: en cours - undefined: non défini - user: Utilisateur - job: Métier - Show job history: Voir l'historique - Back to user job: Revenir aux métiers - admin_user_scope_history: - index: - title: Historique des cercles - start: Du - end: Jusque - today: en cours - undefined: non défini - user: Utilisateur - scope: Cercle - Show scope history: Voir l'historique - Back to user scope: Revenir aux cercles main_location_type: index: title: Liste des types de localisations @@ -673,3 +651,24 @@ admin: center_name: Centre permissionsGroup_id: Identifiant du groupe de permissions permissionsGroup_name: Groupe de permissions + job_scope_histories: + Show history: Voir l'historique + index: + histories: Historique des services et des métiers + Back to user job: Revenir à l'utilisateur + job_history: + title: Historique des métiers + start: Du + end: Jusque + today: en cours + undefined: non défini + user: Utilisateur + job: Métier + scope_history: + title: Historique des services + start: Du + end: Jusque + today: en cours + undefined: non défini + user: Utilisateur + scope: Service diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php index 1b85daea8..3e0ab7add 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionController.php @@ -36,7 +36,17 @@ use Symfony\Contracts\Translation\TranslatorInterface; class HouseholdCompositionController extends AbstractController { - public function __construct(private readonly Security $security, private readonly HouseholdCompositionRepository $householdCompositionRepository, private readonly HouseholdRepository $householdRepository, private readonly PaginatorFactory $paginatorFactory, private readonly FormFactoryInterface $formFactory, private readonly EntityManagerInterface $entityManager, private readonly TranslatorInterface $translator, private readonly \Twig\Environment $engine, private readonly UrlGeneratorInterface $urlGenerator) {} + public function __construct( + private readonly Security $security, + private readonly HouseholdCompositionRepository $householdCompositionRepository, + private readonly HouseholdRepository $householdRepository, + private readonly PaginatorFactory $paginatorFactory, + private readonly FormFactoryInterface $formFactory, + private readonly EntityManagerInterface $entityManager, + private readonly TranslatorInterface $translator, + private readonly \Twig\Environment $engine, + private readonly UrlGeneratorInterface $urlGenerator + ) {} /** * @Route("/{_locale}/person/household/{household_id}/composition/{composition_id}/delete", name="chill_person_household_composition_delete")