Skip to content

Commit

Permalink
TOP - Solicitudes contrarreferidas
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio-Ramirez authored and negro89 committed Feb 14, 2024
1 parent a23e23f commit 12a2969
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions modules/rup/routes/prestacion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ router.patch('/prestaciones/:id', (req: Request, res, next) => {
break;
case 'estadoPush':
if (req.body.estado) {
// SI LA SALICITUD FUE ANULADA NO SE PUEDE REALIZAR OTRA OPERACION
// SI LA SOLICITUD FUE ANULADA NO SE PUEDE REALIZAR OTRA OPERACION
if (data.estadoActual.tipo === 'anulada') {
return next('Prestación anulada, no se puede modificar su estado.');
}
Expand All @@ -602,6 +602,9 @@ router.patch('/prestaciones/:id', (req: Request, res, next) => {
return res.json(prestacion);
}
}
if (req.body.estado.tipo === 'rechazada') {
data.solicitud.organizacion = req.body.organizacion;
}
data.estados.push(req.body.estado);
if (req.body.estado.tipo === 'asignada') {
if (req.body.profesional) {
Expand All @@ -614,20 +617,18 @@ router.patch('/prestaciones/:id', (req: Request, res, next) => {
if (req.body.registros) {
data.ejecucion.registros = req.body.registros;
}
if (req.body.ejecucion && req.body.ejecucion.fecha) {
if (req.body.ejecucion?.fecha) {
data.ejecucion.fecha = req.body.ejecucion.fecha;
}
if (req.body.ejecucion && req.body.ejecucion.organizacion) {
if (req.body.ejecucion?.organizacion) {
data.ejecucion.organizacion = req.body.ejecucion.organizacion;
}
if (req.body.prioridad) {
data.solicitud.registros[0].valor.solicitudPrestacion.prioridad = req.body.prioridad;
data.solicitud.registros[0].markModified('valor');
}
if (req.body.solicitud) {
if (req.body.solicitud.tipoPrestacion) {
data.solicitud.tipoPrestacion = req.body.solicitud.tipoPrestacion;
}
if (req.body.solicitud?.tipoPrestacion) {
data.solicitud.tipoPrestacion = req.body.solicitud.tipoPrestacion;
}

break;
Expand Down Expand Up @@ -683,7 +684,7 @@ router.patch('/prestaciones/:id', (req: Request, res, next) => {

case 'referir':
if (req.body.estado) {
data.estados.push();
data.estados.push({ tipo: 'auditoria', fecha: new Date() });
}
data.solicitud.profesional = req.body.profesional;
data.solicitud.organizacion = req.body.organizacion;
Expand Down

0 comments on commit 12a2969

Please sign in to comment.