-
-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add filter for lazy load expired events #1127
- Loading branch information
Showing
5 changed files
with
84 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 18 additions & 15 deletions
33
frontend-admin/src/app/dashboard/dashboard.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
<h1 translate="admin.dashboard.my-events"></h1> | ||
<button type="button" class="btn btn-primary"><svg-icon key="check" size="md"></svg-icon> Active</button> | ||
<button type="button" class="btn btn-outline-primary">Inactive</button> | ||
<h2>Active</h2> | ||
<ul> | ||
<li *ngFor="let ev of activeEvents$ | async"> | ||
{{ev.displayName}} {{ev.formattedBegin}} {{ev.formattedEnd}} | ||
</li> | ||
</ul> | ||
|
||
<h2>Expired</h2> | ||
<ul> | ||
<li *ngFor="let ev of expiredEvents$ | async"> | ||
{{ev.displayName}} {{ev.formattedBegin}} {{ev.formattedEnd}} | ||
</li> | ||
</ul> | ||
<app-filter-button text="Active" [checked]="activeFilter" (toggleFilter)="toggleActiveFilter($event)"></app-filter-button> | ||
<app-filter-button text="Inactive" [checked]="inactiveFilter" (toggleFilter)="toggleInactiveFilter($event)"></app-filter-button> | ||
<ng-container *ngIf="activeFilter"> | ||
<h2>Active</h2> | ||
<ul> | ||
<li *ngFor="let ev of activeEvents$ | async"> | ||
{{ev.displayName}} {{ev.formattedBegin}} {{ev.formattedEnd}} | ||
</li> | ||
</ul> | ||
</ng-container> | ||
<ng-container *ngIf="inactiveFilter"> | ||
<h2>Expired</h2> | ||
<ul> | ||
<li *ngFor="let ev of expiredEvents$ | async"> | ||
{{ev.displayName}} {{ev.formattedBegin}} {{ev.formattedEnd}} | ||
</li> | ||
</ul> | ||
</ng-container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
frontend-admin/src/app/shared/filter-button/filter-button.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { NgClass, NgIf } from '@angular/common'; | ||
import { Component, EventEmitter, Input, Output } from '@angular/core'; | ||
import { SvgIconComponent } from '@ngneat/svg-icon'; | ||
|
||
@Component({ | ||
standalone: true, | ||
imports: [SvgIconComponent, NgClass, NgIf], | ||
selector: 'app-filter-button', | ||
template: ` | ||
<button | ||
type="button" | ||
class="btn" | ||
style="border-radius: 20px" | ||
[ngClass]="{'btn-outline-primary': !checked, 'btn-primary': checked}" | ||
(click)="onClick()" | ||
> | ||
<svg-icon key="check" size="md" *ngIf="checked"></svg-icon> {{text}} | ||
</button>`, | ||
}) | ||
export class FilterButtonComponent { | ||
|
||
@Input() | ||
public text?: string; | ||
|
||
@Input() | ||
public checked: boolean = false; | ||
|
||
@Output() | ||
public toggleFilter = new EventEmitter<boolean>(); | ||
|
||
constructor() { } | ||
|
||
public onClick(): void { | ||
this.toggleFilter.emit(!this.checked); | ||
} | ||
} |