Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(TOP): permite anular solicitudes en estado auditoria #2014

Merged
merged 1 commit into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/app/components/top/pipes/botones.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ export class BotonesSolicitudPipe implements PipeTransform {
if (this.esEfectorDestino(prestacion)) {
if (prestacion.estadoActual.tipo === 'pendiente' && prestacion ?.paciente && !prestacion.solicitud.turno) {
botones.darTurno = true;
botones.anular = true;
}
if (prestacion.estadoActual.tipo === 'auditoria' || prestacion.estadoActual.tipo === 'rechazada') {
botones.auditar = true;
}
}
// Si es el mismo usuario que creó la solicitud
if (this.esUsuarioCreador(prestacion)) {
// Si está en estado pendiente o auditoria Y no tuvo movimientos después de crearse, se podrá anular
if ((prestacion.estadoActual.tipo === 'auditoria' || prestacion.estadoActual.tipo === 'pendiente')
&& prestacion.solicitud.historial.length === 1) {
botones.anular = true;
}
}
return botones;

}
Expand All @@ -40,4 +47,8 @@ export class BotonesSolicitudPipe implements PipeTransform {
return prestacion.solicitud.profesional?.id === this.auth.profesional;
}

esUsuarioCreador(prestacion) {
return this.auth.usuario.id === prestacion.createdBy.id;
}

}
3 changes: 2 additions & 1 deletion src/app/modules/rup/interfaces/prestacion.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export class IPrestacion {
// Registros de la solicitud ... para los planes o prestaciones futuras
registros: IPrestacionRegistro[],
organizacionDestino: any,
profesionalesDestino: any[]
profesionalesDestino: any[],
historial: any[]
};

// Datos de la ejecución (i.e. realización)
Expand Down