Feature: Create Employee Info Modal
All checks were successful
Quality Check / Linting (push) Successful in 25s

This commit is contained in:
Ole Kück 2025-01-22 10:50:29 +01:00
parent fd62dd02c4
commit e532d171c7
Signed by: SZUT-Ole
GPG key ID: 0A1DF1B37C4A1E4C
11 changed files with 67 additions and 13 deletions

View file

@ -6,7 +6,7 @@ import {
MatDialogContent, MatDialogContent,
MatDialogTitle MatDialogTitle
} from '@angular/material/dialog'; } from '@angular/material/dialog';
import DeleteModalData from '@app/delete-model/DeleteModalData'; import DeleteModalData from '@app/delete-modal/DeleteModalData';
@Component({ @Component({
selector: 'app-delete-model', selector: 'app-delete-model',
@ -17,10 +17,10 @@ import DeleteModalData from '@app/delete-model/DeleteModalData';
MatButton, MatButton,
MatDialogClose MatDialogClose
], ],
templateUrl: './delete-model.component.html', templateUrl: './delete-modal.component.html',
styleUrl: './delete-model.component.scss' styleUrl: './delete-modal.component.scss'
}) })
export class DeleteModelComponent { export class DeleteModalComponent {
constructor( constructor(
@Inject(MAT_DIALOG_DATA) protected data: DeleteModalData, @Inject(MAT_DIALOG_DATA) protected data: DeleteModalData,

View file

@ -0,0 +1,9 @@
<h2 mat-dialog-title>{{ data.firstName }} {{ data.lastName }}</h2>
<mat-dialog-content>
<p>Street: {{data.street}}</p>
<p>Location: {{data.postcode}} {{data.city}}</p>
<p>Phone: <a href="tel:{{data.phone}}">{{data.phone}}</a></p>
</mat-dialog-content>
<mat-dialog-actions class="info-modal">
<button mat-flat-button [mat-dialog-close]="false">Close</button>
</mat-dialog-actions>

View file

@ -0,0 +1,32 @@
import {Component, Inject} from '@angular/core';
import {MatButton} from '@angular/material/button';
import {
MAT_DIALOG_DATA,
MatDialogActions, MatDialogClose,
MatDialogContent,
MatDialogTitle
} from '@angular/material/dialog';
import {Employee} from '@core/ems';
@Component({
selector: 'app-delete-model',
imports: [
MatDialogContent,
MatDialogActions,
MatDialogTitle,
MatButton,
MatDialogClose
],
templateUrl: './info-modal.component.html',
styleUrl: './info-modal.component.scss'
})
export class InfoModalComponent {
constructor(
@Inject(MAT_DIALOG_DATA) protected data: Employee,
) {
}
}

View file

@ -46,6 +46,9 @@
<ng-container matColumnDef="actions"> <ng-container matColumnDef="actions">
<th mat-header-cell *matHeaderCellDef></th> <th mat-header-cell *matHeaderCellDef></th>
<td mat-cell *matCellDef="let employee"> <td mat-cell *matCellDef="let employee">
<button mat-mini-fab class="shadowless" (click)="onInfo(employee)">
<mat-icon>info</mat-icon>
</button>
<button mat-mini-fab class="shadowless" routerLink="employee/{{employee.id}}"> <button mat-mini-fab class="shadowless" routerLink="employee/{{employee.id}}">
<mat-icon>edit</mat-icon> <mat-icon>edit</mat-icon>
</button> </button>

View file

@ -35,7 +35,10 @@
} }
th.mat-column-actions { th.mat-column-actions {
width: calc(40px * 2 + 1rem); $action-count: 3;
$fap-size: 40px;
$gap-size: 1rem;
width: calc($fap-size * $action-count + $gap-size * ($action-count - 1));
} }
td.mat-column-actions { td.mat-column-actions {

View file

@ -9,7 +9,8 @@ import { MatInputModule } from '@angular/material/input';
import { MatSelectModule } from '@angular/material/select'; import { MatSelectModule } from '@angular/material/select';
import { MatTableDataSource, MatTableModule } from '@angular/material/table'; import { MatTableDataSource, MatTableModule } from '@angular/material/table';
import { RouterLink } from '@angular/router'; import { RouterLink } from '@angular/router';
import { DeleteModelComponent } from '@app/delete-model/delete-model.component'; import { DeleteModalComponent } from '@app/delete-modal/delete-modal.component';
import {InfoModalComponent} from '@app/info-modal/info-modal.component';
import Filter from '@app/views/dashboard/Filter'; import Filter from '@app/views/dashboard/Filter';
import { AuthService } from '@core/auth/auth.service'; import { AuthService } from '@core/auth/auth.service';
import { Employee, EmployeeService, Qualification, QualificationService } from '@core/ems'; import { Employee, EmployeeService, Qualification, QualificationService } from '@core/ems';
@ -74,8 +75,14 @@ export class DashboardComponent implements OnInit {
}); });
} }
onInfo(employee: Employee){
this.dialog.open(InfoModalComponent, {
data: employee
});
}
onDelete(employee: Employee) { onDelete(employee: Employee) {
const dialogRef = this.dialog.open(DeleteModelComponent, { const dialogRef = this.dialog.open(DeleteModalComponent, {
data: { data: {
title: `Delete ${employee.firstName} ${employee.lastName}`, title: `Delete ${employee.firstName} ${employee.lastName}`,
description: `Do you really want to delete ${employee.firstName} ${employee.lastName}?`, description: `Do you really want to delete ${employee.firstName} ${employee.lastName}?`,

View file

@ -7,7 +7,7 @@ import {MatIcon} from '@angular/material/icon';
import {MatInputModule} from '@angular/material/input'; import {MatInputModule} from '@angular/material/input';
import {MatSelectModule} from '@angular/material/select'; import {MatSelectModule} from '@angular/material/select';
import {MatTableDataSource, MatTableModule} from '@angular/material/table'; import {MatTableDataSource, MatTableModule} from '@angular/material/table';
import {DeleteModelComponent} from '@app/delete-model/delete-model.component'; import {DeleteModalComponent} from '@app/delete-modal/delete-modal.component';
import { import {
EmployeeQualifications, EmployeeQualifications,
EmployeeService, EmployeeService,
@ -124,7 +124,7 @@ export class QualificationsComponent {
} }
onDelete(qualification: Qualification) { onDelete(qualification: Qualification) {
const dialogRef = this.dialog.open(DeleteModelComponent, { const dialogRef = this.dialog.open(DeleteModalComponent, {
data: { data: {
title: `Delete ${qualification.skill}`, title: `Delete ${qualification.skill}`,
description: `Do you really want to delete ${qualification.skill}?`, description: `Do you really want to delete ${qualification.skill}?`,