diff --git a/src/app/app.component.html b/src/app/app.component.html index 052547bb32..7403ec9ac5 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -56,19 +56,33 @@ NO POSEE MATRICULA - - {{ vencimientoAlta(item.fechasDeAltas[item.fechasDeAltas?.length-1]?.fecha) | date: + + {{ vencimientoAlta(item.matriculacion[item.matriculacion?.length-1]?.fechaAlta) | date: 'dd/MM/yyyy' }} - {{ - item.matriculacion[item.matriculacion.length-1].fin | date: + {{ + item.matriculacion[item.matriculacion.length-1].periodos[item.matriculacion[item.matriculacion.length-1].periodos.length-1].fin + | date: 'dd/MM/yyyy'}} - VIGENTE - VENCIDA + VIGENTE + + + VENCIDA + + + + SUSPENDIDA + + + + SIN VENCIMIENTO + diff --git a/src/app/app.component.ts b/src/app/app.component.ts index d14a056189..dec99fb0e8 100755 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -122,8 +122,8 @@ export class AppComponent { if (this.auth.profesional) { this.profesionalService.getByID(this.auth.profesional).pipe( switchMap((profesional: IProfesional) => { - if (profesional) { - this.profesional = profesional; + this.profesional = profesional; + if (this.profesional) { this.profesional.formacionGrado?.forEach(item => { item['estado'] = this.verificarEstado(item); }); @@ -264,14 +264,23 @@ export class AppComponent { return nuevaFecha; } - esVigente(formacionPosgrado) { - const fechaUltimaAlta = new Date(formacionPosgrado.fechasDeAltas[formacionPosgrado.fechasDeAltas.length - 1].fecha); - fechaUltimaAlta.setFullYear(fechaUltimaAlta.getFullYear() + 5); - if (fechaUltimaAlta < this.hoy) { - if (new Date(formacionPosgrado.matriculacion[formacionPosgrado.matriculacion.length - 1].fin) < this.hoy) { - return false; + verificarFecha(formacionPosgrado) { + if (formacionPosgrado?.matriculacion?.length) { + if (!formacionPosgrado.matriculado) { + return 'suspendida'; + } else { + if (!formacionPosgrado.tieneVencimiento) { + return 'sinVencimiento'; + } else { + const ultMat = formacionPosgrado.matriculacion.length - 1; + const ultPer = formacionPosgrado.matriculacion[ultMat].periodos.length - 1; + if (this.hoy > formacionPosgrado.matriculacion[ultMat].periodos[ultPer].fin) { + return 'vencida'; + } else { + return 'vigente'; + } + } } } - return true; } }