Skip to content

Commit

Permalink
Mise en place de la page "Mon espace" (#959)
Browse files Browse the repository at this point in the history
* Add visa model

* Edit visa model

* My area
  • Loading branch information
mmarchois authored Sep 18, 2024
1 parent b5efc86 commit 08b0120
Show file tree
Hide file tree
Showing 41 changed files with 214 additions and 159 deletions.
4 changes: 4 additions & 0 deletions assets/styles/utilities/grow.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.fr-x-grow-32w {
flex-basis: calc(32 * 8px);
flex-grow: 1;
}
1 change: 1 addition & 0 deletions assets/styles/utilities/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
@import './a11y';
@import './gap';
@import './text';
@import './grow';
2 changes: 1 addition & 1 deletion config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ security:
- { path: ^/admin, roles: ROLE_SUPER_ADMIN }
- { path: '^/regulations/([0-9a-f]{8}-[0-9a-f]{4}-[13-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12})$', methods: [GET], roles: PUBLIC_ACCESS }
- { path: '^/regulations$', methods: [GET], roles: PUBLIC_ACCESS }
- { path: '^/(_fragment|regulations|feedback|organizations|profile)', roles: ROLE_USER }
- { path: '^/(_fragment|regulations|feedback|mon-espace)', roles: ROLE_USER }
- { path: ^/, roles: PUBLIC_ACCESS }

role_hierarchy:
Expand Down
6 changes: 6 additions & 0 deletions config/routes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ controllers:
resource: ../src/Infrastructure/Controller/
type: attribute

my_area_controllers:
resource: ../src/Infrastructure/Controller/MyArea
type: attribute
prefix: /mon-espace
trailing_slash_on_root: false

app_logout:
path: /logout
methods: GET
Binary file added public/images/mail-send.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types=1);

namespace App\Infrastructure\Controller\Organization;
namespace App\Infrastructure\Controller\MyArea;

use App\Infrastructure\Security\SymfonyUser;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

final class ListOrganizationsController
final class IndexController
{
public function __construct(
private \Twig\Environment $twig,
Expand All @@ -18,8 +18,8 @@ public function __construct(
}

#[Route(
'/organizations',
name: 'app_organizations_list',
'',
name: 'app_my_area',
methods: ['GET'],
)]
public function __invoke(): Response
Expand All @@ -28,7 +28,7 @@ public function __invoke(): Response
$user = $this->security->getUser();

return new Response($this->twig->render(
name: 'organization/index.html.twig',
name: 'my_area/index.html.twig',
context: [
'organizations' => $user->getUserOrganizations(),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Infrastructure\Controller\Organization;
namespace App\Infrastructure\Controller\MyArea\Organization;

use App\Application\QueryBusInterface;
use App\Application\User\Query\GetOrganizationByUuidQuery;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace App\Infrastructure\Controller\Organization\User;
namespace App\Infrastructure\Controller\MyArea\Organization\User;

use App\Application\CommandBusInterface;
use App\Application\QueryBusInterface;
use App\Application\User\Command\SaveOrganizationUserCommand;
use App\Domain\User\Exception\UserAlreadyRegisteredException;
use App\Infrastructure\Controller\Organization\AbstractOrganizationController;
use App\Infrastructure\Controller\MyArea\Organization\AbstractOrganizationController;
use App\Infrastructure\Form\User\UserFormType;
use App\Infrastructure\Security\Voter\OrganizationVoter;
use Symfony\Bundle\SecurityBundle\Security;
Expand Down Expand Up @@ -72,7 +72,7 @@ public function __invoke(Request $request, string $organizationUuid): Response

return new Response(
content: $this->twig->render(
name: 'organization/user/form.html.twig',
name: 'my_area/organization/user/form.html.twig',
context: [
'organization' => $organization,
'form' => $form->createView(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Infrastructure\Controller\Organization\User;
namespace App\Infrastructure\Controller\MyArea\Organization\User;

use App\Application\CommandBusInterface;
use App\Application\QueryBusInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Infrastructure\Controller\Organization\User;
namespace App\Infrastructure\Controller\MyArea\Organization\User;

use App\Application\CommandBusInterface;
use App\Application\QueryBusInterface;
Expand Down Expand Up @@ -82,7 +82,7 @@ public function __invoke(Request $request, string $organizationUuid, string $uui

return new Response(
content: $this->twig->render(
name: 'organization/user/form.html.twig',
name: 'my_area/organization/user/form.html.twig',
context: [
'organization' => $organization,
'user' => $user,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace App\Infrastructure\Controller\Organization\User;
namespace App\Infrastructure\Controller\MyArea\Organization\User;

use App\Application\QueryBusInterface;
use App\Application\User\Query\GetOrganizationUsersQuery;
use App\Infrastructure\Controller\Organization\AbstractOrganizationController;
use App\Infrastructure\Controller\MyArea\Organization\AbstractOrganizationController;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
Expand Down Expand Up @@ -34,7 +34,7 @@ public function __invoke(string $uuid): Response
$users = $this->queryBus->handle(new GetOrganizationUsersQuery($uuid));

return new Response($this->twig->render(
name: 'organization/user/index.html.twig',
name: 'my_area/organization/user/index.html.twig',
context: [
'users' => $users,
'organization' => $organization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace App\Infrastructure\Controller\Organization\VisaModel;
namespace App\Infrastructure\Controller\MyArea\Organization\VisaModel;

use App\Application\CommandBusInterface;
use App\Application\QueryBusInterface;
use App\Application\VisaModel\Command\SaveVisaModelCommand;
use App\Infrastructure\Controller\Organization\AbstractOrganizationController;
use App\Infrastructure\Controller\MyArea\Organization\AbstractOrganizationController;
use App\Infrastructure\Form\User\VisaModelFormType;
use App\Infrastructure\Security\Voter\OrganizationVoter;
use Symfony\Bundle\SecurityBundle\Security;
Expand Down Expand Up @@ -62,7 +62,7 @@ public function __invoke(Request $request, string $organizationUuid): Response

return new Response(
content: $this->twig->render(
name: 'organization/visa_model/form.html.twig',
name: 'my_area/organization/visa_model/form.html.twig',
context: [
'organization' => $organization,
'form' => $form->createView(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types=1);

namespace App\Infrastructure\Controller\Organization\VisaModel;
namespace App\Infrastructure\Controller\MyArea\Organization\VisaModel;

use App\Application\CommandBusInterface;
use App\Application\QueryBusInterface;
use App\Application\VisaModel\Command\SaveVisaModelCommand;
use App\Application\VisaModel\Query\GetVisaModelQuery;
use App\Domain\VisaModel\Exception\VisaModelNotFoundException;
use App\Infrastructure\Controller\Organization\AbstractOrganizationController;
use App\Infrastructure\Controller\MyArea\Organization\AbstractOrganizationController;
use App\Infrastructure\Form\User\VisaModelFormType;
use App\Infrastructure\Security\Voter\OrganizationVoter;
use Symfony\Bundle\SecurityBundle\Security;
Expand Down Expand Up @@ -71,7 +71,7 @@ public function __invoke(Request $request, string $organizationUuid, string $uui

return new Response(
content: $this->twig->render(
name: 'organization/visa_model/form.html.twig',
name: 'my_area/organization/visa_model/form.html.twig',
context: [
'organization' => $organization,
'visaModel' => $visaModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace App\Infrastructure\Controller\Organization\VisaModel;
namespace App\Infrastructure\Controller\MyArea\Organization\VisaModel;

use App\Application\QueryBusInterface;
use App\Application\VisaModel\Query\GetOrganizationVisaModelsQuery;
use App\Infrastructure\Controller\Organization\AbstractOrganizationController;
use App\Infrastructure\Controller\MyArea\Organization\AbstractOrganizationController;
use Symfony\Bundle\SecurityBundle\Security;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
Expand Down Expand Up @@ -34,7 +34,7 @@ public function __invoke(string $uuid): Response
$visaModels = $this->queryBus->handle(new GetOrganizationVisaModelsQuery($uuid));

return new Response($this->twig->render(
name: 'organization/visa_model/index.html.twig',
name: 'my_area/organization/visa_model/index.html.twig',
context: [
'visaModels' => $visaModels,
'organization' => $organization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Infrastructure\Controller\Profile;
namespace App\Infrastructure\Controller\MyArea\Profile;

use App\Application\CommandBusInterface;
use App\Application\User\Command\SavePasswordCommand;
Expand Down Expand Up @@ -54,7 +54,7 @@ public function __invoke(Request $request): Response

return new Response(
content: $this->twig->render(
name: 'profile/edit-password.html.twig',
name: 'my_area/profile/edit-password.html.twig',
context: [
'user' => $user,
'form' => $form->createView(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Infrastructure\Controller\Profile;
namespace App\Infrastructure\Controller\MyArea\Profile;

use App\Application\CommandBusInterface;
use App\Application\User\Command\SaveProfileCommand;
Expand Down Expand Up @@ -63,7 +63,7 @@ public function __invoke(Request $request): Response

return new Response(
content: $this->twig->render(
name: 'profile/index.html.twig',
name: 'my_area/profile/index.html.twig',
context: [
'user' => $user,
'form' => $form->createView(),
Expand Down
11 changes: 2 additions & 9 deletions templates/common/header.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,9 @@
{{ 'common.feedback'|trans }}
</a>
</li>
{% if is_granted('ROLE_SUPER_ADMIN') %}
<li>
<a class="fr-btn fr-icon-settings-5-line" href="{{ path('app_admin') }}">
Administration
</a>
</li>
{% endif %}
<li>
<a class="fr-btn fr-icon-lock-unlock-line" href="{{ path('app_logout') }}" data-testid="logout-link">
{{ 'common.logout'|trans }}
<a class="fr-btn fr-icon-account-circle-fill" href="{{ path('app_my_area') }}">
{{ 'myarea.title'|trans }}
</a>
</li>
{% else %}
Expand Down
71 changes: 71 additions & 0 deletions templates/my_area/index.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{% extends 'layouts/app.html.twig' %}

{% block title %}
{{'user.myarea'|trans}} - {{ parent() }}
{% endblock %}

{% block body %}
<section class="fr-container fr-py-5w" aria-labelledby="myarea">
<div class="fr-grid-row fr-x-gap-2w">
<div class="fr-x-grow-32w">
<h2 id="myarea">{{ 'user.myarea'|trans }}</h2>
<p>{{ 'user.myarea.description'|trans }}</p>
</div>
<div class="fr-mb-3w">
<a class="fr-btn fr-btn--icon-left fr-icon-logout-box-r-line fr-btn--secondary" href="{{ path('app_logout') }}" data-testid="logout-link">
{{ 'common.logout'|trans }}
</a>
</div>
</div>

<h3>{{ 'profile.title'|trans }}</h2>
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12 fr-col-md-4 fr-col-lg-4">
<div class="fr-tile fr-tile--horizontal fr-enlarge-link">
<div class="fr-tile__body">
<div class="fr-tile__content">
<h3 class="fr-tile__title">
<a href="{{ path('app_profile') }}">{{ 'profile.title'|trans }}</a>
</h3>
<p class="fr-tile__detail">
{{ 'profile.description'|trans }}
</p>
</div>
</div>
<div class="fr-tile__header">
<div class="fr-tile__pictogram">
<img src="{{ asset('images/mail-send.png') }}" alt="mail-send" />
</div>
</div>
</div>
</div>
</div>

<h3 class="fr-mt-3w" id="organization-list">{{ 'organization.list.title'|trans }}</h2>
<div class="fr-grid-row fr-grid-row--gutters" data-testid="organization-list">
{% for organization in organizations %}
<div class="fr-col-12 fr-col-md-4 fr-col-lg-4" data-testid="organization-detail">
<div class="fr-tile fr-tile--horizontal fr-enlarge-link">
<div class="fr-tile__body">
<div class="fr-tile__content">
<h3 class="fr-tile__title">
<a href="{{ path('app_users_list', { uuid: organization.uuid }) }}">{{ organization.name }}</a>
</h3>
<p class="fr-tile__detail">
{% for role in organization.roles %}
{{ ('roles.' ~ role)|trans }}{% if not loop.last %}, {% endif %}
{% endfor %}
</p>
</div>
</div>
<div class="fr-tile__header">
<div class="fr-tile__pictogram">
<img src="{{ asset('images/city-hall.png') }}" alt="city-hall" />
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</section>
{% endblock %}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<section class="fr-container fr-py-5w">
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12 fr-col-md-4">
{% include 'organization/_menu.html.twig' with { organization } only %}
{% include 'my_area/organization/_menu.html.twig' with { organization } only %}
</div>
<div class="fr-col-12 fr-col-md-8">
{% include "common/breadcrumb.html.twig" with { items: [
{ title: 'user.myarea'|trans, path: 'app_organizations_list'},
{ title: 'user.myarea'|trans, path: 'app_my_area'},
{ title: organization.name, url: path('app_users_list', {uuid: organization.uuid}), generatedPath: true },
{ title: 'user.list.title'|trans, url: path('app_users_list', {uuid: organization.uuid}), generatedPath: true },
{ title: metaTitle },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<section class="fr-container fr-py-5w" aria-labelledby="user-list">
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12 fr-col-md-4">
{% include 'organization/_menu.html.twig' with { organization } only %}
{% include 'my_area/organization/_menu.html.twig' with { organization } only %}
</div>
<div class="fr-col-12 fr-col-md-8">
{% include "common/breadcrumb.html.twig" with { items: [
{ title: 'user.myarea'|trans, path: 'app_organizations_list'},
{ title: 'user.myarea'|trans, path: 'app_my_area'},
{ title: organization.name, url: path('app_users_list', {uuid: organization.uuid}), generatedPath: true },
{ title: 'user.list.title'|trans },
]} %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
<section class="fr-container fr-py-5w">
<div class="fr-grid-row fr-grid-row--gutters">
<div class="fr-col-12 fr-col-md-4">
{% include 'organization/_menu.html.twig' with { organization } only %}
{% include 'my_area/organization/_menu.html.twig' with { organization } only %}
</div>
<div class="fr-col-12 fr-col-md-8">
{% include "common/breadcrumb.html.twig" with { items: [
{ title: 'user.myarea'|trans, path: 'app_organizations_list'},
{ title: 'user.myarea'|trans, path: 'app_my_area'},
{ title: organization.name, url: path('app_users_list', {uuid: organization.uuid}), generatedPath: true },
{ title: 'visa.list.title'|trans, url: path('app_config_visa_models_list', {uuid: organization.uuid}), generatedPath: true },
{ title: metaTitle },
Expand Down
Loading

0 comments on commit 08b0120

Please sign in to comment.