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

MPI - Fix error en búsqueda de pacientes auditoria #2003

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
8 changes: 4 additions & 4 deletions src/app/modules/auditoria/component/auditoria.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class AuditoriaComponent implements OnInit {
showCabeceraDetalle = false;
// busqueda
textoLibre: string = null;
resultadoBusqueda: IPaciente[] = null;
resultadoBusqueda: IPaciente[] = [];
pacienteSelected: IPaciente = null;
listaVinculados: IPaciente[] = [];
loading = false;
Expand Down Expand Up @@ -240,11 +240,13 @@ export class AuditoriaComponent implements OnInit {
this.searchSubscription.unsubscribe();
}

this.onSearchStart();
this.searchSubscription = this.pacienteService.getSearch(params).subscribe((resultado: any) => {
if (resultado && resultado.length) {
this.resultadoBusqueda = this.resultadoBusqueda.concat(resultado);
}
this.parametros.skip = resultado.length;
this.parametros.skip = this.resultadoBusqueda.length;
this.loading = false;
// si vienen menos pacientes que {{ limit }} significa que ya se cargaron todos
if (!resultado.length || resultado.length < this.parametros.limit) {
this.scrollEnd = true;
Expand All @@ -265,10 +267,8 @@ export class AuditoriaComponent implements OnInit {


onSearchStart() {
this.pacienteSelected = null;
this.searchClear = false;
this.loading = true;
this.closeSidebar();
}

onSearchClear() {
Expand Down
4 changes: 2 additions & 2 deletions src/app/modules/auditoria/component/auditoria.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
placeholder="Escriba un documento / apellido / nombre">
</plex-text>

<plex-loader *ngIf="loading"></plex-loader>
<plex-loader *ngIf="loading" type="ball-pulse"></plex-loader>

<auditoria-listado class="pb-4" *ngIf="resultadoBusqueda?.length" [pacientes]="resultadoBusqueda"
[autoselect]="false" (selected)="onSelect($event)" (link)="vincular($event)"
(showLinked)="showVinculados($event)" (setActive)="setEstadoActivo($event)"
(scrolled)="onScroll()">
</auditoria-listado>

<div *ngIf="!resultadoBusqueda?.length && !searchClear" class="alert alert-danger">
<div *ngIf="!loading && !resultadoBusqueda.length && !searchClear" class="alert alert-danger">
<i class="mdi mdi-account-alert"></i> No se encontró ningún paciente..
</div>
</plex-tab>
Expand Down