diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 74ac726c5..01eadf0ac 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -23,10 +23,10 @@ import { ModalComponent } from './components/shared/modal/modal.component'; import { MonthPickerComponent } from './components/shared/month-picker/month-picker.component'; import { EmptyStateComponent } from './components/shared/empty-state/empty-state.component'; import { GroupByDatePipe } from './components/shared/pipes/group-by-date/group-by-date.pipe'; -// tslint:disable-next-line:max-line-length +import { SearchProjectComponent } from './components/shared/search-project/search-project.component'; +import { FilterProjectPipe } from './components/shared/pipes/filter-project/filter-project.pipe'; import { ActivitiesManagementComponent } from './components/options-sidebar/activities/activities-management/activities-management.component'; - @NgModule({ declarations: [ AppComponent, @@ -46,6 +46,8 @@ import { ActivitiesManagementComponent } from './components/options-sidebar/acti MonthPickerComponent, EmptyStateComponent, GroupByDatePipe, + SearchProjectComponent, + FilterProjectPipe, ActivitiesManagementComponent, CreateActivityComponent, ActivityListComponent diff --git a/src/app/components/options-sidebar/activities/activities-management/activities-management.component.html b/src/app/components/options-sidebar/activities/activities-management/activities-management.component.html index 64f49bcc2..36d7ac8f9 100644 --- a/src/app/components/options-sidebar/activities/activities-management/activities-management.component.html +++ b/src/app/components/options-sidebar/activities/activities-management/activities-management.component.html @@ -1,7 +1,4 @@
- - - - - + +
\ No newline at end of file diff --git a/src/app/components/options-sidebar/activities/activity-list/activity-list.component.html b/src/app/components/options-sidebar/activities/activity-list/activity-list.component.html index 4d47b3500..bd15b7f1d 100644 --- a/src/app/components/options-sidebar/activities/activity-list/activity-list.component.html +++ b/src/app/components/options-sidebar/activities/activity-list/activity-list.component.html @@ -1,37 +1,35 @@
-
-
-
-
-
-

- - {{activity.name}} - -
- - -
-

-
- -
-
-
Description:
-

{{activity.description}}

-
-
- -
+
+
+
+
+
+

+ + {{activity.name}} + +
+ + +
+

+
+
+
+
Description:
+

{{activity.description}}

- -
-
-

There are no activities.

-
Please, create one.
-
-
-
+
+
+ +
+
+

There are no activities.

+
Please, create one.
+
+
+
+
\ No newline at end of file diff --git a/src/app/components/options-sidebar/activities/create-activity/create-activity.component.spec.ts b/src/app/components/options-sidebar/activities/create-activity/create-activity.component.spec.ts index 15cace0a6..6d87e39c0 100644 --- a/src/app/components/options-sidebar/activities/create-activity/create-activity.component.spec.ts +++ b/src/app/components/options-sidebar/activities/create-activity/create-activity.component.spec.ts @@ -18,5 +18,4 @@ describe('CreateActivityComponent', () => { it('should create the component', () => { expect(component).toBeTruthy(); }); - }); diff --git a/src/app/components/options-sidebar/project-management/project-management.component.html b/src/app/components/options-sidebar/project-management/project-management.component.html index bc3f14b30..0a2459df9 100644 --- a/src/app/components/options-sidebar/project-management/project-management.component.html +++ b/src/app/components/options-sidebar/project-management/project-management.component.html @@ -1,17 +1,9 @@
- - + - + -
- +
\ No newline at end of file diff --git a/src/app/components/options-sidebar/project-management/project-management.component.spec.ts b/src/app/components/options-sidebar/project-management/project-management.component.spec.ts index 642bcb2fa..795db934b 100644 --- a/src/app/components/options-sidebar/project-management/project-management.component.spec.ts +++ b/src/app/components/options-sidebar/project-management/project-management.component.spec.ts @@ -7,6 +7,7 @@ import { ProjectService } from '../../../services/project.service'; import { of } from 'rxjs'; import { CreateProjectComponent } from '../../../components/shared/create-project/create-project.component'; import { ProjectListComponent } from '../../../components/shared/project-list/project-list.component'; +import { FilterProjectPipe } from 'src/app/components/shared/pipes/filter-project/filter-project.pipe'; describe('ProjectManagementComponent', () => { let component: ProjectManagementComponent; @@ -45,7 +46,7 @@ describe('ProjectManagementComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ProjectManagementComponent, CreateProjectComponent, ProjectListComponent ], + declarations: [ ProjectManagementComponent, CreateProjectComponent, ProjectListComponent, FilterProjectPipe ], providers: [ { provide: ProjectService, useValue: projectServiceStub }], imports: [ FormsModule, diff --git a/src/app/components/options-sidebar/reports/reports.component.html b/src/app/components/options-sidebar/reports/reports.component.html index c779010be..eb65621b2 100644 --- a/src/app/components/options-sidebar/reports/reports.component.html +++ b/src/app/components/options-sidebar/reports/reports.component.html @@ -1,5 +1,3 @@
- -

reports works!

- +

reports works!

\ No newline at end of file diff --git a/src/app/components/options-sidebar/time-clock/time-clock.component.html b/src/app/components/options-sidebar/time-clock/time-clock.component.html index b7dfb02f9..916ff4081 100644 --- a/src/app/components/options-sidebar/time-clock/time-clock.component.html +++ b/src/app/components/options-sidebar/time-clock/time-clock.component.html @@ -1,9 +1,4 @@ -
- - - +
@@ -15,39 +10,38 @@
-
-

{{ username }} clocked in at {{ hour | number: '2.0-2' }}:{{ minute | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}

-

{{ username }} clocked out at {{ hour | number: '2.0-2' }}:{{ minute | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}

+

{{ username }} clocked in at + {{ hour | number: '2.0-2' }}:{{ minute | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}

+

{{ username }} clocked out at + {{ hour | number: '2.0-2' }}:{{ minute | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}

Totals

Current
-

{{ hour | number: '2.0-2' }}:{{ minute | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}

+

+ {{ hourCounterRealTime | number: '2.0-2' }}:{{ minuteCounterRealTime | number: '2.0-2' }}:{{ secondsCounterRealTime | number: '2.0-2' }} +

Day
-

4:22

+

00:00

Week
-

14:00

+

00:00

Projects
-
-
- -
-

Top


-
+
@@ -63,20 +57,27 @@
Projects
- + + +
+
Technology field is required. Enter this + field to clock out.
+

-
+
-
+
-
+
\ No newline at end of file diff --git a/src/app/components/options-sidebar/time-clock/time-clock.component.spec.ts b/src/app/components/options-sidebar/time-clock/time-clock.component.spec.ts index 829383ef8..89171fb44 100644 --- a/src/app/components/options-sidebar/time-clock/time-clock.component.spec.ts +++ b/src/app/components/options-sidebar/time-clock/time-clock.component.spec.ts @@ -3,6 +3,7 @@ import { By } from '@angular/platform-browser'; import { DebugElement, Component } from '@angular/core'; import { TimeClockComponent } from './time-clock.component'; import { ProjectListHoverComponent } from '../../shared/project-list-hover/project-list-hover.component'; +import { FilterProjectPipe } from 'src/app/components/shared/pipes/filter-project/filter-project.pipe'; describe('TimeClockComponent', () => { let component: TimeClockComponent; @@ -11,7 +12,7 @@ describe('TimeClockComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [TimeClockComponent, ProjectListHoverComponent] + declarations: [TimeClockComponent, ProjectListHoverComponent, FilterProjectPipe] }).compileComponents(); })); @@ -197,6 +198,13 @@ describe('TimeClockComponent', () => { expect(component.secondsCounterRealTime).not.toEqual(0); }); + it('inside timer first if' , () => { + component.secondsCounterRealTime = component.secondsCounterRealTime + 58; + component.timer(); + expect(component.minuteCounterRealTime).toEqual(1); + expect(component.secondsCounterRealTime).toEqual(0); + }); + /* ---------------------- ARRIVALS ------------------------------------- */ it('should execute intern methods of arrivals' , () => { const currentDate = new Date(); diff --git a/src/app/components/options-sidebar/time-clock/time-clock.component.ts b/src/app/components/options-sidebar/time-clock/time-clock.component.ts index 50c7e40ba..34c68fb43 100644 --- a/src/app/components/options-sidebar/time-clock/time-clock.component.ts +++ b/src/app/components/options-sidebar/time-clock/time-clock.component.ts @@ -6,7 +6,7 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./time-clock.component.scss'] }) -export class TimeClockComponent implements OnInit { +export class TimeClockComponent implements OnInit { projects = [ { id: 'P1', name: 'Project 1' }, @@ -43,65 +43,65 @@ export class TimeClockComponent implements OnInit { this.hour = 0; this.minute = 0; this.seconds = 0; - } - - employeClockIn(): boolean { - this.isClockInEnable = true; - this.isClockIn = !this.isClockIn; - this.isHidenForm = false; - this.startTimer(); - this.setArrivalAndDepartureTimes(); - return this.isClockIn; - } - - employeClockOut() { - if ( this.isEnterTechnology === false ) { - this.isClockIn = false; - this.showAlertEnterTecnology = true; - } else { - this.setDefaultValuesToFields(); - this.pauseTimer(); - this.setArrivalAndDepartureTimes(); - } - } - - enterTechnology(data: string) { - if ( data.length > 0 ) { + } + + employeClockIn(): boolean { + this.isClockInEnable = true; + this.isClockIn = !this.isClockIn; + this.isHidenForm = false; + this.startTimer(); + this.setArrivalAndDepartureTimes(); + return this.isClockIn; + } + + employeClockOut() { + if (this.isEnterTechnology === false) { + this.isClockIn = false; + this.showAlertEnterTecnology = true; + } else { + this.setDefaultValuesToFields(); + this.pauseTimer(); + this.setArrivalAndDepartureTimes(); + } + } + + enterTechnology(data: string) { + if (data.length > 0) { this.isEnterTechnology = true; - } else { - this.isEnterTechnology = false; - } - } - - setShowFields(show: boolean) { - this.isHidenForm = false; - if ( this.isClockInEnable !== true ) { + } else { + this.isEnterTechnology = false; + } + } + + setShowFields(show: boolean) { + this.isHidenForm = false; + if (this.isClockInEnable !== true) { this.isClockIn = false; this.showFields = show; - if ( !this.execOnlyOneTimeCounter ) { + if (!this.execOnlyOneTimeCounter) { this.startTimer(); this.execOnlyOneTimeCounter = true; } this.setArrivalAndDepartureTimes(); - } + } } startTimer() { this.interval = setInterval(() => { - this.timer(); - }, 1000 ); - } + this.timer(); + }, 1000); + } - pauseTimer() { - clearInterval(this.interval); - } + pauseTimer() { + clearInterval(this.interval); + } - timer() { + timer() { this.secondsCounterRealTime += 1; - if ( this.secondsCounterRealTime === 59 ) { + if (this.secondsCounterRealTime === 59) { this.minuteCounterRealTime += 1; this.secondsCounterRealTime = 0; - if ( this.minuteCounterRealTime === 59 ) { + if (this.minuteCounterRealTime === 59) { this.hourCounterRealTime += 1; this.minuteCounterRealTime = 0; } @@ -109,7 +109,7 @@ export class TimeClockComponent implements OnInit { } setArrivalAndDepartureTimes() { - if ( !this.execOnlyOneTimeClockIn ) { + if (!this.execOnlyOneTimeClockIn) { this.currentDate = new Date(); this.hour = this.currentDate.getHours(); this.minute = this.currentDate.getMinutes(); diff --git a/src/app/components/options-sidebar/time-entries/time-entries.component.html b/src/app/components/options-sidebar/time-entries/time-entries.component.html index 401cb29e0..881812752 100644 --- a/src/app/components/options-sidebar/time-entries/time-entries.component.html +++ b/src/app/components/options-sidebar/time-entries/time-entries.component.html @@ -19,7 +19,6 @@
-
@@ -56,11 +55,12 @@
- + \ No newline at end of file diff --git a/src/app/components/shared/clock/clock.component.html b/src/app/components/shared/clock/clock.component.html index 1a4412038..9ae08dd37 100644 --- a/src/app/components/shared/clock/clock.component.html +++ b/src/app/components/shared/clock/clock.component.html @@ -1,8 +1,8 @@
-
- -
-
-

{{ hour | number: '2.0-2' }}:{{ minutes | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}

-
+
+ +
+
+

{{ hour | number: '2.0-2' }}:{{ minutes | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}

+
\ No newline at end of file diff --git a/src/app/components/shared/clock/clock.component.spec.ts b/src/app/components/shared/clock/clock.component.spec.ts index 22f10997f..d6f7a06b7 100644 --- a/src/app/components/shared/clock/clock.component.spec.ts +++ b/src/app/components/shared/clock/clock.component.spec.ts @@ -45,4 +45,18 @@ describe('ClockComponent', () => { expect(component.showClock).toHaveBeenCalled(); }); + it('should be verify the init state of vars' , () => { + expect(component.hour).toEqual(0); + expect(component.minutes).toEqual(0); + expect(component.seconds).toEqual(0); + expect(component.displayTime).toBeFalsy(); + }); + + it('should enter if and assign the value to vars' , () => { + component.showClock(); + expect(component.hour).toEqual(0); + expect(component.minutes).toEqual(0); + expect(component.seconds).toEqual(0); + }); + }); diff --git a/src/app/components/shared/clock/clock.component.ts b/src/app/components/shared/clock/clock.component.ts index ac956ae05..3bdbe970f 100644 --- a/src/app/components/shared/clock/clock.component.ts +++ b/src/app/components/shared/clock/clock.component.ts @@ -17,6 +17,9 @@ export class ClockComponent implements OnInit { constructor() { this.showClock(); this.displayTime = false; + this.hour = 0; + this.minutes = 0; + this.seconds = 0; setTimeout(() => { this.displayTime = true; }, 3000); diff --git a/src/app/components/shared/create-project/create-project.component.html b/src/app/components/shared/create-project/create-project.component.html index f6d9e9fd3..2fed6b515 100644 --- a/src/app/components/shared/create-project/create-project.component.html +++ b/src/app/components/shared/create-project/create-project.component.html @@ -5,13 +5,16 @@

Project

-

Name Project is required.

+

Name + Project is required.

-

Details Project is required.

+

Details Project is + required.

@@ -19,7 +22,9 @@

Project

-

Status Project is required.

+

Status Project is required. +

@@ -35,4 +40,4 @@

Project

-
+ \ No newline at end of file diff --git a/src/app/components/shared/pipes/filter-project/filter-project.pipe.spec.ts b/src/app/components/shared/pipes/filter-project/filter-project.pipe.spec.ts new file mode 100644 index 000000000..9b14140dc --- /dev/null +++ b/src/app/components/shared/pipes/filter-project/filter-project.pipe.spec.ts @@ -0,0 +1,14 @@ +import { FilterProjectPipe } from './filter-project.pipe'; +import { Project } from '../../../../interfaces/project'; + +describe('FilterProjectPipe', () => { + it('create an instance', () => { + const pipe = new FilterProjectPipe(); + expect(pipe).toBeTruthy(); + }); + + it('test method of pipe', () => { + expect(new FilterProjectPipe().transform([] , '')).toEqual([]); + }); + +}); diff --git a/src/app/components/shared/pipes/filter-project/filter-project.pipe.ts b/src/app/components/shared/pipes/filter-project/filter-project.pipe.ts new file mode 100644 index 000000000..4bf0bc50f --- /dev/null +++ b/src/app/components/shared/pipes/filter-project/filter-project.pipe.ts @@ -0,0 +1,20 @@ +import { Pipe, PipeTransform } from '@angular/core'; +import { Project } from 'src/app/interfaces'; + +@Pipe({ + name: 'filterProject' +}) +export class FilterProjectPipe implements PipeTransform { + + transform(value: Project[] = [], arg: string): string[] { + + const restultProjects = []; + // tslint:disable-next-line: prefer-for-of + for ( let i = 0; i < value.length; i++ ) { + if ( value[i].name.toLowerCase().indexOf(arg.toLowerCase()) > -1 ) { + restultProjects.push(value[i]); + } + } + return restultProjects; + } +} diff --git a/src/app/components/shared/project-list-hover/project-list-hover.component.html b/src/app/components/shared/project-list-hover/project-list-hover.component.html index 212bf4d2d..dbd6deb4c 100644 --- a/src/app/components/shared/project-list-hover/project-list-hover.component.html +++ b/src/app/components/shared/project-list-hover/project-list-hover.component.html @@ -1,17 +1,9 @@ + + \ No newline at end of file diff --git a/src/app/components/shared/project-list-hover/project-list-hover.component.spec.ts b/src/app/components/shared/project-list-hover/project-list-hover.component.spec.ts index 85024d03a..e2b281570 100644 --- a/src/app/components/shared/project-list-hover/project-list-hover.component.spec.ts +++ b/src/app/components/shared/project-list-hover/project-list-hover.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from "@angular/core/testing"; import { ProjectListHoverComponent } from "./project-list-hover.component"; +import { FilterProjectPipe } from 'src/app/components/shared/pipes/filter-project/filter-project.pipe'; describe("ProjectListHoverComponent", () => { let component: ProjectListHoverComponent; @@ -8,7 +9,7 @@ describe("ProjectListHoverComponent", () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ProjectListHoverComponent] + declarations: [ProjectListHoverComponent, FilterProjectPipe] }).compileComponents(); })); diff --git a/src/app/components/shared/project-list-hover/project-list-hover.component.ts b/src/app/components/shared/project-list-hover/project-list-hover.component.ts index f3626d6da..cfa431e51 100644 --- a/src/app/components/shared/project-list-hover/project-list-hover.component.ts +++ b/src/app/components/shared/project-list-hover/project-list-hover.component.ts @@ -11,6 +11,7 @@ export class ProjectListHoverComponent implements OnInit { selectedId: string; showButton: number; + filterProjects = ''; constructor() { this.showButton = -1; diff --git a/src/app/components/shared/project-list/project-list.component.html b/src/app/components/shared/project-list/project-list.component.html index c7935adec..ad0d1eaa6 100644 --- a/src/app/components/shared/project-list/project-list.component.html +++ b/src/app/components/shared/project-list/project-list.component.html @@ -1,20 +1,25 @@
+

Project List

+
+ +
-
+
-
Details:
@@ -39,8 +44,6 @@
Please, create one.
- + \ No newline at end of file diff --git a/src/app/components/shared/project-list/project-list.component.spec.ts b/src/app/components/shared/project-list/project-list.component.spec.ts index 71168eb8a..8d4bcf075 100644 --- a/src/app/components/shared/project-list/project-list.component.spec.ts +++ b/src/app/components/shared/project-list/project-list.component.spec.ts @@ -1,6 +1,7 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ProjectListComponent } from './project-list.component'; +import { FilterProjectPipe } from 'src/app/components/shared/pipes/filter-project/filter-project.pipe'; describe('ProjectListComponent', () => { let component: ProjectListComponent; @@ -8,7 +9,7 @@ describe('ProjectListComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ProjectListComponent ] + declarations: [ ProjectListComponent, FilterProjectPipe ] }) .compileComponents(); })); diff --git a/src/app/components/shared/project-list/project-list.component.ts b/src/app/components/shared/project-list/project-list.component.ts index 2a9289f78..f8e762882 100644 --- a/src/app/components/shared/project-list/project-list.component.ts +++ b/src/app/components/shared/project-list/project-list.component.ts @@ -13,11 +13,12 @@ export class ProjectListComponent implements OnInit { @Input() projects: Project[] = []; @Output() editProject = new EventEmitter(); @Output() deleteProject = new EventEmitter(); + filterProjects = ''; projectToDelete: Project; openDeleteModal: Boolean = false; - constructor() { } + constructor() {} ngOnInit(): void { } diff --git a/src/app/components/shared/search-project/search-project.component.css b/src/app/components/shared/search-project/search-project.component.css new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/components/shared/search-project/search-project.component.html b/src/app/components/shared/search-project/search-project.component.html new file mode 100644 index 000000000..6938243dd --- /dev/null +++ b/src/app/components/shared/search-project/search-project.component.html @@ -0,0 +1,5 @@ +
+ +
\ No newline at end of file diff --git a/src/app/components/shared/search-project/search-project.component.spec.ts b/src/app/components/shared/search-project/search-project.component.spec.ts new file mode 100644 index 000000000..47e1e021f --- /dev/null +++ b/src/app/components/shared/search-project/search-project.component.spec.ts @@ -0,0 +1,32 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SearchProjectComponent } from './search-project.component'; + +describe('SearchProjectComponent', () => { + let component: SearchProjectComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SearchProjectComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SearchProjectComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('called method' , () => { + component.changeFilterProject.emit('angular'); + component.filterProject = 'angular'; + component.changeFilterValue(); + expect(component.filterProject).toEqual('angular'); + }); +}); diff --git a/src/app/components/shared/search-project/search-project.component.ts b/src/app/components/shared/search-project/search-project.component.ts new file mode 100644 index 000000000..eb114bc41 --- /dev/null +++ b/src/app/components/shared/search-project/search-project.component.ts @@ -0,0 +1,21 @@ +import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; + +@Component({ + selector: 'app-search-project', + templateUrl: './search-project.component.html', + styleUrls: ['./search-project.component.css'] +}) +export class SearchProjectComponent implements OnInit { + + filterProject: string; + @Output() changeFilterProject = new EventEmitter(); + + constructor() { } + + ngOnInit(): void { + } + + changeFilterValue() { + this.changeFilterProject.emit( this.filterProject ); + } +} diff --git a/src/app/components/shared/sidebar/sidebar.component.html b/src/app/components/shared/sidebar/sidebar.component.html index 2c0ffab3a..db7cf7344 100644 --- a/src/app/components/shared/sidebar/sidebar.component.html +++ b/src/app/components/shared/sidebar/sidebar.component.html @@ -1,21 +1,26 @@
- - - + \ No newline at end of file