Skip to content

Commit

Permalink
CIT - Solapamiento de profesional editando agenda (#3108)
Browse files Browse the repository at this point in the history
* CIT -  Solapamiento de profesional editando agenda

* Se corrigue a partir de observacion
  • Loading branch information
Fabio-Ramirez authored Jan 23, 2025
1 parent 3288880 commit 2296fb9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/turnos/gestor-agendas/gestor-agendas.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@
<panel-agenda [editaAgendaPanel]="agendasSeleccionadas[0]"
(showVistaTurnosEmit)="showVistaTurnos($event)"
(actualizarEstadoEmit)="actualizarGestor($event)" (editarEspacioFisicoEmit)="true"
#guardarAgendaPanel></panel-agenda>
(profesionalExistente)="showGuardarDisabled($event)" #guardarAgendaPanel></panel-agenda>
<div class="mt-3" justify="between">
<plex-button type="danger" label="Cancelar" (click)="guardarAgendaPanel.cancelar()">
</plex-button>
<plex-button type="success" label="Guardar"
<plex-button type="success" label="Guardar" [disabled]="profesionalExistente"
(click)="guardarAgendaPanel.guardarAgenda(agendasSeleccionadas[0])"></plex-button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class PanelAgendaComponent implements OnInit {
// Usados en tag <panel-agenda> en gestor-agendas.html
@Output() actualizarEstadoEmit = new EventEmitter<boolean>();
@Output() showVistaTurnosEmit = new EventEmitter<Boolean>();
@Output() profesionalExistente = new EventEmitter<Boolean>();

showEditarAgendaPanel: Boolean = true;
public showMapa = false;
Expand Down Expand Up @@ -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 = {
Expand All @@ -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
Expand All @@ -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);
}
});
}
}
Expand Down

0 comments on commit 2296fb9

Please sign in to comment.