Add opcion de ver vista previa en la lista de encuestas

This commit is contained in:
Mariela Bonilla 2021-07-22 23:24:12 -06:00
parent 593905bf01
commit 3d7ec93084
3 changed files with 14 additions and 4 deletions

View File

@ -58,7 +58,9 @@
<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>
<button type="button" (click)="openPreview()" id="contextmenu-preview">
<fa-icon class="contextmenu__icon" [icon]="faPollH"></fa-icon>Vista Previa
</button>
</li>
<li>
<button type="button" id="contextmenu-rename">
@ -194,7 +196,7 @@
<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>

View File

@ -34,6 +34,7 @@ import {
faTrashAlt,
faPlus,
faStar,
faPollH,
} from '@fortawesome/free-solid-svg-icons';
import * as $ from 'jquery';
@ -54,7 +55,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
faTrashAlt = faTrashAlt;
faPlus = faPlus;
faStar = faStar;
faPollH = faPollH;
account: Account | null = null;
usuarioExtra: UsuarioExtra | null = null;
@ -62,6 +63,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
isLoading = false;
isSaving = false;
selectedIdSurvey: number = 0;
categoriasSharedCollection: ICategoria[] = [];
usuarioExtrasSharedCollection: IUsuarioExtra[] = [];
@ -320,6 +322,11 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
}
}
openPreview() {
const surveyId = this.selectedIdSurvey;
this.router.navigate(['/encuesta', surveyId, 'preview']);
}
counter(i: number) {
return new Array(i);
}
@ -350,6 +357,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
} else if ((event.target as HTMLElement).classList.contains('ds-list--entity')) {
event.target.classList.add('active');
document.getElementById('contextmenu-create--separator')!.style.display = 'none';
this.selectedIdSurvey = Number(event.target.dataset.id);
}
document.getElementById('contextmenu')!.style.top = event.layerY + 'px';

View File

@ -30,7 +30,7 @@ const encuestaRoute: Routes = [
canActivate: [UserRouteAccessService],
},
{
path: ':id/edit',
path: ':id/preview',
component: EncuestaUpdateComponent,
resolve: {
encuesta: EncuestaRoutingResolveService,