Skip to content

Commit

Permalink
fix(CITAS): visualizacion de turnos agenda dinamica (#2711)
Browse files Browse the repository at this point in the history
  • Loading branch information
palita1991 authored and MarianoCampetella committed Feb 24, 2023
1 parent 6ab6b90 commit 72f00ab
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export class PermisosMapaCamasService {
public censo = false;
public descargarListado = false;
public registros = false;
indicacionesVer;
indicacionesCrear;
indicacionesEjecutar;
indicacionesValidar;

constructor(
private auth: Auth,
) { }
Expand All @@ -43,6 +48,10 @@ export class PermisosMapaCamasService {
this.bloqueo = this.auth.check(`${this.ambito}:bloqueo`);
this.censo = this.auth.check(`${this.ambito}:censo`);
this.descargarListado = this.auth.check(`${this.ambito}:descargarListado`);
this.indicacionesVer = this.auth.check(`${this.ambito}:indicaciones`);
this.indicacionesCrear = this.auth.check(`${this.ambito}:indicaciones:create`);
this.indicacionesEjecutar = this.auth.check(`${this.ambito}:indicaciones:ejecutar`);
this.indicacionesValidar = this.auth.check(`${this.ambito}:indicaciones:validar`);
this.registros = this.auth.check('internacion:registros');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ export class CamaDetalleComponent implements OnInit {
public titleColor;
public tabIndex = 0;
public editar = false;
public permisoIngreso = false;
canUndo = false;
pacienteFields = ['sexo', 'fechaNacimiento', 'edad', 'cuil', 'financiador', 'numeroAfiliado', 'direccion', 'telefono'];
public nota: String;
public editNota = false;
Expand Down Expand Up @@ -106,10 +104,10 @@ export class CamaDetalleComponent implements OnInit {
switchMap(cama => cama.paciente ? this.mapaCamasService.getPaciente(cama.paciente) : of(null))
);

this.turnero$ = combineLatest(
this.turnero$ = combineLatest([
this.cama$,
this.mapaCamasService.maquinaDeEstado$
).pipe(
]).pipe(
map(([cama, estado]) => {
if (cama.idInternacion) {
const turnero = estado.turnero || {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
<section *ngIf="capa !== 'interconsultores'" class="item-indicacion">
<div class="item__container"></div>
<div class="item__botonera">
<plex-button *ngIf="detener$ | async" type="danger" icon="stop" size="sm"
(click)="onDetenerClick()" tooltip="Suspender"
tooltipPosition="bottom">
<plex-button *ngIf="permisosMapaCamasService.indicacionesEjecutar && detener$ | async"
type="danger" icon="stop" size="sm" (click)="onDetenerClick()"
tooltip="Suspender" tooltipPosition="bottom">
</plex-button>
<plex-button *ngIf="continuar$ | async" type="success" icon="play" size="sm"
(click)="onContinuarClick()" tooltip="Continuar"
tooltipPosition="bottom">
</plex-button>

<plex-dropdown *ngIf="borradores.length" right="true" size="sm"
label="Validar borradores" type="warning">
<plex-dropdown *ngIf="hayDraft && permisosMapaCamasService.indicacionesEjecutar && borradores.length"
right="true" size="sm" label="Validar borradores" type="warning">
<plex-button label="Seleccionadas" type="link"
[disabled]="!soloBorradoresSeleccionados"
(click)="onValidar(true)">
Expand Down Expand Up @@ -57,7 +57,8 @@
<h6 class="item__title">{{ seccion.concepto.term }}</h6>
</div>
<div class="item__botonera">
<plex-button *ngIf="isToday() && puedeCrear" size="sm" type="info" icon="plus"
<plex-button *ngIf="isToday && permisosMapaCamasService.indicacionesCrear"
size="sm" type="info" icon="plus"
(click)="onNuevaIndicacion(seccion)" tooltip="Agregar indicación">
</plex-button>
<plex-button type="info" size="sm"
Expand Down Expand Up @@ -153,12 +154,12 @@ <h3>
<!-- Botones de aceptacion / rechazo -->
<ng-container *ngIf="!indicacion.estado.verificacion">
<ng-container *ngIf="capa === 'interconsultores'">
<plex-button type="success" size="sm" icon="check" tooltip="Aceptar"
[autodisable]="true"
<plex-button type="success" size="sm" icon="check"
tooltip="Aceptar" [autodisable]="true"
(click)="onVerificar(indicacion, true)">
</plex-button>
<plex-button type="danger" size="sm" icon="close" tooltip="Rechazar"
[autodisable]="true"
<plex-button type="danger" size="sm" icon="close"
tooltip="Rechazar" [autodisable]="true"
(click)="onVerificar(indicacion, false)">
</plex-button>
</ng-container>
Expand All @@ -170,7 +171,7 @@ <h3>
</ng-container>
</ng-container>

<div *ngIf="!indicacionEventoSelected && !nuevaIndicacion && !indicacion.readonly"
<div *ngIf="permisosMapaCamasService.indicacionesEjecutar && !indicacionEventoSelected && !nuevaIndicacion && !indicacion.readonly"
in-plan-indicacion-botonera [indicacion]="indicacion"
(refresh)="actualizar()"
(cancelIndicacion)="cancelIndicacion($event)">
Expand Down Expand Up @@ -210,8 +211,9 @@ <h3>

<ng-container *ngIf="indicacionView">
<in-indicacion-detalle [indicacion]="indicacionView">
<plex-button *ngIf="puedeEditar && indicacionView.estado.tipo !== 'cancelled' && indicacionView.estado.tipo !== 'active'" class="mr-1"
type="warning" size="sm" icon="pencil" tooltip="Editar" (click)="editar(indicacionView)">
<plex-button *ngIf="puedeEditar && indicacionView.estado.tipo !== 'cancelled' && indicacionView.estado.tipo !== 'active'"
class="mr-1" type="warning" size="sm" icon="pencil" tooltip="Editar"
(click)="editar(indicacionView)">
</plex-button>
<plex-button type="danger" size="sm" icon="close" tooltip="Cerrar" (click)="onClose()">
</plex-button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ChangeDetectorRef, Component, OnInit, ViewEncapsulation } from '@angula
import { ActivatedRoute, Router } from '@angular/router';
import { BehaviorSubject, forkJoin, Observable } from 'rxjs';
import { map, tap, switchMap } from 'rxjs/operators';
import { PermisosMapaCamasService } from '../../services/permisos-mapa-camas.service';
import { HeaderPacienteComponent } from 'src/app/components/paciente/headerPaciente.component';
import { PacienteService } from 'src/app/core/mpi/services/paciente.service';
import { RupEjecucionService } from 'src/app/modules/rup/services/ejecucion.service';
Expand Down Expand Up @@ -32,7 +33,7 @@ export class PlanIndicacionesComponent implements OnInit {
public hoy;
public suspenderAnterior = false;
public indicacionAnterior;
public horas ;
public horas;
public indicaciones = [];
public selectedIndicacion = {};
public loading = false;
Expand Down Expand Up @@ -95,6 +96,7 @@ export class PlanIndicacionesComponent implements OnInit {
}

constructor(
public permisosMapaCamasService: PermisosMapaCamasService,
private prestacionService: PrestacionesService,
private route: ActivatedRoute,
private resumenInternacionService: InternacionResumenHTTP,
Expand All @@ -116,11 +118,11 @@ export class PlanIndicacionesComponent implements OnInit {
ngOnInit() {
this.organizacionService.configuracion(this.auth.organizacion.id).pipe(
tap(config => {
this.horaOrganizacion=config.planIndicaciones.horaInicio;
this.horas=this.getHorariosGrilla();
this.horaOrganizacion = config.planIndicaciones.horaInicio;
this.horas = this.getHorariosGrilla();
})
).subscribe();
this.hoy=moment();
this.hoy = moment();
this.capa = this.route.snapshot.paramMap.get('capa');
this.ambito = this.route.snapshot.paramMap.get('ambito');
this.idInternacion = this.route.snapshot.paramMap.get('idInternacion');
Expand Down Expand Up @@ -199,7 +201,7 @@ export class PlanIndicacionesComponent implements OnInit {
const eventosMap = {};
// filtramos eventos por fecha y hora segun tablero
const comienzoTablero = moment(this.fecha).hours(this.horaOrganizacion);
const finTablero = moment(this.fecha).add(1, 'days').hours(this.horaOrganizacion-1);
const finTablero = moment(this.fecha).add(1, 'days').hours(this.horaOrganizacion - 1);
eventos = eventos.filter(ev => moment(ev.fecha).isBetween(comienzoTablero, finTablero, 'hour', '[]'));
eventos.forEach(evento => {
eventosMap[evento.idIndicacion] = eventosMap[evento.idIndicacion] || {};
Expand Down Expand Up @@ -458,14 +460,14 @@ export class PlanIndicacionesComponent implements OnInit {
}

getHorariosGrilla() {
const res=[];
const horaIncio= this.horaOrganizacion;
const res = [];
const horaIncio = this.horaOrganizacion;
res.push(horaIncio);
let horas = horaIncio+1;
while (horas!==horaIncio ) {
let horas = horaIncio + 1;
while (horas !== horaIncio) {
res.push(horas);
horas++;
if (horas===24) {
if (horas === 24) {
horas = 0;
}
}
Expand Down

0 comments on commit 72f00ab

Please sign in to comment.