From 124abf563eb62895bd125e018ea418d5624d0b5c Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 20 Sep 2023 12:24:27 +0200 Subject: [PATCH] Create twig templates for admin jobs/scopes histories --- .../ChillMainExtension.php | 28 +++++++++ .../Resources/views/Scope/history.html.twig | 59 +++++++++++++++++++ .../Resources/views/Scope/index.html.twig | 15 +++-- .../Resources/views/UserJob/history.html.twig | 59 +++++++++++++++++++ .../Resources/views/UserJob/index.html.twig | 5 +- .../translations/messages.fr.yml | 18 ++++++ 6 files changed, 177 insertions(+), 7 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Resources/views/Scope/history.html.twig create mode 100644 src/Bundle/ChillMainBundle/Resources/views/UserJob/history.html.twig diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index 6760a798f..236848435 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -56,6 +56,8 @@ use Chill\MainBundle\Entity\Regroupment; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Form\CenterType; +use Chill\MainBundle\Entity\User\UserJobHistory; +use Chill\MainBundle\Entity\User\UserScopeHistory; use Chill\MainBundle\Form\CivilityType; use Chill\MainBundle\Form\CountryType; use Chill\MainBundle\Form\LanguageType; @@ -371,6 +373,32 @@ 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 new file mode 100644 index 000000000..3c08620c7 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/views/Scope/history.html.twig @@ -0,0 +1,59 @@ +{% 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 %} + {{ dump(entities) }} + {# + #} + {% for entity in entities %} + + + {# {{ dump(entity.id) }} #} + {{ entity.startDate|format_datetime('medium') }} + + {{ entity.endDate|format_datetime('medium') }} + + {% for scope in entity.scope %} + {# + #} + {{ dump(scope) }} + {{ scope.label|localize_translatable_string }} + {% endfor %} + + + {% for user in entity.user %} + {# + #} + {{ dump(user.id) }} + {{ user.usernameCanonical }} + {% endfor %} + + + {% 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 60beb7ed7..ac52afa30 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Scope/index.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Scope/index.html.twig @@ -4,20 +4,20 @@ {% block admin_content -%} {% embed '@ChillMain/CRUD/_index.html.twig' %} - + {% block index_header %}

    {{ 'List circles'|trans }}

    {% endblock %} - + {% block filter_order %}{% endblock %} - + {% block table_entities_thead_tr %} id {{ 'Name'|trans }} {{ 'Active'|trans }} {{ 'Actions'|trans }} {% endblock %} - + {% block table_entities_tbody %} {% for entity in entities %} @@ -40,14 +40,17 @@ {% endfor %} {% endblock %} - + {% block pagination %}{% endblock %} - + {% block list_actions %}