From 2296fb9e7804aed17859515768c78acc91bc27e0 Mon Sep 17 00:00:00 2001 From: Fabio-Ramirez <45831788+Fabio-Ramirez@users.noreply.github.com> Date: Thu, 23 Jan 2025 16:01:11 -0300 Subject: [PATCH] CIT - Solapamiento de profesional editando agenda (#3108) * CIT - Solapamiento de profesional editando agenda * Se corrigue a partir de observacion --- .../gestor-agendas/gestor-agendas.component.ts | 5 +++++ .../turnos/gestor-agendas/gestor-agendas.html | 4 ++-- .../operaciones-agenda/panel-agenda.component.ts | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/app/components/turnos/gestor-agendas/gestor-agendas.component.ts b/src/app/components/turnos/gestor-agendas/gestor-agendas.component.ts index d7c6e8277d..d161752b97 100644 --- a/src/app/components/turnos/gestor-agendas/gestor-agendas.component.ts +++ b/src/app/components/turnos/gestor-agendas/gestor-agendas.component.ts @@ -73,6 +73,7 @@ export class GestorAgendasComponent implements OnInit, OnDestroy { public showCarpetas = false; public showSuspenderAgenda = false; public showSuspendida = false; + public profesionalExistente = false; public agendas: any = []; public agenda: any = {}; public modelo: any = {}; @@ -479,6 +480,10 @@ export class GestorAgendasComponent implements OnInit, OnDestroy { this.showAgregarNotaAgenda = false; } + showGuardarDisabled(profesionalExiste: boolean) { + this.profesionalExistente = profesionalExiste; + } + insertarAgenda() { this.showInsertarAgenda = true; this.showGestorAgendas = false; diff --git a/src/app/components/turnos/gestor-agendas/gestor-agendas.html b/src/app/components/turnos/gestor-agendas/gestor-agendas.html index 8ffda36025..3c76c3b0a9 100644 --- a/src/app/components/turnos/gestor-agendas/gestor-agendas.html +++ b/src/app/components/turnos/gestor-agendas/gestor-agendas.html @@ -230,11 +230,11 @@ + (profesionalExistente)="showGuardarDisabled($event)" #guardarAgendaPanel>
-
diff --git a/src/app/components/turnos/gestor-agendas/operaciones-agenda/panel-agenda.component.ts b/src/app/components/turnos/gestor-agendas/operaciones-agenda/panel-agenda.component.ts index 9661e5e2e6..646f2f16c9 100644 --- a/src/app/components/turnos/gestor-agendas/operaciones-agenda/panel-agenda.component.ts +++ b/src/app/components/turnos/gestor-agendas/operaciones-agenda/panel-agenda.component.ts @@ -40,6 +40,7 @@ export class PanelAgendaComponent implements OnInit { // Usados en tag en gestor-agendas.html @Output() actualizarEstadoEmit = new EventEmitter(); @Output() showVistaTurnosEmit = new EventEmitter(); + @Output() profesionalExistente = new EventEmitter(); showEditarAgendaPanel: Boolean = true; public showMapa = false; @@ -230,6 +231,7 @@ export class PanelAgendaComponent implements OnInit { if (tipo === 'profesionales') { // Loop profesionales + this.profesionalExistente.emit(true); if (this.editaAgendaPanel.profesionales) { this.editaAgendaPanel.profesionales.forEach((profesional) => { const params = { @@ -249,8 +251,15 @@ export class PanelAgendaComponent implements OnInit { if (agendasConSolapamiento.length > 0) { this.alertas = [... this.alertas, 'El profesional ' + profesional.nombre + ' ' + profesional.apellido + ' está asignado a otra agenda en ese horario']; } + if (this.alertas.length > 0) { + this.profesionalExistente.emit(true); + } else { + this.profesionalExistente.emit(false); + } }); }); + } else { + this.profesionalExistente.emit(false); } } else if (tipo === 'espacioFisico') { // Loop Espacios Físicos @@ -272,6 +281,11 @@ export class PanelAgendaComponent implements OnInit { if (agendasConSolapamiento.length > 0) { this.alertas = [... this.alertas, 'El ' + this.editaAgendaPanel.espacioFisico.nombre + ' está asignado a otra agenda en ese horario']; } + if (this.alertas.length > 0) { + this.profesionalExistente.emit(true); + } else { + this.profesionalExistente.emit(false); + } }); } }