Merge branch 'dev' into feature/US-57
This commit is contained in:
commit
8c56917d03
|
@ -1,6 +1,6 @@
|
||||||
<form *ngIf="encuesta" name="deleteForm" (ngSubmit)="confirmDelete(encuesta)">
|
<form class="ds-form" *ngIf="encuesta" name="deleteForm" (ngSubmit)="confirmDelete(encuesta!)">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" data-cy="encuestaDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h4>
|
<h2 class="ds-title" data-cy="encuestaDeleteDialogHeading" jhiTranslate="entity.delete.title">Confirm delete operation</h2>
|
||||||
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">×</button>
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">×</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -14,11 +14,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="cancel()">
|
<button type="button" class="ds-btn ds-btn--secondary" data-dismiss="modal" (click)="cancel()">
|
||||||
<fa-icon icon="ban"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
<fa-icon icon="arrow-left"></fa-icon> <span jhiTranslate="entity.action.cancel">Cancel</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button id="jhi-confirm-delete-encuesta" data-cy="entityConfirmDeleteButton" type="submit" class="btn btn-danger">
|
<button id="jhi-confirm-delete-encuesta" data-cy="entityConfirmDeleteButton" type="submit" class="ds-btn ds-btn--danger">
|
||||||
<fa-icon icon="times"></fa-icon> <span jhiTranslate="entity.action.delete">Delete</span>
|
<fa-icon icon="times"></fa-icon> <span jhiTranslate="entity.action.delete">Delete</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model';
|
|
||||||
|
|
||||||
import { IEncuesta } from '../encuesta.model';
|
import { IEncuesta } from '../encuesta.model';
|
||||||
import { EncuestaService } from '../service/encuesta.service';
|
import { EncuestaService } from '../service/encuesta.service';
|
||||||
|
import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: './encuesta-delete-dialog.component.html',
|
templateUrl: './encuesta-delete-dialog.component.html',
|
||||||
|
@ -17,9 +16,9 @@ export class EncuestaDeleteDialogComponent {
|
||||||
this.activeModal.dismiss();
|
this.activeModal.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
confirmDelete(encuesta: IEncuesta): void {
|
confirmDelete(encuest: IEncuesta): void {
|
||||||
encuesta.estado = EstadoEncuesta.DELETED;
|
encuest.estado = EstadoEncuesta.DELETED;
|
||||||
this.encuestaService.update(encuesta).subscribe(() => {
|
this.encuestaService.deleteEncuesta(encuest).subscribe(() => {
|
||||||
this.activeModal.close('deleted');
|
this.activeModal.close('deleted');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ds-contextmenu__divider" id="contextmenu-delete--separator">
|
<div class="ds-contextmenu__divider" id="contextmenu-delete--separator">
|
||||||
<li>
|
<li>
|
||||||
<button type="button"><fa-icon class="contextmenu__icon" [icon]="faTrashAlt"></fa-icon>Eliminar</button>
|
<button type="button" (click)="deleteSurvey()">
|
||||||
|
<fa-icon class="contextmenu__icon" [icon]="faTrashAlt"></fa-icon>Eliminar
|
||||||
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</div>
|
</div>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { EstadoEncuesta } from 'app/entities/enumerations/estado-encuesta.model'
|
||||||
import { AccountService } from 'app/core/auth/account.service';
|
import { AccountService } from 'app/core/auth/account.service';
|
||||||
import { Account } from 'app/core/auth/account.model';
|
import { Account } from 'app/core/auth/account.model';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
import { EncuestaPublishDialogComponent } from '../encuesta-publish-dialog/encuesta-publish-dialog.component';
|
||||||
import { IUser } from '../../user/user.model';
|
import { IUser } from '../../user/user.model';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -39,7 +40,6 @@ import {
|
||||||
} from '@fortawesome/free-solid-svg-icons';
|
} from '@fortawesome/free-solid-svg-icons';
|
||||||
|
|
||||||
import * as $ from 'jquery';
|
import * as $ from 'jquery';
|
||||||
import { EncuestaPublishDialogComponent } from '../encuesta-publish-dialog/encuesta-publish-dialog.component';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'jhi-encuesta',
|
selector: 'jhi-encuesta',
|
||||||
|
@ -73,6 +73,9 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
|
||||||
usuarioExtrasSharedCollection: IUsuarioExtra[] = [];
|
usuarioExtrasSharedCollection: IUsuarioExtra[] = [];
|
||||||
userSharedCollection: IUser[] = [];
|
userSharedCollection: IUser[] = [];
|
||||||
|
|
||||||
|
selectedIdSurvey: number | null = null;
|
||||||
|
encuestaencontrada: IEncuesta | null = null;
|
||||||
|
|
||||||
public searchString: string;
|
public searchString: string;
|
||||||
public accesoEncuesta: string;
|
public accesoEncuesta: string;
|
||||||
//public categoriaEncuesta: string;
|
//public categoriaEncuesta: string;
|
||||||
|
@ -246,6 +249,49 @@ export class EncuestaComponent implements OnInit, AfterViewInit {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteSurvey(): void {
|
||||||
|
if (this.selectedIdSurvey != null) {
|
||||||
|
this.getEncuesta(this.selectedIdSurvey)
|
||||||
|
.pipe(
|
||||||
|
finalize(() => {
|
||||||
|
const modalRef = this.modalService.open(EncuestaDeleteDialogComponent, { size: 'lg', backdrop: 'static' });
|
||||||
|
modalRef.componentInstance.encuesta = this.encuestaencontrada;
|
||||||
|
|
||||||
|
modalRef.closed.subscribe(reason => {
|
||||||
|
if (reason === 'deleted') {
|
||||||
|
this.loadAll();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.subscribe(data => {
|
||||||
|
console.log(data);
|
||||||
|
this.encuestaencontrada = data;
|
||||||
|
});
|
||||||
|
|
||||||
|
/*const modalRef = this.modalService.open(EncuestaDeleteDialogComponent, { size: 'lg', backdrop: 'static' });
|
||||||
|
modalRef.componentInstance.encuesta = this.getEncuesta(this.selectedSurvey)
|
||||||
|
.pipe(finalize(() =>
|
||||||
|
modalRef.closed.subscribe(reason => {
|
||||||
|
if (reason === 'deleted') {
|
||||||
|
this.loadAll();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
))
|
||||||
|
.subscribe(data=> {
|
||||||
|
console.log(data);
|
||||||
|
//this.encuestaencontrada = data;
|
||||||
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
|
// unsubscribe not needed because closed completes on modal close
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getEncuesta(id: number) {
|
||||||
|
return this.encuestaService.findEncuesta(id);
|
||||||
|
}
|
||||||
|
|
||||||
previousState(): void {
|
previousState(): void {
|
||||||
window.history.back();
|
window.history.back();
|
||||||
}
|
}
|
||||||
|
@ -431,6 +477,9 @@ 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);
|
||||||
|
//this.selectedSurvey = event.target.dataset.encuesta;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('contextmenu')!.style.top = event.layerY + 'px';
|
document.getElementById('contextmenu')!.style.top = event.layerY + 'px';
|
||||||
|
|
|
@ -56,6 +56,15 @@ export class EncuestaService {
|
||||||
.get<any>(`${this.resourceUrl}/preguntas-opciones/${id}`, { observe: 'response' })
|
.get<any>(`${this.resourceUrl}/preguntas-opciones/${id}`, { observe: 'response' })
|
||||||
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
.pipe(map((res: EntityResponseType) => this.convertDateFromServer(res)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
findEncuesta(id: number): Observable<IEncuesta> {
|
||||||
|
return this.http.get<IEncuesta>(`${this.resourceUrl}/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteEncuesta(encuesta: IEncuesta): Observable<EntityResponseType> {
|
||||||
|
//const copy = this.convertDateFromClient(encuesta);
|
||||||
|
return this.http.put<IEncuesta>(`${this.resourceUrl}/${getEncuestaIdentifier(encuesta) as number}`, encuesta, { observe: 'response' });
|
||||||
|
}
|
||||||
|
|
||||||
query(req?: any): Observable<EntityArrayResponseType> {
|
query(req?: any): Observable<EntityArrayResponseType> {
|
||||||
const options = createRequestOption(req);
|
const options = createRequestOption(req);
|
||||||
|
|
|
@ -137,7 +137,7 @@
|
||||||
"value": "Valor"
|
"value": "Valor"
|
||||||
},
|
},
|
||||||
"delete": {
|
"delete": {
|
||||||
"title": "Confirmar operación de borrado",
|
"title": "Confirmar de operación",
|
||||||
"status": "Confirmar cambio de estado"
|
"status": "Confirmar cambio de estado"
|
||||||
},
|
},
|
||||||
"validation": {
|
"validation": {
|
||||||
|
|
Loading…
Reference in New Issue