From 6986e3b16eeb5be7c9c5e765a791dc15ef211134 Mon Sep 17 00:00:00 2001 From: Eduardo Quiros Date: Sun, 18 Jul 2021 20:57:20 -0600 Subject: [PATCH] agregar toggle en lugar de eliminar --- .../delete/categoria-delete-dialog.component.ts | 6 +++++- .../app/entities/categoria/list/categoria.component.ts | 2 +- .../scss/paper-dashboard/_datasurvey-buttons.scss | 9 +++++++++ src/main/webapp/i18n/es/global.json | 5 ++++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts index bf4e321..a4a63ba 100644 --- a/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts +++ b/src/main/webapp/app/entities/categoria/delete/categoria-delete-dialog.component.ts @@ -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'); }); diff --git a/src/main/webapp/app/entities/categoria/list/categoria.component.ts b/src/main/webapp/app/entities/categoria/list/categoria.component.ts index 31ddcff..f7a7735 100644 --- a/src/main/webapp/app/entities/categoria/list/categoria.component.ts +++ b/src/main/webapp/app/entities/categoria/list/categoria.component.ts @@ -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 diff --git a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss index efae4e5..ccb1547 100644 --- a/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss +++ b/src/main/webapp/content/scss/paper-dashboard/_datasurvey-buttons.scss @@ -41,6 +41,15 @@ } } +.ds-btn--toggle { + background-color: #ffaa47; + color: #fff; + + &:hover { + background-color: #e09935; + } +} + .ds-btn--secondary { background-color: transparent; color: #2962ff; diff --git a/src/main/webapp/i18n/es/global.json b/src/main/webapp/i18n/es/global.json index e924d2c..933a0e7 100644 --- a/src/main/webapp/i18n/es/global.json +++ b/src/main/webapp/i18n/es/global.json @@ -126,7 +126,10 @@ "open": "Abrir", "save": "Guardar", "view": "Vista", - "create": "Crear" + "create": "Crear", + "enable": "Habilitar", + "disable": "Deshabilitar", + "toggleStatus": "Cambiar Estado" }, "detail": { "field": "Campo",