From 3bffc414ecc08a24c302331409aeb205bebb4a36 Mon Sep 17 00:00:00 2001 From: Rajbir Singh Date: Tue, 14 Jan 2025 11:45:13 +0100 Subject: [PATCH] Feature: Dashboard - layout, style --- .../views/dashboard/dashboard.component.html | 66 +++++++++++++++++-- .../views/dashboard/dashboard.component.scss | 49 ++++++++++++++ .../views/dashboard/dashboard.component.ts | 42 ++++++++---- 3 files changed, 141 insertions(+), 16 deletions(-) diff --git a/src/app/views/dashboard/dashboard.component.html b/src/app/views/dashboard/dashboard.component.html index cbd75c0..f2a8445 100644 --- a/src/app/views/dashboard/dashboard.component.html +++ b/src/app/views/dashboard/dashboard.component.html @@ -1,4 +1,62 @@ -New Employee -Edit Employee 3 - - +
+ @if (auth.$user|async; as user) { +
+ + Search + + + + Qualification + + @for (skill of ($qualifications|async); track skill) { + {{skill.skill}} + } + + + + +
+ + + + Id + {{ employee.id }} + + + First Name + {{ employee.firstName }} + + + Last Name + {{ employee.lastName }} + + + Skills + +
    + @for (skill of employee.skillSet; track skill) { +
  • {{ skill.skill }}
  • + } +
+ +
+ + + + + + + + + +
+ } @else { +

Log in to see more!

+ } +
diff --git a/src/app/views/dashboard/dashboard.component.scss b/src/app/views/dashboard/dashboard.component.scss index e69de29..2fefe01 100644 --- a/src/app/views/dashboard/dashboard.component.scss +++ b/src/app/views/dashboard/dashboard.component.scss @@ -0,0 +1,49 @@ +.dashboard { + display: flex; + flex-direction: column; + gap: 1rem; + + &__action-row { + display: flex; + gap: 1rem; + + :first-child { + flex-grow: 1; + } + } + + &__employees { + width: 100%; + + tr { + display: flex; + width: 100%; + + .mat-column-id{ + width: 4rem; + } + + .mat-column-first-name, .mat-column-last-name, .mat-column-skills { + width: 0; + flex-grow: 1; + } + + ul{ + margin: 0; + } + + th.mat-column-actions{ + width: calc(40px * 2 + 1rem); + } + + td.mat-column-actions{ + gap: 1rem; + display: flex; + padding: 0; + padding-top: 0.25rem; + align-items: start; + } + + } + } +} \ No newline at end of file diff --git a/src/app/views/dashboard/dashboard.component.ts b/src/app/views/dashboard/dashboard.component.ts index a021d25..98b8a57 100644 --- a/src/app/views/dashboard/dashboard.component.ts +++ b/src/app/views/dashboard/dashboard.component.ts @@ -1,20 +1,38 @@ -import { Component } from '@angular/core'; -import { MatButtonModule } from '@angular/material/button'; -import { RouterLink } from '@angular/router'; -import { NotificationService, NotificationType } from '@core/notification/notification.service'; +import {AsyncPipe} from '@angular/common'; +import {Component} from '@angular/core'; +import {ReactiveFormsModule} from '@angular/forms'; +import {MatButtonModule} from '@angular/material/button'; +import {MatFormFieldModule} from '@angular/material/form-field'; +import {MatIcon} from '@angular/material/icon'; +import {MatInputModule} from '@angular/material/input'; +import {MatSelectModule} from '@angular/material/select'; +import {MatTableDataSource, MatTableModule} from '@angular/material/table'; +import {RouterLink} from '@angular/router'; +import {AuthService} from '@core/auth/auth.service'; +import {Employee, EmployeeService, Qualification, QualificationService} from '@core/ems'; +import {Observable} from 'rxjs'; @Component({ selector: 'app-dashboard', - imports: [MatButtonModule, RouterLink], + imports: [MatButtonModule, MatSelectModule, MatFormFieldModule, MatTableModule, ReactiveFormsModule, MatInputModule, MatIcon, RouterLink, AsyncPipe], templateUrl: './dashboard.component.html', styleUrl: './dashboard.component.scss' }) export class DashboardComponent { - constructor(private notifications: NotificationService) { } - testInfo() { - this.notifications.publish('Cake', NotificationType.Information); - } - testError() { - this.notifications.publish('Cake', NotificationType.Error); - }} + employeeDataSource: MatTableDataSource = new MatTableDataSource([]); + employeesDisplayedColumns = ['id', 'first-name', 'last-name', 'skills', 'actions']; + $qualifications: Observable | undefined>; + + constructor( + protected auth: AuthService, + private employeeService: EmployeeService, + private qualificationService: QualificationService + ) { + this.$qualifications= this.qualificationService.getAllQualifications(); + this.employeeService.getAllEmployees().subscribe((employees) => { + this.employeeDataSource = new MatTableDataSource(employees); + + }); + } +}