Merge pull request #55 from Quantum-P3/dev

This commit is contained in:
Eduardo Quiros 2021-07-24 00:34:37 +00:00 committed by GitHub
commit 3dcc2af577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 613 additions and 82 deletions

View File

@ -168,7 +168,11 @@ public class AccountResource {
public void requestPasswordReset(@RequestBody String mail) {
Optional<User> user = userService.requestPasswordReset(mail);
if (user.isPresent()) {
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

View File

@ -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() {}
}

View File

@ -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");
}
}

View File

@ -15,15 +15,15 @@ email.signature=Equipo de DataSurvey
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=Modificación de contraseña exitosa
email.restored.greeting=¡Hola, {0}!
email.restored.text1=Se ha restablecido correctamente su contraseña en DataSurvey.
email.restored.text1=¡Se ha restablecido correctamente su contraseña en DataSurvey!
email.restored.text2=Saludos,
email.restored.text3=Si usted no realizó este cambio, favor notifique inmediatamente al siguiente correo:
email.restored.email=datasurvey@gmail.com

View File

@ -304,7 +304,7 @@
<td style="text-align: left; padding-left: 5px; padding-right: 5px">
<h3 class="heading">Información de contacto</h3>
<ul>
<li><span class="text">datasurvey@gmail.com</span></li>
<li><span href="mailto:datasurveyapp@gmail.com" class="text">datasurveyapp@gmail.com</span></li>
</ul>
</td>
</tr>

View File

@ -304,7 +304,7 @@
<td style="text-align: left; padding-left: 5px; padding-right: 5px">
<h3 class="heading">Información de contacto</h3>
<ul>
<li><span class="text">datasurvey@gmail.com</span></li>
<li><span href="mailto:datasurveyapp@gmail.com" class="text">datasurveyapp@gmail.com</span></li>
</ul>
</td>
</tr>

View File

@ -304,7 +304,7 @@
<td style="text-align: left; padding-left: 5px; padding-right: 5px">
<h3 class="heading">Información de contacto</h3>
<ul>
<li><span class="text">datasurvey@gmail.com</span></li>
<li><span href="mailto:datasurveyapp@gmail.com" class="text">datasurveyapp@gmail.com</span></li>
</ul>
</td>
</tr>

View File

@ -267,7 +267,7 @@
>If you did not make this change, please notify the following email immediately</span
>
<a th:href="#{'mailto:'+email.restored.email}" th:text="#{email.restored.email}">datasurvey@gmail.com</a>
<a href="mailto:datasurveyapp@gmail.com" th:text="#{email.restored.email}">datasurveyapp@gmail.com</a>
</p>
</div>
<div class="text" style="padding: 0.2em 2.5em 0.5em; text-align: center">
@ -306,7 +306,7 @@
<td style="text-align: left; padding-left: 5px; padding-right: 5px">
<h3 class="heading">Información de contacto</h3>
<ul>
<li><span class="text">datasurvey@gmail.com</span></li>
<li><span href="mailto:datasurveyapp@gmail.com" class="text">datasurveyapp@gmail.com</span></li>
</ul>
</td>
</tr>

View File

@ -35,7 +35,6 @@
<div *ngIf="success">
<div class="alert alert-success text-center my-2">
<span jhiTranslate="reset.finish.messages.success"><strong>Your password has been reset.</strong></span>
<strong><span jhiTranslate="global.messages.info.authenticated.link">sign in</span></strong>
</div>
<div class="d-flex justify-content-center">
<button class="ds-btn ds-btn--primary" routerLink="/login" jhiTranslate="global.messages.info.authenticated.botonInicio">

View File

@ -27,12 +27,15 @@
</div>
<div class="alert alert-danger" *ngIf="errorEmailNotExists" jhiTranslate="reset.request.messages.error.emailnotexists">
<strong>Email no exists!</strong> Please choose another one.
<strong>Email no exists!</strong>
</div>
<div class="alert alert-danger" *ngIf="errorUserIsGoogle" jhiTranslate="reset.request.messages.error.userisgoogle">
<strong>No cuenta con el permiso de restablecer su contraseña al haber activado su cuenta por medio de Google</strong>
</div>
</div>
<form *ngIf="!success" name="form" class="ds-form" role="form" (ngSubmit)="requestReset()" [formGroup]="resetRequestForm">
<div class="form-group">
<label class="form-label" for="email" jhiTranslate="global.form.email.label">Email</label>
<label class="form-control-label" for="email" jhiTranslate="global.form.email.label">Email</label>
<input
type="email"
class="form-control"
@ -65,25 +68,6 @@
>
Your email is invalid.
</small>
<small
class="form-text text-danger"
*ngIf="resetRequestForm.get('email')?.errors?.minlength"
jhiTranslate="global.messages.validate.email.minlength"
>
Your email is required to be at least 5 characters.
</small>
<small
class="form-text text-danger"
*ngIf="resetRequestForm.get('email')?.errors?.maxlength"
jhiTranslate="global.messages.validate.email.maxlength"
>
Your email cannot be longer than 100 characters.
</small>
<small class="form-text text-danger" *ngIf="resetRequestForm.get('email')?.errors?.email">
Se requiere un correo electrónico válido.
</small>
</div>
</div>
@ -115,7 +99,7 @@
<div class="row mt-3">
<div class="col-12 text-center">
<p class="text-muted">
¿Aún no se encuentra registrado/a?
¿Aún no es parte de DataSurvey?
<a routerLink="/account/register" class="text-muted ms-1"><b>Crea una cuenta</b></a>
</p>
</div>

View File

@ -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;
}

View File

@ -63,6 +63,7 @@ describe('Component Tests', () => {
login: '',
langKey: 'es',
name: '',
firstName: 'normalUser',
profileIcon: 1,
isAdmin: 0,
isGoogle: 0,

View File

@ -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,

View File

@ -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
) {}
}

View File

@ -246,7 +246,7 @@
</div>
<div class="row mb-4">
<div class="form-group w-100">
<label for="iconoPerfil">Ícono de perfil</label>
<label>Ícono de perfil</label>
<div class="d-flex">
<jhi-swiper style="width: 22.5rem !important" [data]="profileIcons" (onSelectEvent)="selectIcon($event)"></jhi-swiper>
</div>

View File

@ -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';

View File

@ -5,9 +5,10 @@ import { EncuestaDetailComponent } from './detail/encuesta-detail.component';
import { EncuestaUpdateComponent } from './update/encuesta-update.component';
import { EncuestaDeleteDialogComponent } from './delete/encuesta-delete-dialog.component';
import { EncuestaRoutingModule } from './route/encuesta-routing.module';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
@NgModule({
imports: [SharedModule, EncuestaRoutingModule],
imports: [SharedModule, EncuestaRoutingModule, FontAwesomeModule],
declarations: [EncuestaComponent, EncuestaDetailComponent, EncuestaUpdateComponent, EncuestaDeleteDialogComponent],
entryComponents: [EncuestaDeleteDialogComponent],
})

View File

@ -1,23 +1,30 @@
<div>
<h2 id="page-heading" data-cy="EncuestaHeading">
<span jhiTranslate="dataSurveyApp.encuesta.home.title">Encuestas</span>
<div class="d-flex flex-sm-row flex-column justify-content-between align-items-center">
<div>
<span class="ds-title" jhiTranslate="dataSurveyApp.encuesta.home.title">Encuestas</span>
<p class="ds-subtitle">Cree encuestas y publiquelas mundialmente.</p>
</div>
<div class="d-flex justify-content-end">
<button class="btn btn-info mr-2" (click)="loadAll()" [disabled]="isLoading">
<fa-icon icon="sync" [spin]="isLoading"></fa-icon>
<span jhiTranslate="dataSurveyApp.encuesta.home.refreshListLabel">Refresh List</span>
<div>
<button type="button" class="ds-btn ds-btn--secondary" (click)="loadAll()" [disabled]="isLoading">
<fa-icon icon="sync" [spin]="isLoading"></fa-icon>&nbsp;&nbsp;<span jhiTranslate="dataSurveyApp.encuesta.home.refreshListLabel"
>Refresh List</span
>
</button>
<button
id="jh-create-entity"
data-cy="entityCreateButton"
class="btn btn-primary jh-create-entity create-encuesta"
[routerLink]="['/encuesta/new']"
*ngIf="!isAdmin() && isAuthenticated()"
type="button"
class="ds-btn ds-btn--primary"
(click)="resetForm()"
data-toggle="modal"
data-target="#crearEncuesta"
>
<fa-icon icon="plus"></fa-icon>
<span jhiTranslate="dataSurveyApp.encuesta.home.createLabel"> Create a new Encuesta </span>
Crear encuesta
</button>
</div>
</div>
</h2>
<jhi-alert-error></jhi-alert-error>
@ -28,7 +35,177 @@
<span jhiTranslate="dataSurveyApp.encuesta.home.notFound">No encuestas found</span>
</div>
<div class="table-responsive" id="entities" *ngIf="encuestas && encuestas.length > 0">
<!-- Lista de Encuestas del Usuario -->
<div class="ds-list" (contextmenu)="openContextMenu($event)">
<!-- Context Menu -->
<div class="ds-contextmenu ds-contextmenu--closed" id="contextmenu">
<ul id="ds-context-menu__list">
<div class="ds-contextmenu__divider ds-contextmenu__divider--separator-bottom" id="contextmenu-create--separator">
<li>
<button
*ngIf="!isAdmin() && isAuthenticated()"
type="button"
(click)="resetForm()"
data-toggle="modal"
data-target="#crearEncuesta"
>
<fa-icon class="contextmenu__icon" [icon]="faPlus"></fa-icon>Crear
</button>
</li>
</div>
<div class="ds-contextmenu__divider ds-contextmenu__divider--separator-bottom" id="contextmenu-edit--separator">
<li class="d-justify justify-content-start">
<button type="button" id="contextmenu-edit"><fa-icon class="contextmenu__icon" [icon]="faEdit"></fa-icon>Editar</button>
</li>
<li>
<button type="button" id="contextmenu-duplicate"><fa-icon class="contextmenu__icon" [icon]="faCopy"></fa-icon>Duplicar</button>
</li>
<li>
<button type="button" id="contextmenu-rename">
<fa-icon class="contextmenu__icon" [icon]="faFile"></fa-icon>Cambiar nombre
</button>
</li>
<li>
<button type="button" id="contextmenu-share"><fa-icon class="contextmenu__icon" [icon]="faShareAlt"></fa-icon>Compartir</button>
</li>
</div>
<div class="ds-contextmenu__divider" id="contextmenu-delete--separator">
<li>
<button type="button"><fa-icon class="contextmenu__icon" [icon]="faTrashAlt"></fa-icon>Eliminar</button>
</li>
</div>
</ul>
</div>
<div
class="ds-list--entity"
*ngFor="let encuesta of encuestas; trackBy: trackId"
(dblclick)="openSurvey($event)"
(click)="selectSurvey($event)"
[attr.data-id]="encuesta.id"
>
<div class="entity-header">
<div class="entity-state--container">
<div
class="entity-state"
[ngClass]="
encuesta.estado == 'DRAFT' ? 'entity-state--blue' : encuesta.estado == 'ACTIVE' ? 'entity-state--green' : 'entity-state--red'
"
style="animation-delay: 0s"
></div>
<div
class="entity-state"
[ngClass]="
encuesta.estado == 'DRAFT' ? 'entity-state--blue' : encuesta.estado == 'ACTIVE' ? 'entity-state--green' : 'entity-state--red'
"
style="animation-delay: 1s"
></div>
<div
class="entity-state entity-state--blue"
[ngClass]="
encuesta.estado == 'DRAFT' ? 'entity-state--blue' : encuesta.estado == 'ACTIVE' ? 'entity-state--green' : 'entity-state--red'
"
style="animation-delay: 2s"
></div>
<div
class="entity-state entity-state--blue"
[ngClass]="
encuesta.estado == 'DRAFT' ? 'entity-state--blue' : encuesta.estado == 'ACTIVE' ? 'entity-state--green' : 'entity-state--red'
"
style="animation-delay: 3s"
></div>
</div>
<div class="entity-share">
<span><fa-icon [icon]="faShareAlt"></fa-icon></span>
</div>
</div>
<div class="entity-body">
<div class="entity-body--row">
<span *ngIf="encuesta.acceso == 'PUBLIC'" class="title"
><fa-icon class="entity-icon--access" [icon]="faUnlock"></fa-icon>&nbsp;&nbsp;{{ encuesta.nombre | titlecase }}</span
>
</div>
<div class="entity-body--row">
<span *ngIf="encuesta.acceso == 'PRIVATE'" class="title mt-2"
><fa-icon class="entity-icon--access" [icon]="faLock"></fa-icon>&nbsp;&nbsp;{{ encuesta.nombre | titlecase }}</span
>
</div>
<div class="entity-body--row">
<span class="mt-2"
><fa-icon class="entity-icon--access" [icon]="faCalendarAlt"></fa-icon>&nbsp;&nbsp;{{
encuesta.fechaCreacion | formatShortDatetime | titlecase
}}</span
>
</div>
<div class="entity-body--row">
<span class="subtitle mt-2">{{ encuesta.descripcion | titlecase }}</span>
</div>
<div class="entity-body--row">
<span class="tag mt-2">{{ encuesta.categoria?.nombre | lowercase }}</span>
</div>
<div class="entity-body--row">
<fa-icon *ngFor="let i of [].constructor(encuesta.calificacion)" class="entity-icon--star" [icon]="faStar"></fa-icon
><fa-icon *ngFor="let i of [].constructor(5 - encuesta.calificacion!)" class="entity-icon--star--off" [icon]="faStar"></fa-icon>
</div>
</div>
<!-- <p>
<a [routerLink]="['/encuesta', encuesta.id, 'view']">{{ encuesta.id }}</a>
</p>
<p>{{ encuesta.nombre }}</p>
<p>{{ encuesta.descripcion }}</p>
<p>{{ encuesta.fechaCreacion | formatMediumDatetime }}</p>
<p>{{ encuesta.fechaPublicacion | formatMediumDatetime }}</p>
<p>{{ encuesta.fechaFinalizar | formatMediumDatetime }}</p>
<p>{{ encuesta.fechaFinalizada | formatMediumDatetime }}</p>
<p>{{ encuesta.calificacion }}</p>
<p jhiTranslate="{{ 'dataSurveyApp.AccesoEncuesta.' + encuesta.acceso }}">{{ encuesta.acceso }}</p>
<p>{{ encuesta.contrasenna }}</p>
<p jhiTranslate="{{ 'dataSurveyApp.EstadoEncuesta.' + encuesta.estado }}">{{ encuesta.estado }}</p>
<div>
<div *ngIf="encuesta.categoria">
<a [routerLink]="['/categoria', encuesta.categoria?.id, 'view']">{{ encuesta.categoria?.nombre }}</a>
</div>
</div>
<div>
<div *ngIf="encuesta.usuarioExtra">
<a [routerLink]="['/usuario-extra', encuesta.usuarioExtra?.id, 'view']">{{ encuesta.usuarioExtra?.id }}</a>
</div>
</div>
<div class="text-right">
<div class="btn-group">
<button
type="submit"
[routerLink]="['/encuesta', encuesta.id, 'view']"
class="btn btn-info btn-sm"
data-cy="entityDetailsButton"
>
<fa-icon icon="eye"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.view">View</span>
</button>
<button
type="submit"
[routerLink]="['/encuesta', encuesta.id, 'edit']"
class="btn btn-primary btn-sm"
data-cy="entityEditButton"
>
<fa-icon icon="pencil-alt"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.edit">Edit</span>
</button>
<button type="submit" (click)="delete(encuesta)" class="btn btn-danger btn-sm" data-cy="entityDeleteButton">
<fa-icon icon="times"></fa-icon>
<span class="d-none d-md-inline" jhiTranslate="entity.action.delete">Delete</span>
</button>
</div>
</div> -->
</div>
</div>
</div>
<!-- <div class="table-responsive" id="entities" *ngIf="encuestas && encuestas.length > 0">
<table class="table table-striped" aria-describedby="page-heading">
<thead>
<tr>
@ -104,16 +281,10 @@
</tr>
</tbody>
</table>
</div>
</div>
</div> -->
<!-- --------------------------------------------------------------------------------------------- -->
<!-- Button trigger modal -->
<button type="button" class="ds-btn ds-btn--primary" (click)="resetForm()" data-toggle="modal" data-target="#crearEncuesta">
Crear encuesta
</button>
<!-- Modal -->
<div
class="modal fade ds-modal"

View File

@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, AfterViewInit } from '@angular/core';
import { HttpResponse } from '@angular/common/http';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
@ -21,6 +21,20 @@ import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-
import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model';
import { AccountService } from 'app/core/auth/account.service';
import { Account } from 'app/core/auth/account.model';
import { Router } from '@angular/router';
import {
faShareAlt,
faLock,
faUnlock,
faCalendarAlt,
faEdit,
faCopy,
faFile,
faTrashAlt,
faPlus,
faStar,
} from '@fortawesome/free-solid-svg-icons';
import * as $ from 'jquery';
@ -28,7 +42,19 @@ import * as $ from 'jquery';
selector: 'jhi-encuesta',
templateUrl: './encuesta.component.html',
})
export class EncuestaComponent implements OnInit {
export class EncuestaComponent implements OnInit, AfterViewInit {
// Icons
faShareAlt = faShareAlt;
faLock = faLock;
faUnlock = faUnlock;
faCalendarAlt = faCalendarAlt;
faEdit = faEdit;
faCopy = faCopy;
faFile = faFile;
faTrashAlt = faTrashAlt;
faPlus = faPlus;
faStar = faStar;
account: Account | null = null;
usuarioExtra: UsuarioExtra | null = null;
@ -65,7 +91,8 @@ export class EncuestaComponent implements OnInit {
protected usuarioExtraService: UsuarioExtraService,
protected activatedRoute: ActivatedRoute,
protected fb: FormBuilder,
protected accountService: AccountService
protected accountService: AccountService,
protected router: Router
) {}
resetForm(): void {
@ -78,7 +105,8 @@ export class EncuestaComponent implements OnInit {
this.encuestaService.query().subscribe(
(res: HttpResponse<IEncuesta[]>) => {
this.isLoading = false;
this.encuestas = res.body ?? [];
const tmpEncuestas = res.body ?? [];
this.encuestas = tmpEncuestas.filter(e => e.usuarioExtra?.id === this.usuarioExtra?.id);
},
() => {
this.isLoading = false;
@ -87,12 +115,18 @@ export class EncuestaComponent implements OnInit {
}
ngOnInit(): void {
this.loadAll();
// Call upon selecting a survey to edit
// this.updateForm(encuesta);
this.loadRelationshipsOptions();
document.body.addEventListener('click', e => {
document.getElementById('contextmenu')!.classList.add('ds-contextmenu--closed');
document.getElementById('contextmenu')!.classList.remove('ds-contextmenu--open');
document.getElementById('contextmenu')!.style.maxHeight = '0%';
if (e.target) {
if (!(e.target as HTMLElement).classList.contains('ds-list--entity')) {
document.querySelectorAll('.ds-list--entity').forEach(e => {
e.classList.remove('active');
});
}
}
});
// this.activatedRoute.data.subscribe(({ encuesta }) => {
// if (encuesta.id === undefined) {
@ -112,6 +146,8 @@ export class EncuestaComponent implements OnInit {
if (account !== null) {
this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => {
this.usuarioExtra = usuarioExtra.body;
this.loadAll();
this.loadRelationshipsOptions();
if (this.usuarioExtra !== null) {
if (this.usuarioExtra.id === undefined) {
const today = dayjs().startOf('day');
@ -125,6 +161,8 @@ export class EncuestaComponent implements OnInit {
});
}
ngAfterViewInit(): void {}
trackId(index: number, item: IEncuesta): number {
return item.id!;
}
@ -259,4 +297,66 @@ export class EncuestaComponent implements OnInit {
usuarioExtra: this.usuarioExtra,
};
}
isAdmin(): boolean {
return this.accountService.hasAnyAuthority('ROLE_ADMIN');
}
isAuthenticated(): boolean {
return this.accountService.isAuthenticated();
}
openSurvey(event: any): void {
const surveyId = event.target.getAttribute('data-id');
this.router.navigate(['/encuesta', surveyId, 'edit']);
}
selectSurvey(event: any): void {
document.querySelectorAll('.ds-list--entity').forEach(e => {
e.classList.remove('active');
});
if (event.target.classList.contains('ds-list--entity')) {
event.target.classList.add('active');
}
}
counter(i: number) {
return new Array(i);
}
testMe(something: any) {
return 5 - something;
}
openContextMenu(event: any): void {
document.querySelectorAll('.ds-list--entity').forEach(e => {
e.classList.remove('active');
});
if (event.type === 'contextmenu') {
event.preventDefault();
document.getElementById('contextmenu-create--separator')!.style.display = 'block';
document.getElementById('contextmenu-edit--separator')!.style.display = 'block';
document.getElementById('contextmenu-delete--separator')!.style.display = 'block';
document.getElementById('contextmenu-edit')!.style.display = 'block';
document.getElementById('contextmenu-duplicate')!.style.display = 'block';
document.getElementById('contextmenu-rename')!.style.display = 'block';
document.getElementById('contextmenu-share')!.style.display = 'block';
if ((event.target as HTMLElement).classList.contains('ds-list')) {
document.getElementById('contextmenu-edit--separator')!.style.display = 'none';
document.getElementById('contextmenu-delete--separator')!.style.display = 'none';
} else if ((event.target as HTMLElement).classList.contains('ds-list--entity')) {
event.target.classList.add('active');
document.getElementById('contextmenu-create--separator')!.style.display = 'none';
}
document.getElementById('contextmenu')!.style.top = event.layerY + 'px';
document.getElementById('contextmenu')!.style.left = event.layerX + 'px';
document.getElementById('contextmenu')!.classList.remove('ds-contextmenu--closed');
document.getElementById('contextmenu')!.classList.add('ds-contextmenu--open');
document.getElementById('contextmenu')!.style.maxHeight = '100%';
}
}
}

View File

@ -63,6 +63,7 @@ describe('Component Tests', () => {
login: '',
langKey: 'es',
name: '',
firstName: 'userNormal',
profileIcon: 1,
isAdmin: 1,
isGoogle: 0,

View File

@ -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,

View File

@ -2,3 +2,8 @@
.off-canvas-sidebar:after {
background: #0f172a;
}
.main-panel {
height: 100vh !important;
overflow-y: auto;
}

View File

@ -61,6 +61,8 @@ export class SidebarComponent {
if (account !== null) {
this.usuarioExtraService.find(account.id).subscribe(usuarioExtra => {
this.usuarioExtra = usuarioExtra.body;
this.usuarioExtra!.nombre =
usuarioExtra.body!.nombre!.trim().split(' ')[0] + ' ' + usuarioExtra.body!.nombre!.trim().split(' ')[1];
});
}
});

View File

@ -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,

View File

@ -0,0 +1,12 @@
import { Pipe, PipeTransform } from '@angular/core';
import * as dayjs from 'dayjs';
@Pipe({
name: 'formatShortDatetime',
})
export class FormatShortDatetimePipe implements PipeTransform {
transform(day: dayjs.Dayjs | null | undefined): string {
return day ? day.format('dddd, MMMM D, YYYY') : '';
}
}

View File

@ -9,6 +9,7 @@ import { HasAnyAuthorityDirective } from './auth/has-any-authority.directive';
import { DurationPipe } from './date/duration.pipe';
import { FormatMediumDatetimePipe } from './date/format-medium-datetime.pipe';
import { FormatMediumDatePipe } from './date/format-medium-date.pipe';
import { FormatShortDatetimePipe } from './date/format-short-datetime.pipe';
import { SortByDirective } from './sort/sort-by.directive';
import { SortDirective } from './sort/sort.directive';
import { ItemCountComponent } from './pagination/item-count.component';
@ -25,6 +26,7 @@ import { FilterPipe } from './pipes/filter';
DurationPipe,
FormatMediumDatetimePipe,
FormatMediumDatePipe,
FormatShortDatetimePipe,
SortByDirective,
SortDirective,
ItemCountComponent,
@ -40,6 +42,7 @@ import { FilterPipe } from './pipes/filter';
DurationPipe,
FormatMediumDatetimePipe,
FormatMediumDatePipe,
FormatShortDatetimePipe,
SortByDirective,
SortDirective,
ItemCountComponent,

View File

@ -95,3 +95,6 @@
@import 'paper-dashboard/datasurvey-form';
@import 'paper-dashboard/datasurvey-global';
@import 'paper-dashboard/datasurvey-modal';
@import 'paper-dashboard/datasurvey-list';
@import 'paper-dashboard/datasurvey-table';
@import 'paper-dashboard/datasurvey-contextmenu';

View File

@ -0,0 +1,70 @@
.ds-contextmenu {
position: absolute;
background-color: #fff;
border-radius: 3px;
z-index: 100;
box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
max-height: 0%;
overflow: hidden;
/* Set our transitions up. */
-webkit-transition: max-height 0.8s;
-moz-transition: max-height 0.8s;
transition: max-height 0.8s;
ul {
padding: 0;
margin: 0;
li {
list-style: none;
padding: 0.2rem 0;
text-align: left;
width: 100%;
button {
border: none;
outline: 0;
background-color: transparent;
width: 100%;
text-align: left;
padding: 0.4rem 8rem 0.4rem 3rem;
color: #313747;
position: relative;
&:hover {
background-color: #eeeeee;
}
.contextmenu__icon {
font-size: 1rem;
color: #808080;
margin-right: 1rem;
position: absolute;
left: 0.8rem;
bottom: 0.25rem;
}
}
}
}
.ds-contextmenu__divider {
padding: 0.25rem 0;
}
.ds-contextmenu__divider--separator-top {
border-bottom: 1px solid #dadce0;
}
.ds-contextmenu__divider--separator-bottom {
border-bottom: 1px solid #dadce0;
}
&--open {
display: block;
}
&--closed {
display: none;
}
}

View File

@ -51,7 +51,7 @@ $form-background: #f1f5f9;
outline: 0;
background: url(./../../img_datasurvey/down-arrow.svg) no-repeat right;
background-size: 3.5%;
background-size: 1rem;
-webkit-appearance: none;
background-position-x: 94%;

View File

@ -15,3 +15,7 @@
color: #757d94;
font-size: 0.9rem;
}
p {
margin: 0 !important;
}

View File

@ -0,0 +1,133 @@
@keyframes scaleIn {
from {
transform: scale(0.5, 0.5);
opacity: 0.5;
}
to {
transform: scale(2.5, 2.5);
opacity: 0;
}
}
.ds-list {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-auto-rows: minmax(12.5rem, auto);
border: 2px dashed #f1f1f1;
border-radius: $border-radius-x-large;
padding: 2rem;
width: 100%;
user-select: none;
box-sizing: border-box;
position: relative;
.ds-list--entity {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start;
border: 1px solid #dadce0;
border-radius: $border-radius-small;
padding: 0.5rem;
margin: 1rem;
word-wrap: break-word;
*:not(div) {
pointer-events: none;
}
.title {
color: rgba(0, 0, 0, 0.72);
font-size: 0.9rem;
display: flex;
align-items: center;
}
.subtitle {
color: rgba(0, 0, 0, 0.54);
}
.tag {
font-size: 0.8rem;
color: rgb(248, 248, 248);
margin-top: 0.5rem;
padding: 0.2rem 1.5rem;
background-color: #2962ff94;
border-radius: 15px;
}
.entity-header {
display: flex;
justify-content: space-between;
width: 100%;
pointer-events: none;
}
.entity-body--row {
margin: 0.4rem 0;
}
.entity-share {
border-radius: 50%;
background-color: #f1f5f9;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
transition: background-color 0.2s ease-in-out;
width: 25px;
height: 25px;
color: #313747;
}
.entity-share:hover {
background-color: #e3e6e9;
}
.entity-icon--access {
font-size: 0.8rem;
color: rgb(154, 156, 158);
}
.entity-icon--star {
color: #ffcc47;
margin-right: 0.2rem;
}
.entity-icon--star--off {
color: #d9dde0;
margin-right: 0.2rem;
}
.entity-state {
border-radius: 50%;
width: 10px;
height: 10px;
position: absolute;
left: 0;
opacity: 0;
animation: scaleIn 4s infinite cubic-bezier(0.36, 0.11, 0.89, 0.32);
}
.entity-state--container {
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.entity-state--blue {
background-color: #2962ff;
}
.entity-state--green {
background-color: #3ead7f;
}
.entity-state--red {
background-color: #e73636;
}
}
.active {
background-color: #e8f0fe !important;
}
}

View File

@ -1,3 +1,15 @@
@media screen and (max-width: 1280px) {
.ds-list {
grid-template-columns: repeat(3, 1fr) !important;
}
}
@media screen and (max-width: 880px) {
.ds-list {
grid-template-columns: repeat(2, 1fr) !important;
}
}
@media screen and (max-width: 991px) {
.navbar {
padding: 0;
@ -506,6 +518,10 @@
}
@media screen and (max-width: 576px) {
.ds-list {
grid-template-columns: repeat(1, 1fr) !important;
}
.navbar[class*='navbar-toggleable-'] .container {
margin-left: 0;
margin-right: 0;

View File

@ -2,11 +2,11 @@
"password": {
"title": "Contraseña de [<strong>{{username}}</strong>]",
"form": {
"button": "Guardar"
"button": "Restablecer contraseña"
},
"messages": {
"error": "<strong>¡Ha ocurrido un error!</strong> La contraseña no se ha podido cambiar.",
"success": "<strong>¡La contraseña ha sido cambiada!</strong>"
"error": "Ha ocurrido un error al restablecer su contraseña, por facor intentelo de nuevo",
"success": "La contraseña ha sido cambiada correctamente"
}
}
}

View File

@ -6,23 +6,24 @@
"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 con las instrucciones para restablecer su contraseña",
"error": {
"emailnotexists": "<strong>¡El correo electrónico no se encuentra registrado en el sistema!</strong> 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"
}
}
},
"finish": {
"title": "Restablecer la contraseña",
"form": {
"button": "Validar la nueva contraseña"
"button": "Restablecer contraseña"
},
"messages": {
"info": "Elija una contraseña nueva",
"success": "<strong>Su contraseña ha sido restablecida.</strong> Por favor, ",
"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."
"success": "¡Su contraseña ha sido restablecida exitosamente!",
"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"
}
}
}