-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(manage-user): manage user page created
* feat(data-analysis): made the page * fix(data-analysis): added search form * fix(data-analysis): show graph and sidebar and fake data in data analysis page * fix(data-analysis): added font to the graph * fix(dashbaord): added logout button * fix(dashboard0: fix font path and logout link * feat(manage-user): manage user page added * fix(lint): fixed lint problem --------- Co-authored-by: aliyaghini <[email protected]>
- Loading branch information
1 parent
354c1db
commit c9fa607
Showing
11 changed files
with
223 additions
and
31 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
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
38 changes: 23 additions & 15 deletions
38
src/app/user/components/dashboard/add-user/add-user.component.scss
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,20 +1,28 @@ | ||
.add-user-form { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
.card { | ||
padding: 2rem; | ||
overflow: auto; | ||
max-height: 80vh; | ||
|
||
.radio-buttons { | ||
.add-user-form { | ||
display: flex; | ||
align-items: center; | ||
} | ||
flex-direction: column; | ||
gap: 0.5rem; | ||
|
||
.radio-buttons { | ||
display: flex; | ||
align-items: center; | ||
} | ||
.submit-button-container { | ||
padding-block-start: 1rem; | ||
|
||
> button { | ||
font-size: 1rem; | ||
width: 100%; | ||
height: 3.3rem; | ||
border-radius: 4rem; | ||
background-color: var(--button-background-color); | ||
color: var(--button-text-color); | ||
margin-block: 1.6rem; | ||
> button { | ||
font-size: 1rem; | ||
width: 100%; | ||
height: 3.3rem; | ||
border-radius: 0.5rem; | ||
background-color: var(--button-background-color); | ||
color: var(--button-text-color); | ||
} | ||
} | ||
} | ||
} |
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
58 changes: 58 additions & 0 deletions
58
src/app/user/components/dashboard/manage-users/manage-users.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 |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<app-card> | ||
<button mat-button class="add-user" (click)="addUser()"> | ||
<mat-icon>person_add</mat-icon>Add new user | ||
</button> | ||
<table mat-table [dataSource]="dataSource"> | ||
<ng-container matColumnDef="userName"> | ||
<th mat-header-cell *matHeaderCellDef>Username</th> | ||
<td mat-cell *matCellDef="let element">{{ element.userName }}</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="fullName"> | ||
<th mat-header-cell *matHeaderCellDef>Name</th> | ||
<td mat-cell *matCellDef="let element"> | ||
{{ element.firstName }} {{ element.lastName }} | ||
</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="phoneNumber"> | ||
<th mat-header-cell *matHeaderCellDef>Phone number</th> | ||
<td mat-cell *matCellDef="let element">{{ element.phoneNumber }}</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="email"> | ||
<th mat-header-cell *matHeaderCellDef>Email</th> | ||
<td mat-cell *matCellDef="let element">{{ element.email }}</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="edit/delete"> | ||
<th mat-header-cell *matHeaderCellDef>edit/delete</th> | ||
<td mat-cell *matCellDef="let element"> | ||
<button (click)="editUser(element.guid)"> | ||
<mat-icon class="edit">edit</mat-icon> | ||
</button> | ||
<button (click)="deleteUser(element.guid)"> | ||
<mat-icon class="delete">delete</mat-icon> | ||
</button> | ||
</td> | ||
</ng-container> | ||
|
||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> | ||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr> | ||
</table> | ||
|
||
<mat-paginator | ||
#paginator | ||
class="demo-paginator" | ||
(page)="handlePageEvent($event)" | ||
[length]="length" | ||
[pageSize]="pageSize" | ||
[disabled]="disabled" | ||
[showFirstLastButtons]="showFirstLastButtons" | ||
[pageSizeOptions]="showPageSizeOptions ? pageSizeOptions : []" | ||
[hidePageSize]="hidePageSize" | ||
[pageIndex]="pageIndex" | ||
aria-label="Select page" | ||
> | ||
</mat-paginator> | ||
</app-card> |
9 changes: 9 additions & 0 deletions
9
src/app/user/components/dashboard/manage-users/manage-users.component.scss
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,9 @@ | ||
.delete { | ||
color: #f44336; | ||
} | ||
.edit { | ||
color: #2196f3; | ||
} | ||
.add-user { | ||
margin-block-end: 1rem; | ||
} |
23 changes: 23 additions & 0 deletions
23
src/app/user/components/dashboard/manage-users/manage-users.component.spec.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,23 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
|
||
import { ManageUsersComponent } from './manage-users.component'; | ||
|
||
describe('ManageUsersComponent', () => { | ||
let component: ManageUsersComponent; | ||
let fixture: ComponentFixture<ManageUsersComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
declarations: [ManageUsersComponent] | ||
}) | ||
.compileComponents(); | ||
|
||
fixture = TestBed.createComponent(ManageUsersComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
73 changes: 73 additions & 0 deletions
73
src/app/user/components/dashboard/manage-users/manage-users.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,73 @@ | ||
import { Component } from '@angular/core'; | ||
import { ManageUser } from '../../../interfaces/manage-users.interface'; | ||
import { MatDialog } from '@angular/material/dialog'; | ||
import { AddUserComponent } from '../add-user/add-user.component'; | ||
import { PageEvent } from '@angular/material/paginator'; | ||
|
||
const ELEMENT_DATA: ManageUser[] = [ | ||
{ | ||
guid: 'daw-awd-awd-awd', | ||
userName: 'mamad-plus', | ||
firstName: 'mamad', | ||
lastName: 'mamadi', | ||
phoneNumber: '09134456735', | ||
email: '[email protected]', | ||
imgURL: null, | ||
}, | ||
{ | ||
guid: 'daw-awd-awd-awd', | ||
userName: 'mamad-plus', | ||
firstName: 'mamad', | ||
lastName: 'mamadi', | ||
phoneNumber: '09134456735', | ||
email: '[email protected]', | ||
imgURL: null, | ||
}, | ||
]; | ||
|
||
@Component({ | ||
selector: 'app-manage-users', | ||
templateUrl: './manage-users.component.html', | ||
styleUrl: './manage-users.component.scss', | ||
}) | ||
export class ManageUsersComponent { | ||
displayedColumns: string[] = [ | ||
'userName', | ||
'fullName', | ||
'phoneNumber', | ||
'email', | ||
'edit/delete', | ||
]; | ||
dataSource = ELEMENT_DATA; | ||
length = 50; | ||
pageSize = 10; | ||
pageIndex = 0; | ||
pageSizeOptions = [5, 10, 25]; | ||
|
||
hidePageSize = false; | ||
showPageSizeOptions = true; | ||
showFirstLastButtons = true; | ||
disabled = false; | ||
|
||
handlePageEvent(e: PageEvent) { | ||
this.length = e.length; | ||
this.pageSize = e.pageSize; | ||
this.pageIndex = e.pageIndex; | ||
} | ||
|
||
constructor(private readonly dialog: MatDialog) {} | ||
|
||
addUser() { | ||
this.dialog.open(AddUserComponent, { | ||
width: '105rem', | ||
}); | ||
} | ||
|
||
editUser(guid: string) { | ||
console.log(guid); | ||
} | ||
|
||
deleteUser(guid: string) { | ||
console.log(guid); | ||
} | ||
} |
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,9 @@ | ||
export interface ManageUser { | ||
guid: string; | ||
firstName: string; | ||
lastName: string; | ||
email: string; | ||
phoneNumber: string; | ||
userName: string; | ||
imgURL: string | null; | ||
} |
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