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

IN - Implementa filtros de busqueda autoexpandibles #3027

Merged
merged 1 commit into from
Jul 30, 2024
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
Expand Up @@ -14,17 +14,23 @@
[data]="estadoList$ | async" (change)="filtrar()">
</plex-select>

<div collapse>
<plex-select name="tipo-cama" label="Tipo de Cama" [(ngModel)]="filtro.tipoCama" idField="conceptId"
labelField="term" (change)="filtrar()" [data]="tipoCamaList$ | async">
</plex-select>
<plex-select name="censable" label="Censable" [(ngModel)]="filtro.censable" (change)="filtrar()"
[data]="censables">
</plex-select>
<plex-select name="equipamiento" label="Equipamiento" [(ngModel)]="filtro.equipamiento" idField="conceptId"
labelField="term" (change)="filtrar()" [data]="equipamientoList$ | async" multiple="true"
grow="3">
</plex-select>
<plex-button class="collapse-button" type="primary" size="sm" icon="{{ collapse ? 'chevron-down' : 'chevron-up'}}"
title="{{ collapse ? 'Expandir' : 'Colapsar'}}" titlePosition="left" (click)="colapsar()">
</plex-button>

<div [hidden]="collapse" class="w-100">
<div class="d-flex">
<plex-select name="tipo-cama" label="Tipo de Cama" [(ngModel)]="filtro.tipoCama" idField="conceptId"
labelField="term" (change)="filtrar()" [data]="tipoCamaList$ | async">
</plex-select>
<plex-select name="censable" label="Censable" [(ngModel)]="filtro.censable" (change)="filtrar()"
[data]="censables">
</plex-select>
<plex-select name="equipamiento" label="Equipamiento" [(ngModel)]="filtro.equipamiento"
idField="conceptId" labelField="term" (change)="filtrar()"
[data]="equipamientoList$ | async" multiple="true" grow="3">
</plex-select>
</div>
</div>
</plex-wrapper>
</form>
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { arrayToSet } from '@andes/shared';
import { Component, OnInit } from '@angular/core';
import { Observable, combineLatest } from 'rxjs';
import { filter, map, tap } from 'rxjs/operators';
import { MapaCamasService } from '../../../services/mapa-camas.service';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { arrayToSet } from '@andes/shared';



@Component({
selector: 'app-filtros-camas',
templateUrl: './filtros-camas.component.html',
styleUrls: ['filtros-camas.scss']
})

export class FiltrosCamasComponent implements OnInit {
Expand All @@ -18,8 +19,8 @@ export class FiltrosCamasComponent implements OnInit {
public tipoCamaList$: Observable<any[]>;
public equipamientoList$: Observable<any[]>;
public estadoList$: Observable<any[]>;

public paciente = '';
public collapse = true;

filtro: any = {};
censables = [
Expand Down Expand Up @@ -51,8 +52,24 @@ export class FiltrosCamasComponent implements OnInit {
map((camas) => arrayToSet(camas, 'estado', (item) => item)),
map(estados => estados.map(e => ({ estado: e.estado })))
);

this.checkSeleccion();
}

checkSeleccion() {
const filtros = [this.mapaCamasService.tipoCamaSelected, this.mapaCamasService.esCensable, this.mapaCamasService.equipamientoSelected];

combineLatest(filtros).pipe(
filter(values => values.some(value => value !== null)),
tap(() => {
this.collapse = false;
})
).subscribe();
}

colapsar() {
this.collapse = !this.collapse;
}

filtrar() {
this.mapaCamasService.unidadOrganizativaSelected.next(this.filtro.unidadOrganizativa);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.collapse-button {
position: absolute;
top: 0;
right: 0;
}
Loading