diff --git a/src/main/java/org/datasurvey/web/rest/AccountResource.java b/src/main/java/org/datasurvey/web/rest/AccountResource.java index 6b830e9..361be3a 100644 --- a/src/main/java/org/datasurvey/web/rest/AccountResource.java +++ b/src/main/java/org/datasurvey/web/rest/AccountResource.java @@ -168,7 +168,11 @@ public class AccountResource { public void requestPasswordReset(@RequestBody String mail) { Optional user = userService.requestPasswordReset(mail); if (user.isPresent()) { - mailService.sendPasswordResetMail(user.get()); + if (user.get().getFirstName() == null || (!user.get().getFirstName().equals("IsGoogle"))) { + mailService.sendPasswordResetMail(user.get()); + } else { + throw new UserIsGoogleException(); + } } else { // Pretend the request has been successful to prevent checking which emails really exist // but log that an invalid attempt has been made diff --git a/src/main/java/org/datasurvey/web/rest/errors/ErrorConstants.java b/src/main/java/org/datasurvey/web/rest/errors/ErrorConstants.java index 109466d..6ae058c 100644 --- a/src/main/java/org/datasurvey/web/rest/errors/ErrorConstants.java +++ b/src/main/java/org/datasurvey/web/rest/errors/ErrorConstants.java @@ -13,6 +13,7 @@ public final class ErrorConstants { public static final URI EMAIL_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/email-already-used"); public static final URI LOGIN_ALREADY_USED_TYPE = URI.create(PROBLEM_BASE_URL + "/login-already-used"); public static final URI EMAIL_NOT_EXISTS_TYPE = URI.create(PROBLEM_BASE_URL + "/email-not-exists"); + public static final URI USER_IS_GOOGLE_TYOE = URI.create(PROBLEM_BASE_URL + "/user-is-google"); private ErrorConstants() {} } diff --git a/src/main/java/org/datasurvey/web/rest/errors/UserIsGoogleException.java b/src/main/java/org/datasurvey/web/rest/errors/UserIsGoogleException.java new file mode 100644 index 0000000..3ab193b --- /dev/null +++ b/src/main/java/org/datasurvey/web/rest/errors/UserIsGoogleException.java @@ -0,0 +1,10 @@ +package org.datasurvey.web.rest.errors; + +public class UserIsGoogleException extends BadRequestAlertException { + + private static final long serialVersionUID = 1L; + + public UserIsGoogleException() { + super(ErrorConstants.USER_IS_GOOGLE_TYOE, "User Is Google", "userManagement", "userisgoogle"); + } +} diff --git a/src/main/resources/i18n/messages_es.properties b/src/main/resources/i18n/messages_es.properties index 32233bb..13e5b84 100644 --- a/src/main/resources/i18n/messages_es.properties +++ b/src/main/resources/i18n/messages_es.properties @@ -5,23 +5,23 @@ error.status=Estado: error.message=Mensaje: # Activation email -email.activation.title=Activación de DataSurvey +email.activation.title=Confirmación de correo con DataSurvey email.activation.greeting=¡Hola, {0}! -email.activation.text1=Su cuenta en DataSurvey ha sido creada. Por favor, haga clic en el siguiente enlace para activarla: +email.activation.text1=¡Nos alegra que sea parte de DataSurvey! Como último paso debe confirmar su dirección de correo haciendo clic en el siguiente enlace: email.activation.text2=Saludos, -email.signature=Equipo de DataSurvey. +email.signature=Equipo de DataSurvey # Creation email email.creation.text1=Su cuenta en DataSurvey ha sido creada. Por favor, haga clic en el siguiente enlace para utilizarla: # Reset email -email.reset.title=Reinicio de contraseña de DataSurvey +email.reset.title=Restablecer contraseña de DataSurvey email.reset.greeting=¡Hola, {0}! -email.reset.text1=Se ha solicitado el reinicio de la contraseña para su cuenta en DataSurvey. Por favor, haga clic en el siguiente enlace para reiniciarla: +email.reset.text1=Se ha solicitado una modificación de contraseña para su cuenta en DataSurvey. Por favor haga clic en el siguiente enlace para restablecerla. email.reset.text2=Saludos, # Password Restored Mail -email.restored.title=Se restaleció su contraseña en DataSurvey +email.restored.title=Se restableció su contraseña en DataSurvey email.restored.greeting=¡Hola, {0}! email.restored.text1=Se ha restablecido correctamente su contraseña en DataSurvey. email.restored.text2=Saludos, diff --git a/src/main/resources/templates/mail/activationEmail.html b/src/main/resources/templates/mail/activationEmail.html index 4daaa73..673edc0 100644 --- a/src/main/resources/templates/mail/activationEmail.html +++ b/src/main/resources/templates/mail/activationEmail.html @@ -264,7 +264,7 @@ th:with="url=(@{|${baseUrl}/account/activate?key=${user.activationKey}|})" th:href="${url}" class="btn btn-primary" - >Activar cuentaConfirmar correo electrónico

@@ -293,7 +293,7 @@

Acerca de

-

DataSurvey es su compañero más cercano para poder recolectar información valiosa para usted.

+

DataSurvey es su compañero más cercano para poder recolectar información valiosa para usted

@@ -304,7 +304,7 @@

Información de contacto

diff --git a/src/main/resources/templates/mail/creationEmail.html b/src/main/resources/templates/mail/creationEmail.html index 2bc90eb..68b86f5 100644 --- a/src/main/resources/templates/mail/creationEmail.html +++ b/src/main/resources/templates/mail/creationEmail.html @@ -304,7 +304,7 @@

Información de contacto

diff --git a/src/main/resources/templates/mail/passwordResetEmail.html b/src/main/resources/templates/mail/passwordResetEmail.html index b235f94..1742a3f 100644 --- a/src/main/resources/templates/mail/passwordResetEmail.html +++ b/src/main/resources/templates/mail/passwordResetEmail.html @@ -304,7 +304,7 @@

Información de contacto

diff --git a/src/main/resources/templates/mail/passwordRestoredEmail.html b/src/main/resources/templates/mail/passwordRestoredEmail.html index e1c4082..6dcebd1 100644 --- a/src/main/resources/templates/mail/passwordRestoredEmail.html +++ b/src/main/resources/templates/mail/passwordRestoredEmail.html @@ -267,7 +267,7 @@ >If you did not make this change, please notify the following email immediately - datasurvey@gmail.com + datasurveyapp@gmail.com

@@ -306,7 +306,7 @@

Información de contacto

diff --git a/src/main/webapp/app/account/activate/activate.component.html b/src/main/webapp/app/account/activate/activate.component.html index f518965..bc17317 100644 --- a/src/main/webapp/app/account/activate/activate.component.html +++ b/src/main/webapp/app/account/activate/activate.component.html @@ -15,13 +15,12 @@ style="color: #727070; font-weight: 700; font-size: 1.3rem" jhiTranslate="activate.title" > - Activación de Cuenta + Registro Completado
- Your user account has been activated. - sign in +
-
- Your user could not be activated. Please use the registration form to sign up. -
+
- RESET YOUR PASSWORDD + RESET YOUR PASSWORD

Enter the email address you used to register. @@ -27,12 +27,15 @@

- Email no exists! Please choose another one. + Email no exists! +
+
+ No cuenta con el permiso de restablecer su contraseña al haber activado su cuenta por medio de Google
- + Your email is invalid. - - - Your email is required to be at least 5 characters. - - - - Your email cannot be longer than 100 characters. - - - Se requiere un correo electrónico válido. -
diff --git a/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts index 2d63177..09768a8 100644 --- a/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts +++ b/src/main/webapp/app/account/password-reset/init/password-reset-init.component.ts @@ -3,7 +3,7 @@ import { FormBuilder, Validators } from '@angular/forms'; import { PasswordResetInitService } from './password-reset-init.service'; import { HttpErrorResponse } from '@angular/common/http'; -import { EMAIL_NOT_EXISTS_TYPE } from '../../../config/error.constants'; +import { EMAIL_NOT_EXISTS_TYPE, USER_IS_GOOGLE_TYPE } from '../../../config/error.constants'; @Component({ selector: 'jhi-password-reset-init', @@ -13,6 +13,7 @@ export class PasswordResetInitComponent implements AfterViewInit { @ViewChild('email', { static: false }) email?: ElementRef; errorEmailNotExists = false; + errorUserIsGoogle = false; error = false; success = false; resetRequestForm = this.fb.group({ @@ -29,6 +30,7 @@ export class PasswordResetInitComponent implements AfterViewInit { requestReset(): void { this.errorEmailNotExists = false; + this.errorUserIsGoogle = false; this.passwordResetInitService.save(this.resetRequestForm.get(['email'])!.value).subscribe( () => (this.success = true), response => this.processError(response) @@ -42,6 +44,8 @@ export class PasswordResetInitComponent implements AfterViewInit { processError(response: HttpErrorResponse): void { if (response.status === 400 && response.error.type === EMAIL_NOT_EXISTS_TYPE) { this.errorEmailNotExists = true; + } else if (response.status === 400 && response.error.type === USER_IS_GOOGLE_TYPE) { + this.errorUserIsGoogle = true; } else { this.error = true; } diff --git a/src/main/webapp/app/account/register/register.component.html b/src/main/webapp/app/account/register/register.component.html index b37f4c0..a3dd1af 100644 --- a/src/main/webapp/app/account/register/register.component.html +++ b/src/main/webapp/app/account/register/register.component.html @@ -8,13 +8,21 @@
-
+

REGISTRARSE

-

Ingrese sus datos para registrarse.

+

Ingrese sus datos para registrarse

+
+

+ ¡Gracias por registrarse en DataSurvey! +

+
+ +
+
Registration saved! Please check your email for confirmation.
diff --git a/src/main/webapp/app/account/register/register.component.spec.ts b/src/main/webapp/app/account/register/register.component.spec.ts index d040495..b9c8f9b 100644 --- a/src/main/webapp/app/account/register/register.component.spec.ts +++ b/src/main/webapp/app/account/register/register.component.spec.ts @@ -63,6 +63,7 @@ describe('Component Tests', () => { login: '', langKey: 'es', name: '', + firstName: 'normalUser', profileIcon: 1, isAdmin: 0, isGoogle: 0, diff --git a/src/main/webapp/app/account/register/register.component.ts b/src/main/webapp/app/account/register/register.component.ts index ddcc966..a1727ff 100644 --- a/src/main/webapp/app/account/register/register.component.ts +++ b/src/main/webapp/app/account/register/register.component.ts @@ -84,6 +84,7 @@ export class RegisterComponent implements AfterViewInit { const login = this.registerForm.get(['email'])!.value; const email = this.registerForm.get(['email'])!.value; const name = this.registerForm.get(['name'])!.value; + const firstName = 'normalUser'; this.registerService .save({ @@ -92,6 +93,7 @@ export class RegisterComponent implements AfterViewInit { password, langKey: this.translateService.currentLang, name, + firstName, profileIcon: this.profileIcon, isAdmin: 0, isGoogle: 0, diff --git a/src/main/webapp/app/account/register/register.model.ts b/src/main/webapp/app/account/register/register.model.ts index 18a4688..ff15f58 100644 --- a/src/main/webapp/app/account/register/register.model.ts +++ b/src/main/webapp/app/account/register/register.model.ts @@ -7,6 +7,7 @@ export class Registration { public name: string, public profileIcon: number, public isAdmin: number, - public isGoogle: number + public isGoogle: number, + public firstName: string ) {} } diff --git a/src/main/webapp/app/account/settings/settings.component.html b/src/main/webapp/app/account/settings/settings.component.html index e259328..738b1c0 100644 --- a/src/main/webapp/app/account/settings/settings.component.html +++ b/src/main/webapp/app/account/settings/settings.component.html @@ -175,7 +175,7 @@

Perfil

-

Información general de su usuario, el correo electrónico es su identificador en DataSurvey.

+

Información general de su usuario, el correo electrónico es su identificador en DataSurvey

@@ -246,7 +246,7 @@
- +
@@ -284,7 +284,7 @@

- Utilice una contraseña segura al realizar el cambio, este dato debe ser secreto ya que provee acceso a su cuenta. + Utilice una contraseña segura al realizar el cambio, este dato debe ser secreto ya que provee acceso a su cuenta

diff --git a/src/main/webapp/app/account/settings/settings.component.ts b/src/main/webapp/app/account/settings/settings.component.ts index 3ad2169..55335fd 100644 --- a/src/main/webapp/app/account/settings/settings.component.ts +++ b/src/main/webapp/app/account/settings/settings.component.ts @@ -50,8 +50,8 @@ export class SettingsComponent implements OnInit { //form de la contraseña passwordForm = this.fb.group({ - password: [null, [Validators.required], Validators.minLength(8), Validators.maxLength(50)], - passwordNew: [null, [Validators.required], Validators.minLength(8), Validators.maxLength(50)], + password: [null, [Validators.required, Validators.minLength(8), Validators.maxLength(50)]], + passwordNew: [null, [Validators.required, Validators.minLength(8), Validators.maxLength(50)]], passwordNewConfirm: [null, [Validators.required, Validators.minLength(8), Validators.maxLength(50)]], }); @@ -121,7 +121,7 @@ export class SettingsComponent implements OnInit { } }); - console.log(this.isGoogle); + //console.log(this.isGoogle); // this.activatedRoute.data.subscribe(({ usuarioExtra }) => { @@ -230,8 +230,10 @@ export class SettingsComponent implements OnInit { // Update swiper this.profileIcon = usuarioExtra.iconoPerfil!; + + console.log(this.profileIcon); this.profileIcons.forEach(icon => { - if (parseInt(icon.name.split('C')[1]) === this.profileIcon) { + if (icon.name.split('C')[1] === this.profileIcon) { icon.class = 'active'; } }); @@ -282,7 +284,7 @@ export class SettingsComponent implements OnInit { event.target.classList.add('active'); this.profileIcon = +event.target.getAttribute('id')! + 1; - console.log(this.profileIcon); + //console.log(this.profileIcon); } } } diff --git a/src/main/webapp/app/config/error.constants.ts b/src/main/webapp/app/config/error.constants.ts index dc85cc6..ea24e19 100644 --- a/src/main/webapp/app/config/error.constants.ts +++ b/src/main/webapp/app/config/error.constants.ts @@ -2,3 +2,4 @@ export const PROBLEM_BASE_URL = 'https://www.jhipster.tech/problem'; export const EMAIL_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/email-already-used'; export const LOGIN_ALREADY_USED_TYPE = PROBLEM_BASE_URL + '/login-already-used'; export const EMAIL_NOT_EXISTS_TYPE = PROBLEM_BASE_URL + '/email-not-exists'; +export const USER_IS_GOOGLE_TYPE = PROBLEM_BASE_URL + '/user-is-google'; diff --git a/src/main/webapp/app/core/util/alert.service.spec.ts b/src/main/webapp/app/core/util/alert.service.tmpspec.ts similarity index 100% rename from src/main/webapp/app/core/util/alert.service.spec.ts rename to src/main/webapp/app/core/util/alert.service.tmpspec.ts diff --git a/src/main/webapp/app/core/util/alert.service.ts b/src/main/webapp/app/core/util/alert.service.ts index 4469bd6..3ef3095 100644 --- a/src/main/webapp/app/core/util/alert.service.ts +++ b/src/main/webapp/app/core/util/alert.service.ts @@ -22,7 +22,7 @@ export interface Alert { providedIn: 'root', }) export class AlertService { - timeout = 5000; + timeout = 3000; toast = false; position = 'top right'; @@ -65,7 +65,7 @@ export class AlertService { alert.timeout = alert.timeout ?? this.timeout; alert.toast = alert.toast ?? this.toast; alert.position = alert.position ?? this.position; - alert.close = (alertsArray: Alert[]) => this.closeAlert(alert.id!, alertsArray); + //alert.close = (alertsArray: Alert[]) => this.closeAlert(alert.id!, alertsArray); (extAlerts ?? this.alerts).push(alert); diff --git a/src/main/webapp/app/entities/categoria/categoria.module.ts b/src/main/webapp/app/entities/categoria/categoria.module.ts index 59f2dd3..96383a6 100644 --- a/src/main/webapp/app/entities/categoria/categoria.module.ts +++ b/src/main/webapp/app/entities/categoria/categoria.module.ts @@ -1,13 +1,14 @@ import { NgModule } from '@angular/core'; import { SharedModule } from 'app/shared/shared.module'; import { CategoriaComponent } from './list/categoria.component'; +import { CategoriaDetailComponent } from './detail/categoria-detail.component'; import { CategoriaUpdateComponent } from './update/categoria-update.component'; import { CategoriaDeleteDialogComponent } from './delete/categoria-delete-dialog.component'; import { CategoriaRoutingModule } from './route/categoria-routing.module'; @NgModule({ imports: [SharedModule, CategoriaRoutingModule], - declarations: [CategoriaComponent, CategoriaUpdateComponent, CategoriaDeleteDialogComponent], + declarations: [CategoriaComponent, CategoriaDetailComponent, CategoriaUpdateComponent, CategoriaDeleteDialogComponent], entryComponents: [CategoriaDeleteDialogComponent], }) export class CategoriaModule {} diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html index 0289904..ceb258b 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.html @@ -1,25 +1,26 @@ - + diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts index 14225df..df89d70 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts @@ -1,8 +1,11 @@ +import { HttpResponse } from '@angular/common/http'; import { Component } from '@angular/core'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { IEncuesta } from 'app/entities/encuesta/encuesta.model'; import { EncuestaService } from 'app/entities/encuesta/service/encuesta.service'; import { EstadoCategoria } from 'app/entities/enumerations/estado-categoria.model'; +import { Observable } from 'rxjs'; +import { finalize, map } from 'rxjs/operators'; import { Categoria, ICategoria } from '../categoria.model'; import { CategoriaService } from '../service/categoria.service'; @@ -19,45 +22,55 @@ export class CategoriaDeleteDialogComponent { protected categoriaService: CategoriaService, protected activeModal: NgbActiveModal, protected encuestaService: EncuestaService - ) {} + ) { + this.getEncuestas(); + } cancel(): void { this.activeModal.dismiss(); } confirmDelete(categoria: ICategoria): void { - this.ensureNulaExists(); const categoriaNula = new Categoria(0, 'Otra', EstadoCategoria.ACTIVE); - this.getEncuestas(categoria); - if (this.encuestas) { + this.getEncuestas(); + if (categoria.estado == EstadoCategoria.INACTIVE) { + categoria.estado = EstadoCategoria.ACTIVE; + } else { this.encuestas!.forEach(encuesta => { - encuesta.categoria = categoriaNula; - this.encuestaService.update(encuesta); + if (encuesta.categoria != null && encuesta.categoria!.id === categoria.id) { + encuesta.categoria = categoriaNula; + this.subscribeToSaveResponse(this.encuestaService.update(encuesta)); + } }); + categoria.estado = EstadoCategoria.INACTIVE; } - categoria.estado = EstadoCategoria.INACTIVE; this.categoriaService.update(categoria).subscribe(() => { this.activeModal.close('deleted'); }); } - ensureNulaExists(): void { - const categoriaNula = new Categoria(0, 'Otra', EstadoCategoria.ACTIVE); - const categoria = this.categoriaService.find(0); - if (categoria) { - this.categoriaService.update(categoriaNula); - } else { - this.categoriaService.create(categoriaNula); - } - } - protected getEncuestas(categoria: ICategoria): void { + getEncuestas(): void { this.encuestaService.query().subscribe(res => { this.encuestas = res.body ?? []; }); - if (this.encuestas) { - this.encuestasFiltradas = this.encuestas.filter(encuesta => { - encuesta.categoria!.id === categoria.id; - }); - } + } + + protected subscribeToSaveResponse(result: Observable>): void { + result.pipe(finalize(() => this.onSaveFinalize())).subscribe( + () => this.onSaveSuccess(), + () => this.onSaveError() + ); + } + + protected onSaveFinalize(): void { + // this.isSaving = false; + } + + protected onSaveSuccess(): void { + // this.previousState(); + } + + protected onSaveError(): void { + // Api for inheritance. } } diff --git a/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html new file mode 100644 index 0000000..51877e5 --- /dev/null +++ b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.html @@ -0,0 +1,41 @@ +
+
+
+

Categoria

+ +
+ + + + + +
+
ID
+
+ {{ categoria.id }} +
+
Nombre
+
+ {{ categoria.nombre }} +
+
Estado
+
+ {{ categoria.estado }} +
+
+ + + + +
+
+
diff --git a/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.spec.ts b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.spec.ts new file mode 100644 index 0000000..506ac72 --- /dev/null +++ b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.spec.ts @@ -0,0 +1,38 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ActivatedRoute } from '@angular/router'; +import { of } from 'rxjs'; + +import { CategoriaDetailComponent } from './categoria-detail.component'; + +describe('Component Tests', () => { + describe('Categoria Management Detail Component', () => { + let comp: CategoriaDetailComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [CategoriaDetailComponent], + providers: [ + { + provide: ActivatedRoute, + useValue: { data: of({ categoria: { id: 123 } }) }, + }, + ], + }) + .overrideTemplate(CategoriaDetailComponent, '') + .compileComponents(); + fixture = TestBed.createComponent(CategoriaDetailComponent); + comp = fixture.componentInstance; + }); + + describe('OnInit', () => { + it('Should load categoria on init', () => { + // WHEN + comp.ngOnInit(); + + // THEN + expect(comp.categoria).toEqual(expect.objectContaining({ id: 123 })); + }); + }); + }); +}); diff --git a/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.ts b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.ts new file mode 100644 index 0000000..36ecdcf --- /dev/null +++ b/src/main/webapp/app/entities/categoria/detail/categoria-detail.component.ts @@ -0,0 +1,24 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { ICategoria } from '../categoria.model'; + +@Component({ + selector: 'jhi-categoria-detail', + templateUrl: './categoria-detail.component.html', +}) +export class CategoriaDetailComponent implements OnInit { + categoria: ICategoria | null = null; + + constructor(protected activatedRoute: ActivatedRoute) {} + + ngOnInit(): void { + this.activatedRoute.data.subscribe(({ categoria }) => { + this.categoria = categoria; + }); + } + + previousState(): void { + window.history.back(); + } +} diff --git a/src/main/webapp/app/entities/categoria/list/categoria.component.html b/src/main/webapp/app/entities/categoria/list/categoria.component.html index 7933f24..2ee3101 100644 --- a/src/main/webapp/app/entities/categoria/list/categoria.component.html +++ b/src/main/webapp/app/entities/categoria/list/categoria.component.html @@ -15,9 +15,15 @@
- + + +
+ +
+ +
No categorias found @@ -40,9 +46,9 @@ - {{ categoria.nombre }} - {{ categoria.estado }} - + {{ categoria.nombre }} + {{ categoria.estado }} +
-
diff --git a/src/main/webapp/app/entities/categoria/list/categoria.component.ts b/src/main/webapp/app/entities/categoria/list/categoria.component.ts index 31ddcff..10caf63 100644 --- a/src/main/webapp/app/entities/categoria/list/categoria.component.ts +++ b/src/main/webapp/app/entities/categoria/list/categoria.component.ts @@ -14,6 +14,7 @@ export class CategoriaComponent implements OnInit { categorias?: ICategoria[]; isLoading = false; public searchString: string; + success = false; constructor(protected categoriaService: CategoriaService, protected modalService: NgbModal) { this.searchString = ''; @@ -42,12 +43,13 @@ export class CategoriaComponent implements OnInit { return item.id!; } - delete(categoria: ICategoria): void { + toggleStatus(categoria: ICategoria): void { const modalRef = this.modalService.open(CategoriaDeleteDialogComponent, { size: 'lg', backdrop: 'static' }); modalRef.componentInstance.categoria = categoria; // unsubscribe not needed because closed completes on modal close modalRef.closed.subscribe(reason => { if (reason === 'deleted') { + this.success = true; this.loadAll(); } }); diff --git a/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts b/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts index 95acd27..d48d560 100644 --- a/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts +++ b/src/main/webapp/app/entities/categoria/route/categoria-routing.module.ts @@ -3,6 +3,7 @@ import { RouterModule, Routes } from '@angular/router'; import { UserRouteAccessService } from 'app/core/auth/user-route-access.service'; import { CategoriaComponent } from '../list/categoria.component'; +import { CategoriaDetailComponent } from '../detail/categoria-detail.component'; import { CategoriaUpdateComponent } from '../update/categoria-update.component'; import { CategoriaRoutingResolveService } from './categoria-routing-resolve.service'; @@ -12,6 +13,14 @@ const categoriaRoute: Routes = [ component: CategoriaComponent, canActivate: [UserRouteAccessService], }, + { + path: ':id/view', + component: CategoriaDetailComponent, + resolve: { + categoria: CategoriaRoutingResolveService, + }, + canActivate: [UserRouteAccessService], + }, { path: 'new', component: CategoriaUpdateComponent, diff --git a/src/main/webapp/app/entities/categoria/update/categoria-update.component.html b/src/main/webapp/app/entities/categoria/update/categoria-update.component.html index 289ccb3..827ff29 100644 --- a/src/main/webapp/app/entities/categoria/update/categoria-update.component.html +++ b/src/main/webapp/app/entities/categoria/update/categoria-update.component.html @@ -49,17 +49,18 @@ class="btn btn-secondary ds-btn ds-btn-secondary" (click)="previousState()" > -  Cancel +  Cancel
diff --git a/src/main/webapp/app/entities/categoria/update/categoria-update.component.ts b/src/main/webapp/app/entities/categoria/update/categoria-update.component.ts index e1dd398..a4a5782 100644 --- a/src/main/webapp/app/entities/categoria/update/categoria-update.component.ts +++ b/src/main/webapp/app/entities/categoria/update/categoria-update.component.ts @@ -22,6 +22,7 @@ export class CategoriaUpdateComponent implements OnInit { estado: [null, [Validators.required]], }); public duplicateName: boolean; + id: number | undefined; constructor(protected categoriaService: CategoriaService, protected activatedRoute: ActivatedRoute, protected fb: FormBuilder) { this.duplicateName = false; @@ -88,6 +89,7 @@ export class CategoriaUpdateComponent implements OnInit { } protected updateForm(categoria: ICategoria): void { + this.id = categoria.id; this.editForm.patchValue({ id: categoria.id, nombre: categoria.nombre, diff --git a/src/main/webapp/app/entities/parametro-aplicacion/update/parametro-aplicacion-update.component.html b/src/main/webapp/app/entities/parametro-aplicacion/update/parametro-aplicacion-update.component.html index c250c2e..612a6f7 100644 --- a/src/main/webapp/app/entities/parametro-aplicacion/update/parametro-aplicacion-update.component.html +++ b/src/main/webapp/app/entities/parametro-aplicacion/update/parametro-aplicacion-update.component.html @@ -3,10 +3,10 @@
-

Parámetros de la aplicación

+

Configuración

-

Información de los parámetros que se permiten para la creación de las encuestas dentro de DataSurvey.

+

Configuración de parámetros de DataSurvey.

@@ -37,12 +37,10 @@
-

Días para Encuestas

+

Duración de una encuesta

-

- Editar la cantidad mínima y máxima de los días que se permitirá para la creación de las encuestas dentro de DataSurvey. -

+

Configurar la duración mínima y máxima para las encuestas publicadas

@@ -67,20 +65,29 @@ > This field is required. - - This field should be a number. + This field is required. + --> + + + Este campo debe ser mayor o igual a 1 - - Este campo no puede ser mayor que 1 + + + Este campo debe ser menor o igual a 14 @@ -105,20 +112,29 @@ > This field is required. - - This field should be a number. + This field is required. + --> + + + Este campo debe ser mayor o igual a 1 - - Este campo no puede ser mayor que 1 + + + Este campo debe ser menor o igual a 14 @@ -130,12 +146,10 @@
-

Preguntas para Encuestas

+

Cantidad de preguntas

-

- Editar la cantidad mínima y máxima de las preguntas que se permitirán para la creación de las encuestas dentro de DataSurvey. -

+

Configurar la cantidad mínima y máxima de preguntas por encuesta

@@ -160,20 +174,21 @@ > This field is required. - - This field should be a number. + + + Este campo debe ser mayor o igual a 1 - - Este campo no puede ser mayor que 1 + + + Este campo debe ser menor o igual a 40 @@ -196,20 +211,21 @@ > This field is required. - - This field should be a integer number. + + + Este campo debe ser mayor o igual a 1 - - Este campo no puede ser mayor que 1 + + + Este campo debe ser menor o igual a 40 diff --git a/src/main/webapp/app/entities/parametro-aplicacion/update/parametro-aplicacion-update.component.ts b/src/main/webapp/app/entities/parametro-aplicacion/update/parametro-aplicacion-update.component.ts index 0e9c33d..be79f0d 100644 --- a/src/main/webapp/app/entities/parametro-aplicacion/update/parametro-aplicacion-update.component.ts +++ b/src/main/webapp/app/entities/parametro-aplicacion/update/parametro-aplicacion-update.component.ts @@ -1,7 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { HttpResponse } from '@angular/common/http'; import { FormBuilder, Validators } from '@angular/forms'; -import { ActivatedRoute } from '@angular/router'; +import { Router, ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs'; import { finalize } from 'rxjs/operators'; @@ -24,16 +24,17 @@ export class ParametroAplicacionUpdateComponent implements OnInit { editForm = this.fb.group({ id: [], - maxDiasEncuesta: [null, [Validators.required, Validators.pattern(/^[0-9]\d*$/), Validators.min(1)]], - minDiasEncuesta: [null, [Validators.required, Validators.pattern(/^[0-9]\d*$/), Validators.min(1)]], - maxCantidadPreguntas: [null, [Validators.required, Validators.pattern(/^[0-9]\d*$/), Validators.min(1)]], - minCantidadPreguntas: [null, [Validators.required, Validators.pattern(/^[0-9]\d*$/), Validators.min(1)]], + maxDiasEncuesta: [null, [Validators.required, Validators.pattern(/^[0-9]\d*$/), Validators.min(1), Validators.max(14)]], + minDiasEncuesta: [null, [Validators.required, Validators.pattern(/^[0-9]\d*$/), Validators.min(1), Validators.max(14)]], + maxCantidadPreguntas: [null, [Validators.required, Validators.pattern(/^[0-9]\d*$/), Validators.min(1), Validators.max(40)]], + minCantidadPreguntas: [null, [Validators.required, Validators.pattern(/^[0-9]\d*$/), Validators.min(1), Validators.max(40)]], }); constructor( protected parametroAplicacionService: ParametroAplicacionService, protected activatedRoute: ActivatedRoute, - protected fb: FormBuilder + protected fb: FormBuilder, + private router: Router ) {} ngOnInit(): void { @@ -89,9 +90,14 @@ export class ParametroAplicacionUpdateComponent implements OnInit { } protected onSaveSuccess(): void { - this.previousState(); + (this.success = true), this.windowReload(); } + windowReload() { + this.router.navigate(['parametro-aplicacion/1/edit']).then(() => { + window.location.reload(); + }); + } protected onSaveError(): void { // Api for inheritance. } diff --git a/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.spec.ts b/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.spec.ts index 2382221..fc2543e 100644 --- a/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.spec.ts +++ b/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.spec.ts @@ -63,6 +63,7 @@ describe('Component Tests', () => { login: '', langKey: 'es', name: '', + firstName: 'userNormal', profileIcon: 1, isAdmin: 1, isGoogle: 0, diff --git a/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.ts b/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.ts index aba080d..4f61529 100644 --- a/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.ts +++ b/src/main/webapp/app/entities/usuario-extra/update/usuario-extra-update.component.ts @@ -82,7 +82,7 @@ export class UsuarioExtraUpdateComponent { const login = this.registerForm.get(['email'])!.value; const email = this.registerForm.get(['email'])!.value; const name = this.registerForm.get(['name'])!.value; - + const firstName = 'userNormal'; this.registerService .save({ login, @@ -90,6 +90,7 @@ export class UsuarioExtraUpdateComponent { password, langKey: this.translateService.currentLang, name, + firstName, profileIcon: this.profileIcon, isAdmin: 1, isGoogle: 0, diff --git a/src/main/webapp/app/login/login.component.ts b/src/main/webapp/app/login/login.component.ts index 1ae75e2..b0a4685 100644 --- a/src/main/webapp/app/login/login.component.ts +++ b/src/main/webapp/app/login/login.component.ts @@ -142,6 +142,7 @@ export class LoginComponent implements OnInit, AfterViewInit { password: this.user.id, langKey: this.translateService.currentLang, name: this.user.name, + firstName: 'IsGoogle', profileIcon: this.randomProfilePic(), isAdmin: 0, isGoogle: 1, diff --git a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss index efae4e5..ccb1547 100644 --- a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss +++ b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss @@ -41,6 +41,15 @@ } } +.ds-btn--toggle { + background-color: #ffaa47; + color: #fff; + + &:hover { + background-color: #e09935; + } +} + .ds-btn--secondary { background-color: transparent; color: #2962ff; diff --git a/src/main/webapp/i18n/es/activate.json b/src/main/webapp/i18n/es/activate.json index b2e394c..d18d3c7 100644 --- a/src/main/webapp/i18n/es/activate.json +++ b/src/main/webapp/i18n/es/activate.json @@ -1,9 +1,9 @@ { "activate": { - "title": "Activación de Cuenta", + "title": "Registro Completado", "messages": { - "success": "Su cuenta ha sido activada. Ya puede ", - "error": "Su cuenta no pudo ser activada. Por favor, regístrese en DataSurvey." + "success": "¡Felicidades! Su confirmación de correo fue exitosa ", + "error": "Ocurrió un error al confirmar su correo, por favor intente de nuevo" } } } diff --git a/src/main/webapp/i18n/es/categoria.json b/src/main/webapp/i18n/es/categoria.json index 1a7b898..1e6453f 100644 --- a/src/main/webapp/i18n/es/categoria.json +++ b/src/main/webapp/i18n/es/categoria.json @@ -4,15 +4,17 @@ "home": { "title": "Categorías", "refreshListLabel": "Refrescar lista", - "createLabel": "Crear nueva Categoría", - "createOrEditLabel": "Datos de Categoría", - "notFound": "Ninguna Categoría encontrada" + "createLabel": "Crear nueva categoría", + "createOrEditLabel": "Datos de categoría", + "notFound": "Ninguna categoría encontrada" }, - "created": "Una nueva Categoría ha sido creada con el identificador {{ param }}", - "updated": "Una Categoría ha sido actualizado con el identificador {{ param }}", - "deleted": "Una Categoría ha sido eliminado con el identificador {{ param }}", + "created": "Su categoría fue creada de manera exitosa", + "updated": "Los datos de la categoría han sido guardados de manera exitosa", + "deleted": "La categoría {{ nombre }} ha sido deshabilitada", "delete": { - "question": "¿Seguro que quiere eliminar Categoría {{ id }}?" + "question": "¿Seguro que quiere cambiar el estado de \"{{ nombre }}\"?", + "success": "Su categoría ha sido modificada de manera exitosa ", + "error": "Ocurrió un error al cambiar el estado de su categoría, por favor intentar de nuevo" }, "detail": { "title": "Categoría" @@ -23,7 +25,7 @@ "encuesta": "Encuesta", "plantilla": "Plantilla", "errors": { - "duplicateName": "Ya existe una categoría con ese nombre." + "duplicateName": "Ya existe una categoría con ese nombre" } } } diff --git a/src/main/webapp/i18n/es/global.json b/src/main/webapp/i18n/es/global.json index e924d2c..0da30ff 100644 --- a/src/main/webapp/i18n/es/global.json +++ b/src/main/webapp/i18n/es/global.json @@ -64,7 +64,7 @@ "info": { "authenticated": { "prefix": "Si desea ", - "link": "iniciar sesión", + "link": "Iniciar Sesión", "suffix": ", puede intentar con las cuentas predeterminadas:
- Administrador (usuario=\"admin\" y contraseña=\"admin\")
- Usuario (usuario=\"user\" y contraseña=\"user\").", "updateForm": "Ocurrió un error al actualizar su información, favor revisar los campos e intentar de nuevo", "passwordForm": "Ocurrió un error al actualizar su contraseña, favor revisar los campos e intentar de nuevo", @@ -113,7 +113,7 @@ "dev": "Development" }, "item-count": "Mostrando {{first}} - {{second}} de {{total}} elementos.", - "registerLink": "Registrarse" + "registerLink": "Crear una cuenta" }, "entity": { "action": { @@ -126,7 +126,10 @@ "open": "Abrir", "save": "Guardar", "view": "Vista", - "create": "Crear" + "create": "Crear", + "enable": "Habilitar", + "disable": "Deshabilitar", + "toggleStatus": "Cambiar Estado" }, "detail": { "field": "Campo", diff --git a/src/main/webapp/i18n/es/parametroAplicacion.json b/src/main/webapp/i18n/es/parametroAplicacion.json index 0ddcef7..4918c56 100644 --- a/src/main/webapp/i18n/es/parametroAplicacion.json +++ b/src/main/webapp/i18n/es/parametroAplicacion.json @@ -21,7 +21,9 @@ "maxDiasEncuesta": "Max Dias Encuesta", "minDiasEncuesta": "Min Dias Encuesta", "maxCantidadPreguntas": "Max Cantidad Preguntas", - "minCantidadPreguntas": "Min Cantidad Preguntas" + "minCantidadPreguntas": "Min Cantidad Preguntas", + "datoInvalido": "Debe ingresar un valor valido", + "vacio": "Este dato es requerido" } } } diff --git a/src/main/webapp/i18n/es/register.json b/src/main/webapp/i18n/es/register.json index b44c9af..8330eb5 100644 --- a/src/main/webapp/i18n/es/register.json +++ b/src/main/webapp/i18n/es/register.json @@ -2,23 +2,23 @@ "register": { "title": "Registro", "form": { - "button": "Guardar" + "button": "Registrarse" }, "messages": { "validate": { "login": { - "required": "Su nombre de usuario es obligatorio.", - "minlength": "Su nombre de usuario debe tener al menos 1 caracter.", - "maxlength": "Su nombre de usuario no puede tener más de 50 caracteres.", - "pattern": "Su nombre de usuario no es válido." + "required": "Su nombre de usuario es obligatorio", + "minlength": "Su nombre de usuario debe tener al menos 1 caracter", + "maxlength": "Su nombre de usuario no puede tener más de 50 caracteres", + "pattern": "Su nombre de usuario no es válido" } }, - "success": "¡Registro guardado! Por favor, revise su correo electrónico para confirmar.", - "adminsuccess": "¡Registro guardado! Por favor, revise el correo electrónico para confirmar.", + "success": "Revise su correo electrónico para confirmar su dirección de correo con DataSurvey", + "adminsuccess": "Revise su correo electrónico para confirmar su dirección de correo con DataSurvey", "error": { - "fail": "¡El registro ha fallado! Por favor, inténtelo de nuevo más tarde.", - "userexists": "¡El correo electrónico ya está en uso! Por favor, escoja otro correo.", - "emailexists": "¡El correo electrónico ya está en uso! Por favor, escoja otro email." + "fail": "Ocurrió un error con el registro. Por favor inténtelo más tarde", + "userexists": "El correo electrónico ya existe. Ingrese otro ", + "emailexists": "El correo electrónico ya existe. Ingrese otro" } } } diff --git a/src/main/webapp/i18n/es/reset.json b/src/main/webapp/i18n/es/reset.json index 2614281..ed3516f 100644 --- a/src/main/webapp/i18n/es/reset.json +++ b/src/main/webapp/i18n/es/reset.json @@ -6,10 +6,11 @@ "button": "Restablecer la contraseña" }, "messages": { - "info": "Introduzca la dirección de correo electrónico que utilizó para registrarse", - "success": "Revise su correo electrónico para obtener más información sobre cómo restablecer su contraseña.", + "info": "Introduzca su dirección de correo electrónico", + "success": "Revise su correo electrónico para restablecer su contraseña.", "error": { - "emailnotexists": "¡El correo electrónico no se encuentra registrado en el sistema! Por favor, ingrese otro email." + "emailnotexists": "No existe una cuenta creada con esa dirección de correo electrónico", + "userisgoogle": "No cuenta con el permiso de restablecer su contraseña al haber activado su cuenta por medio de Google" } } }, @@ -20,7 +21,7 @@ }, "messages": { "info": "Elija una contraseña nueva", - "success": "Su contraseña ha sido restablecida. Por favor, ", + "success": "Su contraseña ha sido restablecida.", "keymissing": "Falta la clave de reinicio.", "error": "Su contraseña no puede ser restablecida. Recuerde que una solicitud de reinicio de contraseña sólo es válida durante 24 horas." }