agregar toggle en lugar de eliminar

This commit is contained in:
Eduardo Quiros 2021-07-18 20:57:20 -06:00
parent 1d75fb6960
commit 6986e3b16e
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
4 changed files with 19 additions and 3 deletions

View File

@ -34,7 +34,11 @@ export class CategoriaDeleteDialogComponent {
this.encuestaService.update(encuesta);
});
}
categoria.estado = EstadoCategoria.INACTIVE;
if (categoria.estado == EstadoCategoria.INACTIVE) {
categoria.estado = EstadoCategoria.ACTIVE;
} else {
categoria.estado = EstadoCategoria.INACTIVE;
}
this.categoriaService.update(categoria).subscribe(() => {
this.activeModal.close('deleted');
});

View File

@ -42,7 +42,7 @@ export class CategoriaComponent implements OnInit {
return item.id!;
}
delete(categoria: ICategoria): void {
toggleStatus(categoria: ICategoria): void {
const modalRef = this.modalService.open(CategoriaDeleteDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.categoria = categoria;
// unsubscribe not needed because closed completes on modal close

View File

@ -41,6 +41,15 @@
}
}
.ds-btn--toggle {
background-color: #ffaa47;
color: #fff;
&:hover {
background-color: #e09935;
}
}
.ds-btn--secondary {
background-color: transparent;
color: #2962ff;

View File

@ -126,7 +126,10 @@
"open": "Abrir",
"save": "Guardar",
"view": "Vista",
"create": "Crear"
"create": "Crear",
"enable": "Habilitar",
"disable": "Deshabilitar",
"toggleStatus": "Cambiar Estado"
},
"detail": {
"field": "Campo",