Skip to content

Commit 5c0497c

Browse files
committed
feat: #569 create users and users-list components
1 parent 1b8bfd1 commit 5c0497c

File tree

12 files changed

+117
-2
lines changed

12 files changed

+117
-2
lines changed

src/app/app-routing.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ActivitiesManagementComponent } from './modules/activities-management/p
1010
import { HomeComponent } from './modules/home/home.component';
1111
import { LoginComponent } from './modules/login/login.component';
1212
import { CustomerComponent } from './modules/customer-management/pages/customer.component';
13+
import { UsersComponent } from './modules/users/pages/users.component';
1314

1415
const routes: Routes = [
1516
{
@@ -22,6 +23,7 @@ const routes: Routes = [
2223
{ path: 'time-entries', component: TimeEntriesComponent },
2324
{ path: 'activities-management', component: ActivitiesManagementComponent },
2425
{ path: 'customers-management', canActivate: [AdminGuard], component: CustomerComponent },
26+
{ path: 'users', canActivate: [AdminGuard], component: UsersComponent },
2527
{ path: '', pathMatch: 'full', redirectTo: 'time-clock' },
2628
],
2729
},

src/app/app.module.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ import { TimeRangeFormComponent } from './modules/reports/components/time-range-
6868
import { TimeEntriesTableComponent } from './modules/reports/components/time-entries-table/time-entries-table.component';
6969
import { DialogComponent } from './modules/shared/components/dialog/dialog.component';
7070
import { LoadingBarComponent } from './modules/shared/components/loading-bar/loading-bar.component';
71+
import { UsersComponent } from './modules/users/pages/users.component';
72+
import { UsersListComponent } from './modules/users/components/users-list/users-list.component';
7173

7274
const maskConfig: Partial<IConfig> = {
7375
validation: false,
@@ -115,7 +117,9 @@ const maskConfig: Partial<IConfig> = {
115117
TimeRangeFormComponent,
116118
TimeEntriesTableComponent,
117119
DialogComponent,
118-
LoadingBarComponent
120+
LoadingBarComponent,
121+
UsersComponent,
122+
UsersListComponent
119123
],
120124
imports: [
121125
NgxMaskModule.forRoot(maskConfig),

src/app/modules/shared/components/sidebar/sidebar.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ describe('SidebarComponent', () => {
5656
component.getSidebarItems();
5757
const menuItems = component.itemsSidebar;
5858

59-
expect(menuItems.length).toBe(5);
59+
expect(menuItems.length).toBe(6);
6060
});
6161

6262
it('non admin users have two menu items', () => {

src/app/modules/shared/components/sidebar/sidebar.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export class SidebarComponent implements OnInit {
4545
{route: '/reports', icon: 'fas fa-chart-pie', text: 'Reports', active: false},
4646
{route: '/activities-management', icon: 'fas fa-file-alt', text: 'Activities', active: false},
4747
{route: '/customers-management', icon: 'fas fa-user', text: 'Customers', active: false},
48+
{route: '/users', icon: 'fas fa-user', text: 'Users', active: false},
4849
];
4950
} else {
5051
this.itemsSidebar = [

src/app/modules/users/components/users-list/users-list.component.css

Whitespace-only changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<table class="table table-sm table-bordered table-striped mb-0" datatable>
2+
<thead class="thead-blue">
3+
<tr class="d-flex">
4+
<th class="col-3">User Email</th>
5+
<th class="col-3">Names</th>
6+
<th class="col-3">Role</th>
7+
<th class="col-3 text-center">Options</th>
8+
</tr>
9+
</thead>
10+
<tbody>
11+
<tr class="d-flex">
12+
<td class="col-sm-3">[email protected]</td>
13+
<td class="col-sm-3">Paul Rocha</td>
14+
<td class="col-sm-3">Intern</td>
15+
<td class="col-sm-3 text-center">
16+
<button type="button" class="btn btn-sm btn-primary">
17+
<i class="fa fa-pencil fa-xs"></i>
18+
</button>
19+
<button type="button" class="btn btn-sm btn-danger ml-2">
20+
<i class="fa fa-trash-alt fa-xs"></i>
21+
</button>
22+
</td>
23+
</tr>
24+
</tbody>
25+
</table>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { UsersListComponent } from './users-list.component';
4+
5+
describe('UsersListComponent', () => {
6+
let component: UsersListComponent;
7+
let fixture: ComponentFixture<UsersListComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ UsersListComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(UsersListComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-users-list',
5+
templateUrl: './users-list.component.html',
6+
styleUrls: ['./users-list.component.css']
7+
})
8+
export class UsersListComponent implements OnInit {
9+
10+
constructor() { }
11+
12+
ngOnInit(): void {
13+
}
14+
15+
}

src/app/modules/users/pages/users.component.css

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="container">
2+
<app-users-list></app-users-list>
3+
</div>

0 commit comments

Comments
 (0)