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> <button type="button" id="contextmenu-edit"><fa-icon class="contextmenu__icon" [icon]="faEdit"></fa-icon>Editar</button>
</li> </li>
<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>
<li> <li>
<button type="button" id="contextmenu-rename"> <button type="button" id="contextmenu-rename">

View File

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

View File

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