From 2b1c62a0132353ed66d660a61917b9511a5f4d3f Mon Sep 17 00:00:00 2001 From: Pablo Bonilla Date: Mon, 26 Jul 2021 00:55:41 -0600 Subject: [PATCH 1/5] Add edit survey functionality in context menu --- .../encuesta/list/encuesta.component.html | 6 ++- .../encuesta/list/encuesta.component.ts | 38 +++++-------------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html index c0f3da5..5bd0ab6 100644 --- a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html +++ b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html @@ -97,11 +97,13 @@
  • - +
  • diff --git a/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts b/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts index 5d4bb97..4216f10 100644 --- a/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts +++ b/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts @@ -100,7 +100,7 @@ export class EncuestaComponent implements OnInit, AfterViewInit { }); createAnother: Boolean = false; - selectedSurveyId: Number | null = null; + selectedSurveyId: number | null = null; constructor( protected encuestaService: EncuestaService, @@ -423,8 +423,13 @@ export class EncuestaComponent implements OnInit, AfterViewInit { } openSurvey(event: any): void { - const surveyId = event.target.getAttribute('data-id'); - this.router.navigate(['/encuesta', surveyId, 'edit']); + if (event === null) { + const surveyId = this.selectedSurveyId; + this.router.navigate(['/encuesta', surveyId, 'edit']); + } else { + const surveyId = event.target.dataset.id; + this.router.navigate(['/encuesta', surveyId, 'edit']); + } } selectSurvey(event: any): void { @@ -438,18 +443,10 @@ export class EncuestaComponent implements OnInit, AfterViewInit { } openPreview() { - const surveyId = this.idEncuesta; + const surveyId = this.selectedSurveyId; this.router.navigate(['/encuesta', surveyId, 'preview']); } - counter(i: number) { - return new Array(i); - } - - testMe(something: any) { - return 5 - something; - } - async openContextMenu(event: any): Promise { if (event.type === 'contextmenu') { event.preventDefault(); @@ -457,22 +454,6 @@ export class EncuestaComponent implements OnInit, AfterViewInit { document.querySelectorAll('.ds-list--entity').forEach(e => { e.classList.remove('active'); }); - this.selectedSurveyId = Number(event.target.dataset.id); - - let res = await this.encuestaService.find(this.selectedSurveyId).toPromise(); - this.selectedSurvey = res.body; - this.isPublished = this.selectedSurvey!.estado === 'DRAFT'; // QUE SE LE MUESTRE CUANDO ESTE EN DRAFT - // } - - 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'; - if (this.isPublished) { - document.getElementById('contextmenu-publish')!.style.display = 'block'; //cambiar - } - document.getElementById('contextmenu-preview')!.style.display = 'block'; - //document.getElementById('contextmenu-share')!.style.display = 'block'; if ((event.target as HTMLElement).classList.contains('ds-list')) { document.getElementById('contextmenu-create--separator')!.style.display = 'block'; @@ -480,7 +461,6 @@ export class EncuestaComponent implements OnInit, AfterViewInit { document.getElementById('contextmenu-delete--separator')!.style.display = 'none'; } else if ((event.target as HTMLElement).classList.contains('ds-list--entity')) { this.selectedSurveyId = Number(event.target.dataset.id); - this.idEncuesta = Number(event.target.dataset.id); event.target.classList.add('active'); let res = await this.encuestaService.find(this.selectedSurveyId).toPromise(); From 306a2a0aaf6b100022d9faea2f87661ae3108ebd Mon Sep 17 00:00:00 2001 From: Pablo Bonilla Date: Mon, 26 Jul 2021 02:24:42 -0600 Subject: [PATCH 2/5] Update preview survey button position --- .../encuesta/update/encuesta-update.component.html | 10 +--------- .../encuesta/update/encuesta-update.component.ts | 3 ++- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.html b/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.html index 6eb2590..bc0f16b 100644 --- a/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.html +++ b/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.html @@ -9,6 +9,7 @@ data-target="#verParametros" (click)="loadAplicationParameters()" > +   
  • Creada el día {{ encuesta!.fechaCreacion | formatShortDatetime | lowercase }}

    @@ -31,15 +32,6 @@ >   Crear pregunta - - - - - - - diff --git a/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.ts b/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.ts index c8d573d..dafb341 100644 --- a/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.ts +++ b/src/main/webapp/app/entities/encuesta/update/encuesta-update.component.ts @@ -25,7 +25,7 @@ import { IEPreguntaCerrada } from 'app/entities/e-pregunta-cerrada/e-pregunta-ce import { EPreguntaCerradaService } from 'app/entities/e-pregunta-cerrada/service/e-pregunta-cerrada.service'; import { EPreguntaCerradaDeleteDialogComponent } from 'app/entities/e-pregunta-cerrada/delete/e-pregunta-cerrada-delete-dialog.component'; -import { faTimes, faPlus, faQuestion, faPollH } from '@fortawesome/free-solid-svg-icons'; +import { faTimes, faPlus, faQuestion, faPollH, faEye } from '@fortawesome/free-solid-svg-icons'; import { PreguntaCerradaTipo } from 'app/entities/enumerations/pregunta-cerrada-tipo.model'; import { EncuestaDeleteQuestionDialogComponent } from '../encuesta-delete-question-dialog/encuesta-delete-question-dialog.component'; import { EncuestaDeleteOptionDialogComponent } from '../encuesta-delete-option-dialog/encuesta-delete-option-dialog.component'; @@ -43,6 +43,7 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked { faPlus = faPlus; faPollH = faPollH; faQuestion = faQuestion; + faEye = faEye; isSaving = false; isSavingQuestion = false; From 72c07e2bbfb87c05a33389b37844b54b95c04bfd Mon Sep 17 00:00:00 2001 From: Pablo Bonilla Date: Mon, 26 Jul 2021 02:37:14 -0600 Subject: [PATCH 3/5] Add duplicate button and fix delete button in survey list --- .../encuesta/list/encuesta.component.html | 24 +++++++------------ .../encuesta/list/encuesta.component.ts | 10 ++++++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html index 5bd0ab6..b639e55 100644 --- a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html +++ b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html @@ -96,25 +96,19 @@
    -
  • - +
  • +
  • -
  • -
  • -
  • - +
  • +
  • + diff --git a/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts b/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts index 4216f10..abc8fe8 100644 --- a/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts +++ b/src/main/webapp/app/entities/encuesta/list/encuesta.component.ts @@ -253,8 +253,8 @@ export class EncuestaComponent implements OnInit, AfterViewInit { } deleteSurvey(): void { - if (this.idEncuesta != null) { - this.getEncuesta(this.idEncuesta) + if (this.selectedSurveyId != null) { + this.getEncuesta(this.selectedSurveyId) .pipe( finalize(() => { const modalRef = this.modalService.open(EncuestaDeleteDialogComponent, { size: 'lg', backdrop: 'static' }); @@ -475,8 +475,10 @@ export class EncuestaComponent implements OnInit, AfterViewInit { if (!this.isPublished) { document.getElementById('contextmenu-publish')!.style.display = 'block'; + document.getElementById('contextmenu-duplicate')!.style.display = 'block'; } else { document.getElementById('contextmenu-publish')!.style.display = 'none'; + document.getElementById('contextmenu-duplicate')!.style.display = 'none'; } // document.getElementById('contextmenu-share')!.style.display = 'block'; document.getElementById('contextmenu-create--separator')!.style.display = 'none'; @@ -501,4 +503,8 @@ export class EncuestaComponent implements OnInit, AfterViewInit { } }); } + + duplicateSurvey(): void { + console.log(this.selectedSurveyId); + } } From 3695c037b22399f07d2e476e0a3da7464a56709f Mon Sep 17 00:00:00 2001 From: Pablo Bonilla Date: Mon, 26 Jul 2021 13:21:18 -0600 Subject: [PATCH 4/5] Add title and subtitle for categories and users --- .../categoria/list/categoria.component.html | 5 +- .../list/usuario-extra.component.html | 5 +- .../app/layouts/sidebar/sidebar.constants.ts | 48 +++++++++---------- 3 files changed, 32 insertions(+), 26 deletions(-) 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 a268f84..b486a5d 100644 --- a/src/main/webapp/app/entities/categoria/list/categoria.component.html +++ b/src/main/webapp/app/entities/categoria/list/categoria.component.html @@ -1,6 +1,9 @@

    - Categorias +
    + Categorias +

    Categorice las encuestas de la aplicación

    +