Skip to content

Commit

Permalink
fix(TOP): se marca la solicitud seleccionada
Browse files Browse the repository at this point in the history
  • Loading branch information
maring0019 committed May 5, 2023
1 parent adef54a commit dfb6d89
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/app/components/top/solicitudes/solicitudes.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Auth } from '@andes/auth';
import { Plex } from '@andes/plex';
import { PlexModalComponent } from '@andes/plex/src/lib/modal/modal.component';
import { Unsubscribe } from '@andes/shared';
import { Component, HostBinding, OnInit, ViewChild } from '@angular/core';
import { Component, HostBinding, Input, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router';
import { concat } from 'rxjs';
import { PacienteService } from 'src/app/core/mpi/services/paciente.service';
Expand Down Expand Up @@ -55,6 +55,7 @@ export class SolicitudesComponent implements OnInit {
public prestacionesDestino = [];
public estado;
public asignadas = false;
public prestacionSelected;
itemsDropdown: any = []; // Acciones del dropdown 'vincular
openedDropDown = null;

Expand Down Expand Up @@ -137,6 +138,12 @@ export class SolicitudesComponent implements OnInit {
},
];

// Permite :hover y click()
@Input() selectable = true;

// Muestra efecto de selección
@Input() selected = false;

constructor(
public auth: Auth,
private plex: Plex,
Expand Down Expand Up @@ -273,6 +280,10 @@ export class SolicitudesComponent implements OnInit {
}

seleccionar(prestacion) {
if (prestacion) {
this.prestacionSelected = prestacion;
}

if (this.seleccionado && this.seleccionado.id === prestacion.id) {
this.seleccionado = null;
} else {
Expand Down
7 changes: 5 additions & 2 deletions src/app/components/top/solicitudes/solicitudes.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@
(scroll)="onScroll()" [offset]="collapse?252:180" height="60vh">
<plex-table-columns>
</plex-table-columns>
<tr *ngFor="let prestacion of prestacionesEntrada; let i=index" (click)="seleccionar(prestacion)">
<tr *ngFor="let prestacion of prestacionesEntrada; let i=index" (click)="seleccionar(prestacion)"
[class.selected]="prestacion?.id===prestacionSelected?.id" [class.selectable]="selectable">
<td *plTableCol="'fecha'">
<plex-label>
<shared-popover-audit class="mt-3" placement="right" [data]="prestacion"
Expand Down Expand Up @@ -242,7 +243,9 @@
(scroll)="onScroll()" [offset]="collapse?252:180" height="60vh">
<plex-table-columns>
</plex-table-columns>
<tr *ngFor="let prestacion of prestacionesSalida; let i=index" (click)="seleccionar(prestacion)">
<tr *ngFor="let prestacion of prestacionesSalida; let i=index" (click)="seleccionar(prestacion)"
[class.selected]="prestacion?.id===prestacionSelected?.id" [class.selectable]="selectable">

<!-- FECHA -->
<td *plTableCol="'fecha'">
<plex-label [tituloBold]="true" titulo="Registrada el {{prestacion.createdAt | fecha}}"
Expand Down

0 comments on commit dfb6d89

Please sign in to comment.