diff --git a/.vscode/settings.json b/.vscode/settings.json index bf5ee55..39e29c9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -11,5 +11,5 @@ }, "editor.formatOnSave": false }, - "conventionalCommits.scopes": ["Backoffice", "Web", "CV", "GenericTable"] + "conventionalCommits.scopes": ["Backoffice", "Web", "CV", "GenericTable", "Auth"] } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index fbe810f..6d8af6d 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -1,36 +1,37 @@ import { NgModule } from '@angular/core'; import { PreloadAllModules, RouterModule, Routes } from '@angular/router'; -import { FormularioRecuperacionComponent } from './backoffice/autentificacion/formulario-recuperacion/formulario-recuperacion.component'; -import { LoginSuccessComponent } from './backoffice/autentificacion/login-success/login-success.component'; -import { LoginComponent } from './backoffice/autentificacion/login/login.component'; -import { RecuperarPasswordComponent } from './backoffice/autentificacion/recuperar-password/recuperar-password.component'; +import { + FormResetPasswordComponent, + formResetPasswordTitleResolver, +} from './backoffice/autentificacion/form-reset-password/form-reset-password.component'; +import { LoginComponent, loginTitleResolver } from './backoffice/autentificacion/login/login.component'; +import { + ResetPasswordComponent, + resetPasswordTitleResolver, +} from './backoffice/autentificacion/reset-password/reset-password.component'; import { AuthGuard } from './shared/guards/auth.guard'; const routes: Routes = [ { path: '', canActivate: [], - loadChildren: () => - import('./website/website.module').then((m) => m.WebsiteModule), + loadChildren: () => import('./website/website.module').then((m) => m.WebsiteModule), }, { path: 'backoffice', - loadChildren: () => - import('./backoffice/layout/backoffice/backoffice.module').then( - (m) => m.BackofficeModule, - ), + loadChildren: () => import('./backoffice/layout/backoffice/backoffice.module').then((m) => m.BackofficeModule), canActivate: [AuthGuard], }, - { path: 'login', component: LoginComponent }, - { path: 'login-success', component: LoginSuccessComponent }, - { path: 'reset-password', component: RecuperarPasswordComponent }, + { path: 'login', component: LoginComponent, title: loginTitleResolver }, + { path: 'reset-password', component: ResetPasswordComponent, title: resetPasswordTitleResolver }, { path: 'form-reset-password', - component: FormularioRecuperacionComponent, + component: FormResetPasswordComponent, + title: formResetPasswordTitleResolver, }, { path: 'form-reset-password/:access_token/', - component: FormularioRecuperacionComponent, + component: FormResetPasswordComponent, }, { path: '**', diff --git a/src/app/app.module.ts b/src/app/app.module.ts index acfbcbd..f8ca0e0 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -16,10 +16,9 @@ import { InputTextModule } from 'primeng/inputtext'; import { ToastModule } from 'primeng/toast'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; -import { FormularioRecuperacionComponent } from './backoffice/autentificacion/formulario-recuperacion/formulario-recuperacion.component'; -import { LoginSuccessComponent } from './backoffice/autentificacion/login-success/login-success.component'; +import { FormResetPasswordComponent } from './backoffice/autentificacion/form-reset-password/form-reset-password.component'; import { LoginComponent } from './backoffice/autentificacion/login/login.component'; -import { RecuperarPasswordComponent } from './backoffice/autentificacion/recuperar-password/recuperar-password.component'; +import { ResetPasswordComponent } from './backoffice/autentificacion/reset-password/reset-password.component'; import { BackofficeModule } from './backoffice/layout/backoffice/backoffice.module'; import { LanguageSelectModule } from './shared/components/language-select/language-select.module'; import { LanguagesModule } from './shared/modules/languages.module'; @@ -30,13 +29,7 @@ export function HttpLoaderFactory(http: HttpClient) { return new TranslateHttpLoader(http, './assets/i18n/'); } @NgModule({ - declarations: [ - AppComponent, - LoginComponent, - LoginSuccessComponent, - FormularioRecuperacionComponent, - RecuperarPasswordComponent, - ], + declarations: [AppComponent, LoginComponent, FormResetPasswordComponent, ResetPasswordComponent], providers: [MessageService, ConfirmationService, PrimeNGConfig], bootstrap: [AppComponent], imports: [ diff --git a/src/app/backoffice/autentificacion/form-reset-password/form-reset-password.component.html b/src/app/backoffice/autentificacion/form-reset-password/form-reset-password.component.html new file mode 100644 index 0000000..5b3de67 --- /dev/null +++ b/src/app/backoffice/autentificacion/form-reset-password/form-reset-password.component.html @@ -0,0 +1,52 @@ +
+
+ +
+
+
+
+
+

{{ 'pages.form-reset-password.title' | translate }}

+
+
+
+
+
+ + + + +
+
+ + + + +
+
+
+ + +
+
+
+
+
+
+
diff --git a/src/app/backoffice/autentificacion/form-reset-password/form-reset-password.component.scss b/src/app/backoffice/autentificacion/form-reset-password/form-reset-password.component.scss new file mode 100644 index 0000000..33a2804 --- /dev/null +++ b/src/app/backoffice/autentificacion/form-reset-password/form-reset-password.component.scss @@ -0,0 +1 @@ +@import '../styles/auth-styles.scss'; diff --git a/src/app/backoffice/autentificacion/formulario-recuperacion/formulario-recuperacion.component.ts b/src/app/backoffice/autentificacion/form-reset-password/form-reset-password.component.ts similarity index 68% rename from src/app/backoffice/autentificacion/formulario-recuperacion/formulario-recuperacion.component.ts rename to src/app/backoffice/autentificacion/form-reset-password/form-reset-password.component.ts index f004ee4..56ce171 100644 --- a/src/app/backoffice/autentificacion/formulario-recuperacion/formulario-recuperacion.component.ts +++ b/src/app/backoffice/autentificacion/form-reset-password/form-reset-password.component.ts @@ -1,17 +1,29 @@ import { ChangeDetectionStrategy, Component, OnInit, inject } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute, ActivatedRouteSnapshot, ResolveFn, Router, RouterStateSnapshot } from '@angular/router'; import { TranslateService } from '@ngx-translate/core'; import { MessageService } from 'primeng/api'; +import { map } from 'rxjs'; +import { appRootTitle } from 'src/app/app.component'; import { AuthService } from 'src/app/shared/services/auth.service'; +export const formResetPasswordTitleResolver: ResolveFn = ( + route: ActivatedRouteSnapshot, + state: RouterStateSnapshot, +) => { + const translateSrv = inject(TranslateService); + return translateSrv + .get('pages.form-reset-password.title') + .pipe(map((title) => `${appRootTitle} | Form Reset Password`)); +}; + @Component({ - selector: 'app-formulario-recuperacion', - templateUrl: './formulario-recuperacion.component.html', - styleUrls: ['./formulario-recuperacion.component.scss'], + selector: 'app-form-reset-password', + templateUrl: './form-reset-password.component.html', + styleUrls: ['./form-reset-password.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class FormularioRecuperacionComponent implements OnInit { +export class FormResetPasswordComponent implements OnInit { private messageSrv = inject(MessageService); private fb = inject(FormBuilder); private route = inject(ActivatedRoute); @@ -24,7 +36,6 @@ export class FormularioRecuperacionComponent implements OnInit { token: string; loading: boolean = false; errores: string[] = []; - // logoUrl: string = environment.logo; res: string; @@ -39,7 +50,7 @@ export class FormularioRecuperacionComponent implements OnInit { }); } - async recuperar() { + async onSubmit() { if (this.form.invalid) { return; } diff --git a/src/app/backoffice/autentificacion/formulario-recuperacion/formulario-recuperacion.component.html b/src/app/backoffice/autentificacion/formulario-recuperacion/formulario-recuperacion.component.html deleted file mode 100644 index eff6f7f..0000000 --- a/src/app/backoffice/autentificacion/formulario-recuperacion/formulario-recuperacion.component.html +++ /dev/null @@ -1,80 +0,0 @@ -
- - -
diff --git a/src/app/backoffice/autentificacion/formulario-recuperacion/formulario-recuperacion.component.scss b/src/app/backoffice/autentificacion/formulario-recuperacion/formulario-recuperacion.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/backoffice/autentificacion/login-success/login-success.component.html b/src/app/backoffice/autentificacion/login-success/login-success.component.html deleted file mode 100644 index 5da3bf4..0000000 --- a/src/app/backoffice/autentificacion/login-success/login-success.component.html +++ /dev/null @@ -1,7 +0,0 @@ -
- - -
-

Success

-
-
diff --git a/src/app/backoffice/autentificacion/login-success/login-success.component.scss b/src/app/backoffice/autentificacion/login-success/login-success.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/backoffice/autentificacion/login-success/login-success.component.ts b/src/app/backoffice/autentificacion/login-success/login-success.component.ts deleted file mode 100644 index 3bd5fa0..0000000 --- a/src/app/backoffice/autentificacion/login-success/login-success.component.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'app-login-success', - templateUrl: './login-success.component.html', - styleUrls: ['./login-success.component.scss'], - changeDetection: ChangeDetectionStrategy.OnPush, -}) -export class LoginSuccessComponent implements OnInit { - ngOnInit(): void {} -} diff --git a/src/app/backoffice/autentificacion/login/login.component.html b/src/app/backoffice/autentificacion/login/login.component.html index aa67dab..c4f7c40 100644 --- a/src/app/backoffice/autentificacion/login/login.component.html +++ b/src/app/backoffice/autentificacion/login/login.component.html @@ -1,132 +1,55 @@ -
- - - + + +
@@ -44,12 +39,8 @@

Juan Sáez García

diff --git a/src/app/website/components/sidebar/sidebar.component.scss b/src/app/website/components/sidebar/sidebar.component.scss index 0154f22..ae10fc7 100644 --- a/src/app/website/components/sidebar/sidebar.component.scss +++ b/src/app/website/components/sidebar/sidebar.component.scss @@ -146,8 +146,15 @@ body { font-size: 60px; } -.hamburguesa { +.hamburguer-menu { display: none; + + fa-icon { + padding: 0.5em; + border-radius: 5px; + width: 2em; + aspect-ratio: 1/1; + } } @media screen and (max-height: 450px) { @@ -170,7 +177,7 @@ body { .cms { display: none; } - .hamburguesa { + .hamburguer-menu { display: inline; width: 15%; } @@ -203,9 +210,13 @@ body { } } - .hamburguesa { + .hamburguer-menu { font-size: 25px !important; cursor: pointer; + + fa-icon:hover { + background: rgb(224, 224, 224); + } } } } diff --git a/src/app/website/components/sidebar/sidebar.component.ts b/src/app/website/components/sidebar/sidebar.component.ts index d30d867..4e12523 100644 --- a/src/app/website/components/sidebar/sidebar.component.ts +++ b/src/app/website/components/sidebar/sidebar.component.ts @@ -1,4 +1,5 @@ import { ChangeDetectionStrategy, Component, OnInit, inject } from '@angular/core'; +import { faBars } from '@fortawesome/free-solid-svg-icons'; import { Store } from '@ngrx/store'; import { TranslateService } from '@ngx-translate/core'; import { publicLanguageReducer } from 'src/app/shared/state/languages/public-language.reducer'; @@ -12,6 +13,7 @@ import { publicLanguageReducer } from 'src/app/shared/state/languages/public-lan export class SidebarComponent implements OnInit { private store = inject(Store); private translateSrv = inject(TranslateService); + pages: any[] = []; ngOnInit(): void { @@ -50,4 +52,8 @@ export class SidebarComponent implements OnInit { nav.style.width = '0%'; } } + + get faBars() { + return faBars + } } diff --git a/src/app/website/pages/certificates/certificates.component.ts b/src/app/website/pages/certificates/certificates.component.ts index 1c4c08d..2283de8 100644 --- a/src/app/website/pages/certificates/certificates.component.ts +++ b/src/app/website/pages/certificates/certificates.component.ts @@ -1,6 +1,6 @@ import { ChangeDetectionStrategy, Component, OnInit, inject } from '@angular/core'; import { Store } from '@ngrx/store'; -import { Observable } from 'rxjs'; +import { Observable, combineLatest, scan } from 'rxjs'; import { CertificateGroup } from 'src/app/backoffice/tables/certificate-group/models/certificate-group.model'; import { certificateGroupActions } from 'src/app/backoffice/tables/certificate-group/state/certificate-group.actions'; import { certificateGroupReducer } from 'src/app/backoffice/tables/certificate-group/state/certificate-group.reducer'; @@ -62,21 +62,30 @@ export class CertificatesComponent implements OnInit { }; ngOnInit(): void { - this.certificateGroups$.subscribe((certificateGroups) => { - if (!certificateGroups.length) { - this.store.dispatch(certificateGroupActions.loadAll({ payload: null })); - } - certificateGroups.forEach((certificateGroup) => { - this.tabIndexes.push({ - groupId: certificateGroup.id, - value: 0, + combineLatest([this.certificateGroups$, this.certificateGroups$.pipe(scan((count) => count + 1, 0))]).subscribe( + ([certificateGroups, count]) => { + if (certificateGroups.length === 0 || count < 10) { + this.store.dispatch( + certificateGroupActions.loadAll({ + payload: { + first: count - 1, + rows: 1, + }, + }), + ); + } + + certificateGroups.forEach((certificateGroup) => { + this.tabIndexes.push({ + groupId: certificateGroup.id, + value: 0, + }); }); - }); - }); + }, + ); } orderByDate(certificates: Certificate[]): Certificate[] { - console.log(certificates); if (certificates) { return [...certificates].sort((a, b) => { return new Date(b.date).getTime() - new Date(a.date).getTime(); diff --git a/src/app/website/website.module.ts b/src/app/website/website.module.ts index 0693e37..fa111b8 100644 --- a/src/app/website/website.module.ts +++ b/src/app/website/website.module.ts @@ -1,5 +1,6 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; +import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { LanguagesModule } from 'src/app/shared/modules/languages.module'; import { CertificateGroupStateModule } from '../backoffice/tables/certificate-group/state/certificate-group-state.module'; import { LanguageSelectModule } from '../shared/components/language-select/language-select.module'; @@ -19,6 +20,7 @@ import { WebsiteRoutingModule } from './website-routing.module'; LanguagesModule, PipesModule, DirectivesModule, + FontAwesomeModule, ], }) export class WebsiteModule {} diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index 7ae80bd..a0df904 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -10,7 +10,17 @@ }, "pages": { "home": "Resumen", - "certificates": "Certificados" + "certificates": "Certificados", + "login": { + "title": "Inicio de sesión", + "resetPassword": "¿Has olvidado tu contraseña?" + }, + "reset-password": { + "title": "Enviar email para restablecer contraseña" + }, + "form-reset-password": { + "title": "Restablecer contraseña" + } }, "home": { "cv": "Currículum", @@ -64,7 +74,10 @@ "reject": "No", "accept": "Si", "deleteFilters": "Borrar Filtros", - "filter": "Filtrar" + "filter": "Filtrar", + "logIn": "Iniciar Sesión", + "resetPassword": "Restablecer Contraseña", + "sendEmail": "Enviar Email" }, "form": { "errors": { @@ -152,7 +165,10 @@ "filterType": "Tipo de Filtro", "value": "Valor", "createdAt": "Creado en", - "updatedAt": "Actualizado en" + "updatedAt": "Actualizado en", + "password": "Contraseña", + "newPassword": "Nueva Contraseña", + "repeatNewPassword": "Repetir Nueva Contraseña" }, "genericTable": { "currentPageReport": "Mostrando {first} hasta {last} de {totalRecords} entradas", diff --git a/src/assets/sass/responsive_overrides.scss b/src/assets/sass/_responsive_overrides.scss similarity index 100% rename from src/assets/sass/responsive_overrides.scss rename to src/assets/sass/_responsive_overrides.scss diff --git a/src/assets/sass/layout-cav.scss b/src/assets/sass/layout.scss similarity index 100% rename from src/assets/sass/layout-cav.scss rename to src/assets/sass/layout.scss diff --git a/src/assets/sass/theme-cav.scss b/src/assets/sass/theme.scss similarity index 99% rename from src/assets/sass/theme-cav.scss rename to src/assets/sass/theme.scss index 4cb1a8d..295d84b 100644 --- a/src/assets/sass/theme-cav.scss +++ b/src/assets/sass/theme.scss @@ -1,4 +1,5 @@ $primaryColor: #4a9e98; + $primaryTextColor: #e6e8e6; $accentColor: #091540; $accentTextColor: #ffffff; diff --git a/src/styles.scss b/src/styles.scss index 37588d3..824bb94 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -1,23 +1,20 @@ @import './reset.scss'; @import './assets/images/flags/flags.scss'; - -@import './assets/sass/layout-cav.scss'; -@import 'primeng/resources/themes/lara-light-blue/theme.css'; @import 'primeng/resources/primeng.css'; - -@import './assets/sass/responsive_overrides.scss'; - +@import './assets/sass/_responsive_overrides.scss'; +@import './assets/sass/layout.scss'; +@import './assets/sass/theme.scss'; @import 'swiper/scss'; @import 'swiper/scss/navigation'; @import 'swiper/scss/pagination'; -@font-face { - font-family: 'Fixture'; - src: local('Fixture'), url(./assets/fonts/Fixture-Regular.otf) format('truetype'); -} -body { - font-family: var(--font-family); -} +// @font-face { +// font-family: 'Fixture'; +// src: local('Fixture'), url(./assets/fonts/Fixture-Regular.otf) format('truetype'); +// } +// body { +// font-family: var(--font-family); +// } .hide-tabs-headers .p-tabview-nav { display: none; @@ -254,7 +251,7 @@ body { label { display: flex; justify-content: space-between; - width: 100%; + // width: 100%; padding-right: 2em; } }