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

GDU: mostrar en detalle si el profesional esta matriculado #2474

Merged
merged 1 commit into from
Sep 29, 2021
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit, Input, OnChanges, SimpleChange } from '@angular/core';
import { Component, Input, OnChanges, SimpleChange } from '@angular/core';
import { IUsuario } from '../../interfaces/IUsuario';
import { ProfesionalService } from '../../../../services/profesional.service';
import { Observable, BehaviorSubject } from 'rxjs';
Expand All @@ -15,7 +15,7 @@ function elementAt(index = 0) {
styleUrls: ['usuario-detalle.scss']
})

export class UsuarioDetalleComponent implements OnInit, OnChanges {
export class UsuarioDetalleComponent implements OnChanges {
private usuario$ = new BehaviorSubject<IUsuario>(null);
public profesional$: Observable<IProfesional>;
@Input() usuario: IUsuario;
Expand All @@ -40,11 +40,8 @@ export class UsuarioDetalleComponent implements OnInit, OnChanges {
getProfesional(user) {
return this.profesionalService.get({
documento: user.usuario,
fields: 'nombre'
fields: 'id documento nombre apellido profesionalMatriculado formacionGrado'
});
}

ngOnInit() {

}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
<plex-detail>
<img class="img-user" *ngIf="!usuario.foto" />
<img *ngIf="usuario.foto" src="{{ usuario.foto }}" />

<plex-badge type="success" *ngIf="(profesional$ | async) as profesional">
<plex-badge [type]="profesional.profesionalMatriculado ? 'info' : 'warning'"
*ngIf="(profesional$ | async) as profesional;else notProfesional">
Profesional
<span dato>{{profesional.formacionGrado.length > 0 ?
profesional.formacionGrado[0].profesion.nombre + ': MATRÍCULA N° '
+ profesional.formacionGrado[0].matriculacion[profesional.formacionGrado[0].matriculacion.length -
1].matriculaNumero:'NO MATRICULADO'}}</span>

</plex-badge>
<ng-template #notProfesional>
<plex-badge type="default">
No profesional
</plex-badge>
</ng-template>

<div title>
{{ usuario.nombre }} {{ usuario.apellido }}
Expand All @@ -14,4 +24,4 @@
<plex-copy *ngIf="usuario.documento" [value]="usuario.documento">{{ usuario.documento | number }}</plex-copy>
</div>

</plex-detail>
</plex-detail>
37 changes: 34 additions & 3 deletions src/app/interfaces/IProfesional.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IUbicacion} from './IUbicacion';
import { IMatricula} from './IMatricula';
import { IUbicacion } from './IUbicacion';
import { IMatricula } from './IMatricula';
import { Sexo, Genero, EstadoCivil, tipoComunicacion } from './../utils/enumerados';

export interface IProfesional {
Expand Down Expand Up @@ -44,7 +44,38 @@ export interface IProfesional {
fechaInicio: Date;
fechaVencimiento: Date;
activo: Boolean;

}];
formacionGrado: [{
exportadoSisa?: Boolean;
profesion: {
nombre: string;
codigo: number;
tipoDeFormacion: String;
};
entidadFormadora: {
nombre: string;
codigo: number;
};
titulo: string;
fechaEgreso: Date;
fechaTitulo: Date;
renovacion: boolean;
papelesVerificados: boolean;
matriculacion?: [{
matriculaNumero: Number;
libro: String;
folio: String;
inicio: Date;
baja: {
motivo: String;
fecha: any;
};
notificacionVencimiento: Boolean;
fin: Date;
revalidacionNumero: Number;
}];
matriculado: boolean;
fechaDeInscripcion?: Date;
}];
profesionalMatriculado: Boolean;
}
4 changes: 3 additions & 1 deletion src/app/services/profesional.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export class ProfesionalService {
* @param {any} params Opciones de búsqueda
*/
get(params: any): Observable<IProfesional[]> {
params['fields'] = 'id documento nombre apellido';
if (!params['fields']) {
params['fields'] = 'id documento nombre apellido';
}
return this.server.get(this.profesionalUrl, { params: params, showError: true });
}

Expand Down