Adiciona filtro de notificações lidas
This commit is contained in:
parent
5b825b6a9a
commit
173d8570c9
|
|
@ -31,6 +31,14 @@
|
|||
>
|
||||
Vencidas
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="filter-btn neutral"
|
||||
[class.active]="filter === 'lidas'"
|
||||
(click)="setFilter('lidas')"
|
||||
>
|
||||
Lidas
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,12 @@
|
|||
background: rgba(239, 68, 68, 0.12);
|
||||
color: #b91c1c;
|
||||
}
|
||||
|
||||
&.neutral.active {
|
||||
border-color: rgba(15, 23, 42, 0.35);
|
||||
background: rgba(15, 23, 42, 0.08);
|
||||
color: #0f172a;
|
||||
}
|
||||
}
|
||||
|
||||
.state {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import { NotificationsService, NotificationDto } from '../../services/notificati
|
|||
})
|
||||
export class Notificacoes implements OnInit {
|
||||
notifications: NotificationDto[] = [];
|
||||
filter: 'todas' | 'vencidas' | 'aVencer' = 'todas';
|
||||
filter: 'todas' | 'vencidas' | 'aVencer' | 'lidas' = 'todas';
|
||||
loading = false;
|
||||
error = false;
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ export class Notificacoes implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
setFilter(value: 'todas' | 'vencidas' | 'aVencer') {
|
||||
setFilter(value: 'todas' | 'vencidas' | 'aVencer' | 'lidas') {
|
||||
this.filter = value;
|
||||
}
|
||||
|
||||
|
|
@ -43,6 +43,9 @@ export class Notificacoes implements OnInit {
|
|||
if (this.filter === 'aVencer') {
|
||||
return this.notifications.filter(n => n.tipo === 'AVencer');
|
||||
}
|
||||
if (this.filter === 'lidas') {
|
||||
return this.notifications.filter(n => n.lida);
|
||||
}
|
||||
return this.notifications;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue