diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 07a3cbe..d55f7a0 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -3,9 +3,9 @@ import { RouterModule, Routes } from '@angular/router'; import { LoginComponent } from './user/components/login/login.component'; import { DashboardComponent } from './user/components/dashboard/dashboard.component'; import { MainPageComponent } from './user/components/dashboard/main-page/main-page.component'; -import { AddUserComponent } from './user/components/dashboard/add-user/add-user.component'; import { ManageAccountComponent } from './user/components/dashboard/manage-account/manage-account.component'; import { DataAnalysisComponent } from './graph/data-analysis/data-analysis.component'; +import { ManageUsersComponent } from './user/components/dashboard/manage-users/manage-users.component'; const routes: Routes = [ { path: 'login', component: LoginComponent, title: 'StarData | Login' }, @@ -20,9 +20,9 @@ const routes: Routes = [ title: 'StarData | Dashboard', }, { - path: 'add-user', - component: AddUserComponent, - title: 'StarData | Add User', + path: 'manage-users', + component: ManageUsersComponent, + title: 'StarData | Manage Users', }, { path: 'manage-account', diff --git a/src/app/user/components/dashboard/add-user/add-user.component.html b/src/app/user/components/dashboard/add-user/add-user.component.html index 836322d..4993141 100644 --- a/src/app/user/components/dashboard/add-user/add-user.component.html +++ b/src/app/user/components/dashboard/add-user/add-user.component.html @@ -1,4 +1,4 @@ - +
First Name @@ -12,7 +12,7 @@ Username - + Password - + Confirm Password @@ -40,6 +40,8 @@ Option 2 Option 3 - +
+ +
- +
diff --git a/src/app/user/components/dashboard/add-user/add-user.component.scss b/src/app/user/components/dashboard/add-user/add-user.component.scss index 7c4228d..d2ecc84 100644 --- a/src/app/user/components/dashboard/add-user/add-user.component.scss +++ b/src/app/user/components/dashboard/add-user/add-user.component.scss @@ -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); + } + } } } diff --git a/src/app/user/components/dashboard/dashboard.component.html b/src/app/user/components/dashboard/dashboard.component.html index 648b53e..6436348 100644 --- a/src/app/user/components/dashboard/dashboard.component.html +++ b/src/app/user/components/dashboard/dashboard.component.html @@ -29,11 +29,11 @@

StarData

- person_add - Add User + manage_accounts + Manage Users StarData [routerLink]="['manage-account']" routerLinkActive="active" > - manage_accounts + settings Manage Account diff --git a/src/app/user/components/dashboard/manage-users/manage-users.component.html b/src/app/user/components/dashboard/manage-users/manage-users.component.html new file mode 100644 index 0000000..014142c --- /dev/null +++ b/src/app/user/components/dashboard/manage-users/manage-users.component.html @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Username{{ element.userName }}Name + {{ element.firstName }} {{ element.lastName }} + Phone number{{ element.phoneNumber }}Email{{ element.email }}edit/delete + + +
+ + + +
diff --git a/src/app/user/components/dashboard/manage-users/manage-users.component.scss b/src/app/user/components/dashboard/manage-users/manage-users.component.scss new file mode 100644 index 0000000..c0c1072 --- /dev/null +++ b/src/app/user/components/dashboard/manage-users/manage-users.component.scss @@ -0,0 +1,9 @@ +.delete { + color: #f44336; +} +.edit { + color: #2196f3; +} +.add-user { + margin-block-end: 1rem; +} diff --git a/src/app/user/components/dashboard/manage-users/manage-users.component.spec.ts b/src/app/user/components/dashboard/manage-users/manage-users.component.spec.ts new file mode 100644 index 0000000..94a5f87 --- /dev/null +++ b/src/app/user/components/dashboard/manage-users/manage-users.component.spec.ts @@ -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; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ManageUsersComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(ManageUsersComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user/components/dashboard/manage-users/manage-users.component.ts b/src/app/user/components/dashboard/manage-users/manage-users.component.ts new file mode 100644 index 0000000..4b420d9 --- /dev/null +++ b/src/app/user/components/dashboard/manage-users/manage-users.component.ts @@ -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: 'mojerf@yahoo.com', + imgURL: null, + }, + { + guid: 'daw-awd-awd-awd', + userName: 'mamad-plus', + firstName: 'mamad', + lastName: 'mamadi', + phoneNumber: '09134456735', + email: 'mojerf@yahoo.com', + 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); + } +} diff --git a/src/app/user/interfaces/manage-users.interface.ts b/src/app/user/interfaces/manage-users.interface.ts new file mode 100644 index 0000000..79d3aa1 --- /dev/null +++ b/src/app/user/interfaces/manage-users.interface.ts @@ -0,0 +1,9 @@ +export interface ManageUser { + guid: string; + firstName: string; + lastName: string; + email: string; + phoneNumber: string; + userName: string; + imgURL: string | null; +} diff --git a/src/app/user/user.module.ts b/src/app/user/user.module.ts index 267b51d..273a553 100644 --- a/src/app/user/user.module.ts +++ b/src/app/user/user.module.ts @@ -18,6 +18,9 @@ import { SharedModule } from '../shared/shared.module'; import { AddUserComponent } from './components/dashboard/add-user/add-user.component'; import { MatRadioModule } from '@angular/material/radio'; import { ManageAccountComponent } from './components/dashboard/manage-account/manage-account.component'; +import { ManageUsersComponent } from './components/dashboard/manage-users/manage-users.component'; +import { MatTableModule } from '@angular/material/table'; +import { MatPaginatorModule } from '@angular/material/paginator'; @NgModule({ declarations: [ @@ -26,6 +29,7 @@ import { ManageAccountComponent } from './components/dashboard/manage-account/ma MainPageComponent, AddUserComponent, ManageAccountComponent, + ManageUsersComponent, ], imports: [ CommonModule, @@ -43,6 +47,8 @@ import { ManageAccountComponent } from './components/dashboard/manage-account/ma AppRoutingModule, SharedModule, MatRadioModule, + MatTableModule, + MatPaginatorModule, ], }) export class UserModule {} diff --git a/src/styles.scss b/src/styles.scss index 169b9c1..9c3e1f5 100644 --- a/src/styles.scss +++ b/src/styles.scss @@ -309,7 +309,7 @@ h2, --logo-filter: invert(75%); --content-background-color: #f9f9f9; - --card-background-color: #fff; + --card-background-color: #fdfbff; } [data-set="dark"] { @@ -336,6 +336,10 @@ h2, border-right: 0; border-left: 0; } -.mat-mdc-paginator { - background-color: white !important; +.mat-mdc-dialog-surface { + border-radius: 1rem !important; +} + +.mat-mdc-paginator-container { + justify-content: center !important; }