-
Notifications
You must be signed in to change notification settings - Fork 5
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
[Workshop Admin/ Deputy] - personal cabinet functionality #1173 #1233
Changes from 24 commits
acb54cd
23fe589
fb355e6
9fff452
90bca96
4de70fc
ae3c984
4f597be
81bbd0b
5d34662
6b9ca24
43cefa7
a53ff65
9eb544d
c6f2a2a
16b7bec
aead610
22d8efa
738a3b3
805e653
745a115
939f5db
21977f4
06b50ae
d362808
a2f72a9
61b6afd
6f05bdc
bd45226
e071a7c
570d328
076ae20
d5ae7c9
44487c5
436d8cf
867743f
3b64a4c
b66f822
c0a7d23
3728674
4ef63ef
efbd35f
5c4615d
b8b2c74
fa32be1
a980842
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,40 @@ | ||
import { LiveAnnouncer } from '@angular/cdk/a11y'; | ||
import { AfterViewInit, Component, EventEmitter, Input, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; | ||
import { | ||
AfterViewInit, | ||
Component, | ||
EventEmitter, | ||
Input, | ||
OnInit, | ||
Output, | ||
SimpleChanges, | ||
ViewChild, | ||
} from '@angular/core'; | ||
import { MatSort, Sort } from '@angular/material/sort'; | ||
import { MatTableDataSource } from '@angular/material/table'; | ||
import { providerAdminRoleUkr, ProviderAdminTitles } from '../../enum/enumUA/provider-admin'; | ||
import { Select } from '@ngxs/store'; | ||
import { Observable } from 'rxjs'; | ||
import { Constants } from 'src/app/shared/constants/constants'; | ||
import { | ||
providerAdminRoleUkr, | ||
ProviderAdminTitles, | ||
} from '../../enum/enumUA/provider-admin'; | ||
|
||
import { Role } from '../../enum/role'; | ||
import { ProviderAdminIcons, ProviderAdminStatus } from '../../enum/provider-admin'; | ||
import { ProviderAdminTable } from '../../models/providerAdmin.model'; | ||
import { RegistrationState } from '../../store/registration.state'; | ||
|
||
/** | ||
* @title Table with sorting | ||
*/ | ||
@Component({ | ||
selector: 'app-users-list', | ||
templateUrl: './users-list.component.html', | ||
styleUrls: ['./users-list.component.scss'] | ||
styleUrls: ['./users-list.component.scss'], | ||
}) | ||
export class UsersListComponent implements OnInit, AfterViewInit { | ||
@Select(RegistrationState.subrole) | ||
subrole$: Observable<string>; | ||
|
||
@Input() users: Array<object>; | ||
@Input() filterValue: string; | ||
|
@@ -25,32 +45,35 @@ export class UsersListComponent implements OnInit, AfterViewInit { | |
readonly providerAdminTitles = ProviderAdminTitles; | ||
readonly providerAdminStatus = ProviderAdminStatus; | ||
readonly providerAdminIcons = ProviderAdminIcons; | ||
subrole: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add empty row between readonly and public values |
||
Role = Role; | ||
displayedColumns: string[]; | ||
dataSource: MatTableDataSource<object> = new MatTableDataSource([{}]); | ||
|
||
constructor(private _liveAnnouncer: LiveAnnouncer) {} | ||
|
||
@ViewChild(MatSort) sort: MatSort; | ||
|
||
ngOnInit(): void { | ||
this.displayedColumns = ['pib', 'email', 'phone', 'place', 'role', 'status', 'actions']; | ||
this.dataSource = new MatTableDataSource(this.users); | ||
ngOnInit(): void { | ||
this.subrole$.subscribe((subrole) => (this.subrole = subrole)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. takeUntil There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add typo There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. takeUntil |
||
this.displayedColumns = ['pib', 'email', 'phone', 'place', 'role', 'status', 'actions']; | ||
this.dataSource = new MatTableDataSource(this.users); | ||
} | ||
|
||
ngAfterViewInit() { | ||
this.dataSource.sort = this.sort; | ||
} | ||
|
||
ngOnChanges(changes: SimpleChanges) { | ||
if (changes.filterValue && changes.filterValue.currentValue) { | ||
let filter = changes.filterValue.currentValue; | ||
this.dataSource.filter = filter.trim().toLowerCase(); | ||
} else this.dataSource.filter = ""; | ||
if (changes.users && changes.users.currentValue) { | ||
const users = changes.users.currentValue; | ||
this.dataSource = new MatTableDataSource(users); | ||
} | ||
if (changes.filterValue && changes.filterValue.currentValue) { | ||
let filter = changes.filterValue.currentValue; | ||
this.dataSource.filter = filter.trim().toLowerCase(); | ||
} else this.dataSource.filter = ''; | ||
|
||
if (changes.users && changes.users.currentValue) { | ||
const users = changes.users.currentValue; | ||
this.dataSource = new MatTableDataSource(users); | ||
} | ||
} | ||
|
||
/** Announce the change in sort state for assistive technology. */ | ||
|
@@ -62,10 +85,10 @@ export class UsersListComponent implements OnInit, AfterViewInit { | |
} | ||
} | ||
|
||
onDelete(user: ProviderAdminTable): void { | ||
onDelete(user: ProviderAdminTable): void { | ||
this.deleteAdmin.emit(user); | ||
} | ||
|
||
onBlock(user: ProviderAdminTable): void { | ||
this.blockAdmin.emit(user); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,7 +148,7 @@ p { | |
row-gap: 1rem; | ||
} | ||
.hidden { | ||
display: none!important; | ||
display: none !important; | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add empty row between readonly and public values