add form to create employee
Reviewed-on: #18 Reviewed-by: Get in my car i have candy <huydw@proton.me>
This commit is contained in:
@ -17,6 +17,7 @@ import {MatSortModule} from '@angular/material/sort';
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import {DeleteComponent} from "../delete/delete.component";
|
||||
import EmployeeApiService from "../../services/employee-api.service";
|
||||
import {CreateComponent} from "../create/create.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-employee-list',
|
||||
@ -41,6 +42,7 @@ export class TableComponent implements OnInit{
|
||||
private readonly apiService: EmployeeApiService = inject(EmployeeApiService);
|
||||
private readonly snackBar: MatSnackBar = inject(MatSnackBar);
|
||||
private readonly deleteDialogue: MatDialog = inject(MatDialog);
|
||||
private readonly createEmployeeDialogue: MatDialog = inject(MatDialog);
|
||||
|
||||
private static readonly MAX_RETRIES = 3;
|
||||
public employees$: Observable<Employee[]> = of([]);
|
||||
@ -73,4 +75,12 @@ export class TableComponent implements OnInit{
|
||||
protected openDeleteDialogue(employee: Employee): void {
|
||||
this.deleteDialogue.open(DeleteComponent, {data: employee});
|
||||
}
|
||||
|
||||
protected showCreateEmployeeModal() {
|
||||
this.createEmployeeDialogue.open(CreateComponent)
|
||||
.afterClosed()
|
||||
.subscribe(() => {
|
||||
this.employees$ = this.fetchEmployees();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user