Skip to content

Commit

Permalink
create account and privacy page
Browse files Browse the repository at this point in the history
  • Loading branch information
saracamilo committed Jan 9, 2025
1 parent 25d2282 commit f102dec
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 45 deletions.
6 changes: 6 additions & 0 deletions config/routes/admin/user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ timeline:
path: /{id}/timeline
controller: App\Controller\Web\Admin\UserAdminController::timeline
methods: ['GET']

account_privacy:
path: /{id}/account-privacy
controller: App\Controller\Web\Admin\UserAdminController::accountPrivacy
methods: ['GET']

25 changes: 25 additions & 0 deletions cypress/e2e/admin/account_privacy/account-privacy.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
describe('Painel de Controle - Página de Conta e Privacidade', () => {
beforeEach(() => {
cy.viewport(1920, 1080);
cy.visit('/login');
cy.get('[data-cy="email"]').type('[email protected]');
cy.get('[data-cy="password"]').type('Aurora@2024');
cy.get('[data-cy="submit"]').click();
cy.visit('/painel');
});

it('Deve acessar a página de Conta e Privacidade a partir do menu do usuário', () => {
cy.url().should('include', '/painel');
cy.contains('Olá, Talyson Soares', { timeout: 10000 }).should('be.visible');

cy.contains('Talyson Soares', { timeout: 10000 })
.should('be.visible')
.click();

cy.contains('Conta e Privacidade', { timeout: 10000 })
.should('be.visible')
.click();
cy.url().should('include', '/account-privacy');
cy.contains('Configurações da conta do usuário', { timeout: 10000 }).should('be.visible');
});
});
22 changes: 22 additions & 0 deletions src/Controller/Web/Admin/UserAdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,26 @@ public function timeline(Uuid $id): Response
'events' => $events,
]);
}

public function accountPrivacy(Uuid $id): Response
{
$user = $this->service->get($id);

if (!$user) {
return $this->redirectToRoute('login');
}

return $this->render('user/account-privacy.html.twig', [
'user' => [
'name' => $user->getName(),
'id' => $user->getId(),
'isActive' => $user->isActive(),
'lastLogin' => $user->getLastLogin(),
'createdAt' => $user->getCreatedAt(),
'email' => $user->getEmail(),
'acceptedTerms' => null !== $user->getUpdatedAt(),
'acceptedTermsDate' => $user->getUpdatedAt(),
],
]);
}
}
10 changes: 10 additions & 0 deletions src/Entity/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ public function getUserIdentifier(): string
return $this->email;
}

public function isActive(): bool
{
return null === $this->deletedAt;
}

public function getLastLogin(): ?DateTime
{
return $this->updatedAt;
}

public function toArray(): array
{
return [
Expand Down
69 changes: 69 additions & 0 deletions templates/_admin/user/account-privacy.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{% extends "_layouts/blank.html.twig" %}

{% block title %} {{ 'account_privacy' | trans }} - {{ user.name }}{% endblock %}

{% block content %}
{% include '_components/modal-confirm-remove.html.twig' %}
<section class="d-flex">
{% include "_components/side-bar.html.twig" %}

<section class="account-privacy w-100 px-3">
<div class="d-flex align-items-center my-4">
<span class="iconify me-2" data-icon="bi:gear-fill" style="font-size: 2rem; color: #000;"></span>
<h2 class="fw-bold mb-0" style="font-size: 1.75rem;">{{ 'account_privacy' | trans }}</h2>
</div>

<div class="d-flex align-items-center my-4">
<div class="avatar-wrapper me-3" style="width: 100px; height: 100px; border-radius: 50%; overflow: hidden; background-color: #f5f5f5; display: flex; align-items: center; justify-content: center; border: 2px solid #ddd;">
<span class="iconify" data-icon="bi:person-fill" style="font-size: 2.5rem; color: #6c757d;"></span>
</div>
<div class="w-100 d-flex align-items-start">
<div>
<h4 class="fw-bold mb-0" style="font-size: 1.5rem;">{{ user.name }}</h4>
<p class="text-muted mb-0" style="font-size: 1rem;">ID: {{ user.id }}</p>
<p>Status:
<strong class="{% if user.isActive %}text-success{% else %}text-danger{% endif %}">
{{ user.isActive ? 'Ativo' : 'Inativo' }}
</strong>
</p>
</div>
<div class="ms-4">
<p class="mb-1"><strong>{{ 'last_logiin' | trans }}</strong> {{ user.lastLogin|date('d/m/Y H:i') }}</p>
<p class="mb-0"><strong>{{ 'date_created' | trans }}</strong> {{ user.createdAt|date('d/m/Y H:i') }}</p>
</div>
</div>
</div>

<div class="card shadow-sm mb-4">
<div class="card-body">
<h5 class="mb-3">{{ 'account_settings' | trans }}</h5>
<p>
<strong>{{ 'E-mail' }}:</strong> {{ user.email }}
<a href="#" class="text-primary ms-2">
{{ 'change_email' | trans }}
<span class="iconify" data-icon="bi:pencil-fill" style="font-size: 1rem; margin-left: 5px;"></span>
</a>
</p>
<p>
<strong>{{ 'password' }}:</strong> ********
<a href="#" class="text-primary ms-2">
{{ 'change_password' | trans }}
<span class="iconify" data-icon="bi:pencil-fill" style="font-size: 1rem; margin-left: 5px;"></span>
</a>
</p>
</div>
</div>

<div class="card shadow-sm mb-4">
<div class="card-body">
<h5 class="mb-3">{{ 'accept_terms' | trans }}</h5>
{% if user.acceptedTerms %}
<p> Os termos foram aceitos em {{ user.acceptedTermsDate|date('d/m/Y') }}</p>
{% else %}
<p class="text-danger">O usuário ainda não aceitou os termos.</p>
{% endif %}
</div>
</div>
</section>
</section>
{% endblock %}
74 changes: 37 additions & 37 deletions templates/_components/navbar.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,57 +30,57 @@
</li>

{% if (env.aurora.modules.opportunities != '' ) %}
<li class="nav-item">
<a class="nav-link opportunity" aria-current="page" href="{{ path('web_opportunity_list') }}">
<i class="material-icons navbar-icons">lightbulb</i>
<p>{{env.aurora.modules.opportunities ?? 'opportunities'|trans }}</p>
</a>
</li>
<li class="nav-item">
<a class="nav-link opportunity" aria-current="page" href="{{ path('web_opportunity_list') }}">
<i class="material-icons navbar-icons">lightbulb</i>
<p>{{env.aurora.modules.opportunities ?? 'opportunities'|trans }}</p>
</a>
</li>
{% endif %}

{% if (env.aurora.modules.agents != '' ) %}
<li class="nav-item">
<a class="nav-link agent" aria-current="page" href="{{ path('web_agent_list') }}">
<i class="material-icons navbar-icons">group</i>
<p>{{ env.aurora.modules.agents ?? 'agents'|trans }}</p>
</a>
</li>
<li class="nav-item">
<a class="nav-link agent" aria-current="page" href="{{ path('web_agent_list') }}">
<i class="material-icons navbar-icons">group</i>
<p>{{ env.aurora.modules.agents ?? 'agents'|trans }}</p>
</a>
</li>
{% endif %}

{% if (env.aurora.modules.organizations != '' ) %}
<li class="nav-item">
<a class="nav-link organization" aria-current="page" href="{{ path('web_organization_list') }}">
<i class="material-icons navbar-icons">corporate_fare</i>
<p>{{ env.aurora.modules.organizations ?? 'organizations'|trans }}</p>
</a>
</li>
<li class="nav-item">
<a class="nav-link organization" aria-current="page" href="{{ path('web_organization_list') }}">
<i class="material-icons navbar-icons">corporate_fare</i>
<p>{{ env.aurora.modules.organizations ?? 'organizations'|trans }}</p>
</a>
</li>
{% endif %}

{% if (env.aurora.modules.events != '' ) %}
<li class="nav-item">
<a class="nav-link event" aria-current="page" href="{{ path('web_event_list') }}">
<i class="material-icons navbar-icons">event</i>
<p>{{ env.aurora.modules.events ?? 'events'|trans }}</p>
</a>
</li>
<li class="nav-item">
<a class="nav-link event" aria-current="page" href="{{ path('web_event_list') }}">
<i class="material-icons navbar-icons">event</i>
<p>{{ env.aurora.modules.events ?? 'events'|trans }}</p>
</a>
</li>
{% endif %}

{% if (env.aurora.modules.spaces != '' ) %}
<li class="nav-item">
<a class="nav-link space" aria-current="page" href="{{ path('web_space_list') }}">
<i class="material-icons navbar-icons">domain</i>
<p>{{ env.aurora.modules.spaces ?? 'spaces'|trans }}</p>
</a>
</li>
<li class="nav-item">
<a class="nav-link space" aria-current="page" href="{{ path('web_space_list') }}">
<i class="material-icons navbar-icons">domain</i>
<p>{{ env.aurora.modules.spaces ?? 'spaces'|trans }}</p>
</a>
</li>
{% endif %}

{% if (env.aurora.modules.initiatives != '' ) %}
<li class="nav-item">
<a class="nav-link project" aria-current="page" href="{{ path('web_initiative_list') }}">
<i class="material-icons navbar-icons">article</i>
<p>{{ env.aurora.modules.initiatives ?? 'initiatives'|trans }}</p>
</a>
</li>
<li class="nav-item">
<a class="nav-link project" aria-current="page" href="{{ path('web_initiative_list') }}">
<i class="material-icons navbar-icons">article</i>
<p>{{ env.aurora.modules.initiatives ?? 'initiatives'|trans }}</p>
</a>
</li>
{% endif %}
</ul>

Expand Down Expand Up @@ -123,7 +123,7 @@
</div>
<div class="menu-column">
<div class="dropdown-header">{{ 'other_options' | trans }}</div>
<a class="dropdown-item" href="#">
<a class="dropdown-item" href="{{ path('admin_user_account_privacy', {id: app.user.id}) }}">
<i class="material-icons">settings</i> {{ 'account_privacy' | trans }}
</a>
<a class="dropdown-item" href="{{ path('admin_dashboard') }}">
Expand Down
6 changes: 6 additions & 0 deletions translations/messages.en.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
add: Add
account_privacy: Account and Privacy
account_settings: User Account Settings
access: Access
accessibility: Accessibility
access_main_agent: Access the main agent
accountability: Accountability
accompany: To accompany
actions: Actions
accept_terms: Accept the terms
address: Address
admin_options: Admin Options
add_archive: Add
Expand Down Expand Up @@ -64,10 +66,13 @@ create_in_draft: Create in Draft
create_account: Create Account
created_at: Created at
chain: Chain
change_email: Change email
change_password: Change password
contact: Contact
cultural_language: Cultural language
cultural_languages: Cultural languages

date_created: Date created
dashboard: Dashboard
draft: In draft
delete: Delete
Expand Down Expand Up @@ -132,6 +137,7 @@ introduction: Introduction
is_itinerant: Is it an itinerant agent?
language: Language
lastname: Last Name
last_login: Last Login
linked_with: Linked With
link: Add Link
list: List
Expand Down
6 changes: 6 additions & 0 deletions translations/messages.es.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
add: Añadir
account_privacy: Cuenta y Privacidad
account_settings: Configuración de la cuenta de usuario
access: Acceder
accessibility: Accesibilidad
access_main_agent: Acceder al Agente Principal
accountability: Rendición de Cuentas
accompany: Acompañar
actions: Acciones
accept_terms: Aceite de los termos
address: Dirección
admin_options: Opciones del Administrador
add_archive: Añadir
Expand Down Expand Up @@ -64,10 +66,13 @@ create_in_draft: Crear en borrador
create_account: Crear Cuenta
created_at: Creado en
chain: Cadena
change_email: Cambiar correo electrónico
change_password: Cambiar la contraseña
contact: Contacto
cultural_language: Lenguaje cultural
cultural_languages: Lenguajes culturales

date_created: Fecha de creación
dashboard: Panel de Control
draft: En borrador
delete: Eliminar
Expand Down Expand Up @@ -131,6 +136,7 @@ is_itinerant: ¿Es agente itinerante?

language: Idioma
lastname: Apellido
last_login: Último inicio de sesión
linked_with: Vinculado Con
link: Añadir Enlace
list: Lista
Expand Down
6 changes: 6 additions & 0 deletions translations/messages.pt-br.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
add: Adicionar
account_privacy: Conta e Privacidade
account_settings: Configurações da conta do usuário
access: Acessar
accessibility: Acessibilidade
access_main_agent: Acesse agente principal
accountability: Prestações de Conta
accompany: Acompanhar
actions: Ações
accept_terms: Aceite os termos
address: Endereço
administration: Administração
agent: Agente
Expand Down Expand Up @@ -64,10 +66,13 @@ create_in_draft: Criar em Rascunho
create_account: Crie sua conta
created_at: Criado em
chain: Corrente
change_email: Alterar email
change_password: Alterar Senha
contact: Contato
cultural_language: Linguagem cultural
cultural_languages: Linguagens culturais

date_created: Data de criação
dashboard: Painel de Controle
draft: Em rascunho
delete: Excluir
Expand Down Expand Up @@ -131,6 +136,7 @@ is_itinerant: É agente itinerante?

language: Idioma
lastname: Sobrenome
last_login: Último Login
linked_with: Vinculado com
list: Lista
link: Adicionar Link
Expand Down
Loading

0 comments on commit f102dec

Please sign in to comment.