Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat: #569 create users and users-list components
  • Loading branch information
PaulRC-ioet committed Nov 24, 2020
commit d34f7c0d492cd772409ff40c533778b15ff68e53
2 changes: 2 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ActivitiesManagementComponent } from './modules/activities-management/p
import { HomeComponent } from './modules/home/home.component';
import { LoginComponent } from './modules/login/login.component';
import { CustomerComponent } from './modules/customer-management/pages/customer.component';
import { UsersComponent } from './modules/users/pages/users.component';

const routes: Routes = [
{
Expand All @@ -22,6 +23,7 @@ const routes: Routes = [
{ path: 'time-entries', component: TimeEntriesComponent },
{ path: 'activities-management', component: ActivitiesManagementComponent },
{ path: 'customers-management', canActivate: [AdminGuard], component: CustomerComponent },
{ path: 'users', canActivate: [AdminGuard], component: UsersComponent },
{ path: '', pathMatch: 'full', redirectTo: 'time-clock' },
],
},
Expand Down
6 changes: 5 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ import { TimeRangeFormComponent } from './modules/reports/components/time-range-
import { TimeEntriesTableComponent } from './modules/reports/components/time-entries-table/time-entries-table.component';
import { DialogComponent } from './modules/shared/components/dialog/dialog.component';
import { LoadingBarComponent } from './modules/shared/components/loading-bar/loading-bar.component';
import { UsersComponent } from './modules/users/pages/users.component';
import { UsersListComponent } from './modules/users/components/users-list/users-list.component';

const maskConfig: Partial<IConfig> = {
validation: false,
Expand Down Expand Up @@ -115,7 +117,9 @@ const maskConfig: Partial<IConfig> = {
TimeRangeFormComponent,
TimeEntriesTableComponent,
DialogComponent,
LoadingBarComponent
LoadingBarComponent,
UsersComponent,
UsersListComponent
],
imports: [
NgxMaskModule.forRoot(maskConfig),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('SidebarComponent', () => {
component.getSidebarItems();
const menuItems = component.itemsSidebar;

expect(menuItems.length).toBe(5);
expect(menuItems.length).toBe(6);
});

it('non admin users have two menu items', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class SidebarComponent implements OnInit {
{route: '/reports', icon: 'fas fa-chart-pie', text: 'Reports', active: false},
{route: '/activities-management', icon: 'fas fa-file-alt', text: 'Activities', active: false},
{route: '/customers-management', icon: 'fas fa-user', text: 'Customers', active: false},
{route: '/users', icon: 'fas fa-user', text: 'Users', active: false},
];
} else {
this.itemsSidebar = [
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<table class="table table-sm table-bordered table-striped mb-0" datatable>
<thead class="thead-blue">
<tr class="d-flex">
<th class="col-3">User Email</th>
<th class="col-3">Names</th>
<th class="col-3">Role</th>
<th class="col-3 text-center">Options</th>
</tr>
</thead>
<tbody>
<tr class="d-flex">
<td class="col-sm-3">[email protected]</td>
<td class="col-sm-3">Paul Rocha</td>
<td class="col-sm-3">Intern</td>
<td class="col-sm-3 text-center">
<button type="button" class="btn btn-sm btn-primary">
<i class="fa fa-pencil fa-xs"></i>
</button>
<button type="button" class="btn btn-sm btn-danger ml-2">
<i class="fa fa-trash-alt fa-xs"></i>
</button>
</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { UsersListComponent } from './users-list.component';

describe('UsersListComponent', () => {
let component: UsersListComponent;
let fixture: ComponentFixture<UsersListComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UsersListComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(UsersListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-users-list',
templateUrl: './users-list.component.html',
styleUrls: ['./users-list.component.css']
})
export class UsersListComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}

}
Empty file.
3 changes: 3 additions & 0 deletions src/app/modules/users/pages/users.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="container">
<app-users-list></app-users-list>
</div>
25 changes: 25 additions & 0 deletions src/app/modules/users/pages/users.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { UsersComponent } from './users.component';

describe('UsersComponent', () => {
let component: UsersComponent;
let fixture: ComponentFixture<UsersComponent>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UsersComponent ]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(UsersComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions src/app/modules/users/pages/users.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';

@Component({
selector: 'app-users',
templateUrl: './users.component.html',
styleUrls: ['./users.component.css']
})
export class UsersComponent implements OnInit {

constructor() { }

ngOnInit(): void {
}

}