Skip to content

Commit b57a82a

Browse files
committed
Create emp added
1 parent 5a1b205 commit b57a82a

15 files changed

Lines changed: 150 additions & 136 deletions

File tree

Frontend/Angular/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ https://youtu.be/URhjOPOKvA8?si=R8CGEwVykQkWh7E9
1818
10. Create Component to get employee list ```ng g c employee-list```
1919
11. Create dummy data [employee-list.ts](ems-angular-frontend/src/app/employee-list/employee-list.ts)
2020
12. To create service `ng g s employee`
21+
13. To Create Add Component `ng g c add-employee`

Frontend/Angular/ems-angular-frontend/src/app/add-employee/add-employee.css

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<section className="get-in-touch">
2+
<h2>Add Employee</h2>
3+
<form class="contact-form row" (ngSubmit)="onSubmit()">
4+
<div class="form-field col-lg-6">
5+
<label class='form-lable'>First Name</label>
6+
<input type="text" id="firstName" name="firstName" ngModel="employee.firstName">
7+
</div>
8+
<div class="form-group">
9+
<label class='form-lable'>Last Name</label>
10+
<input type="text" id="lastName" name="lastName" ngModel="employee.lastName">
11+
</div>
12+
<div class="form-group">
13+
<label class='form-lable'>Email</label>
14+
<input type="text" id="email" name="email" ngModel="employee.email">
15+
</div>
16+
<h6> </h6>
17+
<button type="submit" class="btn btn-success" type="submit">Submit</button>
18+
</form>
19+
<h6> </h6>
20+
<button routerLink="/employees" class="btn btn-primary">Back</button>
21+
</section>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { AddEmployee } from './add-employee';
4+
5+
describe('AddEmployee', () => {
6+
let component: AddEmployee;
7+
let fixture: ComponentFixture<AddEmployee>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
imports: [AddEmployee]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(AddEmployee);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component).toBeTruthy();
22+
});
23+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { CommonModule } from '@angular/common';
2+
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
3+
import { Employee } from '../employee';
4+
import { RouterLink } from '@angular/router';
5+
6+
@Component({
7+
selector: 'app-add-employee',
8+
imports: [CommonModule, RouterLink],
9+
templateUrl: './add-employee.html',
10+
styleUrl: './add-employee.css',
11+
changeDetection: ChangeDetectionStrategy.OnPush
12+
})
13+
export class AddEmployee implements OnInit {
14+
15+
ngOnInit(): void {
16+
}
17+
18+
19+
employee: Employee = new Employee();
20+
21+
onSubmit() {
22+
throw new Error('Method not implemented.');
23+
}
24+
}
Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +0,0 @@
1-
#root {
2-
max-width: none;
3-
margin: 0 auto;
4-
padding: 2rem;
5-
text-align: center;
6-
}
7-
8-
.logo {
9-
height: 6em;
10-
padding: 1.5em;
11-
will-change: filter;
12-
transition: filter 300ms;
13-
}
14-
.logo:hover {
15-
filter: drop-shadow(0 0 2em #646cffaa);
16-
}
17-
.logo.react:hover {
18-
filter: drop-shadow(0 0 2em #61dafbaa);
19-
}
20-
21-
@keyframes logo-spin {
22-
from {
23-
transform: rotate(0deg);
24-
}
25-
to {
26-
transform: rotate(360deg);
27-
}
28-
}
29-
30-
@media (prefers-reduced-motion: no-preference) {
31-
a:nth-of-type(2) .logo {
32-
animation: logo-spin infinite 20s linear;
33-
}
34-
}
35-
36-
.card {
37-
padding: 2em;
38-
}
39-
40-
.read-the-docs {
41-
color: #888;
42-
}
Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
<!-- <h1 class="text-center"> {{title()}} </h1> -->
2-
<div>
3-
<header>
4-
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
5-
<a class="navbar-brand" href="#">Employee Management System</a>
6-
</nav>
7-
</header>
8-
</div>
9-
<!-- <div class="container"> -->
10-
<app-employee-list-dummy></app-employee-list-dummy>
11-
<router-outlet></router-outlet>
12-
<!-- <app-employee-list>
13-
</app-employee-list> -->
14-
<!-- </div> -->
15-
<div>
16-
<footer class='footer bg-light'>2025</footer>
17-
</div>
2+
<div>
3+
<header>
4+
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
5+
<a class="navbar-brand" href="#">Employee Management System</a>
6+
</nav>
7+
</header>
8+
</div>
9+
10+
<router-outlet></router-outlet>
11+
12+
<div>
13+
<footer class='footer bg-light'>2025</footer>
14+
</div>
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import { Routes } from '@angular/router';
22
import { EmployeeList } from './employee-list/employee-list';
3+
import { AddEmployee } from './add-employee/add-employee';
4+
import { EmployeeListDummy } from './employee-list-dummy/employee-list-dummy';
35

46
export const routes: Routes = [
57
{path: 'employees', component: EmployeeList},
6-
{path: '', redirectTo: 'employees', pathMatch: 'full'},
8+
{path: 'employees/add-employee', component: AddEmployee},
9+
{path: '', redirectTo: 'employees', pathMatch: 'full'}
710

811
];

Frontend/Angular/ems-angular-frontend/src/app/app.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { Component, signal } from '@angular/core';
22
import { RouterOutlet } from '@angular/router';
3-
import { EmployeeListDummy } from "./employee-list-dummy/employee-list-dummy";
43

54
@Component({
65
selector: 'app-root',
7-
imports: [RouterOutlet, EmployeeListDummy],
6+
imports: [RouterOutlet],
87
templateUrl: './app.html',
98
styleUrl: './app.css'
109
})
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
<h2> List of Employee From Dummy Data </h2>
2-
<!-- <button class="btn btn-success" onClick={addNewEmployee}>Add Employee</button> -->
3-
<h6> </h6>
4-
<table class='table table-striped table-bordered'>
5-
<thead>
6-
<tr>
1+
<h2> List of Employee From Dummy Data </h2>
2+
<button routerLink="add-employee" routerLinkActive="active" class="btn btn-success">Add Employee</button>
3+
<h6> </h6>
4+
<table class='table table-striped table-bordered'>
5+
<thead>
6+
<tr>
77
<th>Employee Id</th>
88
<th>First Name</th>
99
<th>Last Name</th>
1010
<th>Email</th>
1111
<!-- <th>Action</th> -->
12-
</tr>
13-
</thead>
14-
<tbody>
15-
@for (employee of employees; track employee.id) {
16-
<tr>
17-
<td>{{employee.id}}</td>
18-
<td>{{employee.firstName}}</td>
19-
<td>{{employee.lastName}}</td>
20-
<td>{{employee.email}}</td>
21-
<!-- <td> -->
22-
<!-- <button class='btn btn-warning px-4 me-3' onClick={() => updateEmployee(employee.id)}>Update </button> -->
23-
24-
<!-- <button class='btn btn-danger px-4' onClick={() => deleteEmployee(employee.id)}>Delete </button> -->
25-
<!-- </td> -->
26-
</tr>
27-
}
28-
</tbody>
29-
</table>
12+
</tr>
13+
</thead>
14+
<tbody>
15+
@for (employee of employees; track employee.id) {
16+
<tr>
17+
<td>{{employee.id}}</td>
18+
<td>{{employee.firstName}}</td>
19+
<td>{{employee.lastName}}</td>
20+
<td>{{employee.email}}</td>
21+
<!-- <td> -->
22+
<!-- <button class='btn btn-warning px-4 me-3' onClick={() => updateEmployee(employee.id)}>Update </button> -->
23+
24+
<!-- <button class='btn btn-danger px-4' onClick={() => deleteEmployee(employee.id)}>Delete </button> -->
25+
<!-- </td> -->
26+
</tr>
27+
}
28+
</tbody>
29+
</table>

0 commit comments

Comments
 (0)