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 24152b7..5bca925 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 @@ -18,7 +18,13 @@ -
+
+ + + + + + + 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 c44a07f..fea4457 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 @@ -36,6 +36,7 @@ import { Router } from '@angular/router'; import { UsuarioEncuestaService } from 'app/entities/usuario-encuesta/service/usuario-encuesta.service'; import { IUsuarioEncuesta } from '../../usuario-encuesta/usuario-encuesta.model'; +import { RolColaborador } from '../../enumerations/rol-colaborador.model'; @Component({ selector: 'jhi-encuesta-update', @@ -50,10 +51,12 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked { isSaving = false; isSavingQuestion = false; - + isSavingCollab = false; + public rolSeleccionado: RolColaborador | undefined = undefined; categoriasSharedCollection: ICategoria[] = []; usuarioExtrasSharedCollection: IUsuarioExtra[] = []; usuariosColaboradores: IUsuarioEncuesta[] = []; + colaborador: IUsuarioEncuesta | null = null; // editForm = this.fb.group({ // id: [], @@ -87,6 +90,11 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked { tipopregunta: ['CLOSED'], }); + editFormUpdateCollab = this.fb.group({ + id: [], + rol: [null, [Validators.required]], + }); + ePreguntas?: any[]; ePreguntasOpciones?: any[]; encuesta: Encuesta | null = null; @@ -548,4 +556,23 @@ export class EncuestaUpdateComponent implements OnInit, AfterViewChecked { // usuarioExtra: this.editForm.get(['usuarioExtra'])!.value, // }; // } + + /* methods for colaborators*/ + + selectColaborator(c: IUsuarioEncuesta) { + this.colaborador = c; + this.rolSeleccionado = c.rol; + } + + openColaborator(event: any) {} + + saveCollab(): void { + this.isSavingCollab = true; + const collab = this.colaborador; + if (collab !== null) { + collab.rol = this.editFormUpdateCollab.get('rol')!.value; + collab.fechaAgregado = dayjs(this.colaborador?.fechaAgregado, DATE_TIME_FORMAT); + this.usuarioEncuestaService.update(collab); + } + } } diff --git a/src/main/webapp/app/entities/usuario-encuesta/service/usuario-encuesta.service.ts b/src/main/webapp/app/entities/usuario-encuesta/service/usuario-encuesta.service.ts index fc47e76..dd7aee7 100644 --- a/src/main/webapp/app/entities/usuario-encuesta/service/usuario-encuesta.service.ts +++ b/src/main/webapp/app/entities/usuario-encuesta/service/usuario-encuesta.service.ts @@ -27,8 +27,9 @@ export class UsuarioEncuestaService { update(usuarioEncuesta: IUsuarioEncuesta): Observable { const copy = this.convertDateFromClient(usuarioEncuesta); + const url = `${this.resourceUrl}/${getUsuarioEncuestaIdentifier(usuarioEncuesta) as number}`; return this.http - .put(`${this.resourceUrl}/${getUsuarioEncuestaIdentifier(usuarioEncuesta) as number}`, copy, { + .put(url, copy, { observe: 'response', }) .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res))); @@ -36,8 +37,9 @@ export class UsuarioEncuestaService { partialUpdate(usuarioEncuesta: IUsuarioEncuesta): Observable { const copy = this.convertDateFromClient(usuarioEncuesta); + const url = `${this.resourceUrl}/${getUsuarioEncuestaIdentifier(usuarioEncuesta) as number}`; return this.http - .patch(`${this.resourceUrl}/${getUsuarioEncuestaIdentifier(usuarioEncuesta) as number}`, copy, { + .patch(url, copy, { observe: 'response', }) .pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));