diff --git a/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.html b/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.html new file mode 100644 index 0000000..8330f1a --- /dev/null +++ b/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.html @@ -0,0 +1,21 @@ +
+ + + + + +
diff --git a/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.scss b/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.spec.ts b/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.spec.ts new file mode 100644 index 0000000..025f83a --- /dev/null +++ b/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.spec.ts @@ -0,0 +1,24 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { EncuestaPublishDialogComponent } from './encuesta-publish-dialog.component'; + +describe('EncuestaPublishDialogComponent', () => { + let component: EncuestaPublishDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [EncuestaPublishDialogComponent], + }).compileComponents(); + }); + + beforeEach(() => { + fixture = TestBed.createComponent(EncuestaPublishDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.ts b/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.ts new file mode 100644 index 0000000..ff2d3b5 --- /dev/null +++ b/src/main/webapp/app/entities/encuesta/encuesta-publish-dialog/encuesta-publish-dialog.component.ts @@ -0,0 +1,33 @@ +import { Component, OnInit } from '@angular/core'; +import { IEncuesta } from '../encuesta.model'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { EncuestaService } from '../service/encuesta.service'; +import { EstadoEncuesta } from '../../enumerations/estado-encuesta.model'; + +@Component({ + selector: 'jhi-encuesta-publish-dialog', + templateUrl: './encuesta-publish-dialog.component.html', + styleUrls: ['./encuesta-publish-dialog.component.scss'], +}) +export class EncuestaPublishDialogComponent implements OnInit { + encuesta?: IEncuesta; + + constructor(protected encuestaService: EncuestaService, protected activeModal: NgbActiveModal) {} + + cancel(): void { + this.activeModal.dismiss(); + } + + confirmPublish(encuesta: IEncuesta): void { + debugger; + if (encuesta.estado === 'DRAFT') { + encuesta.estado = EstadoEncuesta.ACTIVE; + } + + this.encuestaService.update(encuesta).subscribe(() => { + this.activeModal.close('published'); + }); + } + + ngOnInit(): void {} +} diff --git a/src/main/webapp/app/entities/encuesta/encuesta.module.ts b/src/main/webapp/app/entities/encuesta/encuesta.module.ts index 6cd231e..7b1d91e 100644 --- a/src/main/webapp/app/entities/encuesta/encuesta.module.ts +++ b/src/main/webapp/app/entities/encuesta/encuesta.module.ts @@ -6,10 +6,17 @@ 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'; +import { EncuestaPublishDialogComponent } from './encuesta-publish-dialog/encuesta-publish-dialog.component'; @NgModule({ imports: [SharedModule, EncuestaRoutingModule, FontAwesomeModule], - declarations: [EncuestaComponent, EncuestaDetailComponent, EncuestaUpdateComponent, EncuestaDeleteDialogComponent], + declarations: [ + EncuestaComponent, + EncuestaDetailComponent, + EncuestaUpdateComponent, + EncuestaDeleteDialogComponent, + EncuestaPublishDialogComponent, + ], entryComponents: [EncuestaDeleteDialogComponent], }) export class EncuestaModule {} 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 f0545aa..b59d686 100644 --- a/src/main/webapp/app/entities/encuesta/list/encuesta.component.html +++ b/src/main/webapp/app/entities/encuesta/list/encuesta.component.html @@ -29,7 +29,12 @@ - +
No encuestas found @@ -61,8 +66,17 @@
  • -
  • @@ -194,7 +208,7 @@ Edit - +