diff --git a/src/app/modules/activities-management/components/activity-list/activity-list.component.spec.ts b/src/app/modules/activities-management/components/activity-list/activity-list.component.spec.ts
index 9ad71df66..5985db7fd 100644
--- a/src/app/modules/activities-management/components/activity-list/activity-list.component.spec.ts
+++ b/src/app/modules/activities-management/components/activity-list/activity-list.component.spec.ts
@@ -1,8 +1,9 @@
import { provideMockStore, MockStore } from '@ngrx/store/testing';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { allActivities } from './../../store/activity-management.selectors';
import { ActivityState } from './../../store/activity-management.reducers';
-import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { DeleteActivity, SetActivityToEdit } from './../../store/activity-management.actions';
import { ActivityListComponent } from './activity-list.component';
describe('ActivityListComponent', () => {
@@ -47,6 +48,22 @@ describe('ActivityListComponent', () => {
expect(store.dispatch).toHaveBeenCalled();
});
+ it('deleteActivity, dispatchs DeleteActivity action', () => {
+ spyOn(store, 'dispatch');
+
+ component.deleteActivity('id');
+
+ expect(store.dispatch).toHaveBeenCalledWith(new DeleteActivity('id'));
+ });
+
+ it('updateActivity, dispatchs SetActivityToEdit action', () => {
+ spyOn(store, 'dispatch');
+
+ component.updateActivity('id');
+
+ expect(store.dispatch).toHaveBeenCalledWith(new SetActivityToEdit('id'));
+ });
+
it('onInit, activities field is populated with data from store', () => {
component.ngOnInit();
diff --git a/src/app/modules/shared/components/modal/modal.component.html b/src/app/modules/shared/components/modal/modal.component.html
index a8e5eb848..97d0c64f6 100644
--- a/src/app/modules/shared/components/modal/modal.component.html
+++ b/src/app/modules/shared/components/modal/modal.component.html
@@ -7,11 +7,11 @@
Delete Project
- Are you sure you want to delete {{ list.name || list.project }} entry?
+ Are you sure you want to delete {{ list.name }} entry?
diff --git a/src/app/modules/shared/components/modal/modal.component.spec.ts b/src/app/modules/shared/components/modal/modal.component.spec.ts
index 99a10a6a8..0d8d82a5d 100644
--- a/src/app/modules/shared/components/modal/modal.component.spec.ts
+++ b/src/app/modules/shared/components/modal/modal.component.spec.ts
@@ -22,25 +22,4 @@ describe('ModalComponent', () => {
expect(component).toBeTruthy();
});
- it('should emit removeProject event #removedProject', () => {
- const merged = {
- id: '1',
- name: 'app 4',
- description: 'It is a good app',
- project_type_id: '123',
- completed: true,
- project: 'ErnstYoung',
- startDate: '2020-02-05T15:36:15.887Z',
- endDate: '2020-02-05T18:36:15.887Z',
- activity: 'development',
- technologies: ['Angular', 'TypeScript'],
- };
-
- spyOn(component.removeList, 'emit');
- component.list = merged;
- fixture.detectChanges();
- component.removeListById(merged.id);
- expect(component.removeList.emit).toHaveBeenCalled();
- component.cancelDeleteModal.nativeElement.click();
- });
});
diff --git a/src/app/modules/shared/components/modal/modal.component.ts b/src/app/modules/shared/components/modal/modal.component.ts
index 3e9449851..dae9ad620 100644
--- a/src/app/modules/shared/components/modal/modal.component.ts
+++ b/src/app/modules/shared/components/modal/modal.component.ts
@@ -24,9 +24,4 @@ export class ModalComponent implements OnInit {
constructor() { }
ngOnInit(): void { }
-
- removeListById(projectId: string) {
- this.removeList.emit(projectId);
- this.cancelDeleteModal.nativeElement.click();
- }
}
diff --git a/src/app/modules/shared/models/entry.model.ts b/src/app/modules/shared/models/entry.model.ts
index bea6b229e..1f8c958c0 100644
--- a/src/app/modules/shared/models/entry.model.ts
+++ b/src/app/modules/shared/models/entry.model.ts
@@ -1,12 +1,12 @@
export interface Entry {
id: string;
- project: string;
- startDate: string;
- endDate: string;
+ start_date: Date;
+ end_date: Date;
activity: string;
technologies: string[];
comments?: string;
uri?: string;
+ project_id?: string;
}
export interface NewEntry {
diff --git a/src/app/modules/shared/store/technology.effects.ts b/src/app/modules/shared/store/technology.effects.ts
index 6231e8488..cb081d92b 100644
--- a/src/app/modules/shared/store/technology.effects.ts
+++ b/src/app/modules/shared/store/technology.effects.ts
@@ -15,7 +15,7 @@ export class TechnologyEffects {
ofType(actions.TechnologyActionTypes.FIND_TECHNOLOGIES),
map((action: actions.FindTechnology) => action.payload),
mergeMap((value) =>
- this.technologyService.getTechnologies(value).pipe(
+ this.technologyService.getTechnologies(value.toLowerCase()).pipe(
map((technology) => {
return new actions.FindTechnologySuccess(technology);
}),
diff --git a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.html b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.html
index be279282a..94c40ef44 100644
--- a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.html
+++ b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.html
@@ -38,13 +38,17 @@
{{ item.name }}
-
+
+
+
+
+
+ rows="3">
+
diff --git a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.spec.ts b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.spec.ts
index 77fc9b534..4d6374baa 100644
--- a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.spec.ts
+++ b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.spec.ts
@@ -7,7 +7,6 @@ import { allTechnologies } from '../../../shared/store/technology.selectors';
import { EntryFieldsComponent } from './entry-fields.component';
import { ProjectState } from '../../../customer-management/components/projects/components/store/project.reducer';
import { allProjects } from '../../../customer-management/components/projects/components/store/project.selectors';
-import { allEntries } from '../../store/entry.selectors';
import * as actions from '../../../shared/store/technology.actions';
import * as entryActions from '../../store/entry.actions';
@@ -18,7 +17,6 @@ describe('EntryFieldsComponent', () => {
let store: MockStore
;
let mockTechnologySelector;
let mockProjectsSelector;
- let mockEntrySelector;
let length;
const state = {
@@ -68,7 +66,6 @@ describe('EntryFieldsComponent', () => {
store = TestBed.inject(MockStore);
mockTechnologySelector = store.overrideSelector(allTechnologies, state.technologies);
mockProjectsSelector = store.overrideSelector(allProjects, state.projects);
- mockEntrySelector = store.overrideSelector(allEntries, state.entries);
}));
beforeEach(() => {
diff --git a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.ts b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.ts
index bdd9f4bf1..c862600b6 100644
--- a/src/app/modules/time-clock/components/entry-fields/entry-fields.component.ts
+++ b/src/app/modules/time-clock/components/entry-fields/entry-fields.component.ts
@@ -1,4 +1,5 @@
-import { Component, OnInit, ViewChild, ElementRef, Renderer2 } from '@angular/core';
+import { getActiveTimeEntry } from './../../store/entry.selectors';
+import { Component, OnInit, ViewChild, ElementRef, Renderer2, Output, EventEmitter } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { Store, select } from '@ngrx/store';
@@ -10,7 +11,6 @@ import { ProjectState } from '../../../customer-management/components/projects/c
import { TechnologyState } from '../../../shared/store/technology.reducers';
import { LoadActivities, ActivityState, allActivities } from '../../../activities-management/store';
-import { allEntries } from '../../store/entry.selectors';
import * as entryActions from '../../store/entry.actions';
type Merged = TechnologyState & ProjectState & ActivityState;
@@ -21,6 +21,7 @@ type Merged = TechnologyState & ProjectState & ActivityState;
styleUrls: ['./entry-fields.component.scss'],
})
export class EntryFieldsComponent implements OnInit {
+
@ViewChild('list') list: ElementRef;
entryForm: FormGroup;
technology: Technology;
@@ -57,15 +58,17 @@ export class EntryFieldsComponent implements OnInit {
this.activities = response;
});
- const activeEntry$ = this.store.pipe(select(allEntries));
+ const activeEntry$ = this.store.pipe(select(getActiveTimeEntry));
activeEntry$.subscribe((response) => {
- this.activeEntry = response.active;
- this.setDataToUpdate(this.activeEntry);
- this.newData = {
- id: this.activeEntry.id,
- project_id: this.activeEntry.project_id,
- uri: this.activeEntry.uri,
- };
+ if (response) {
+ this.activeEntry = response;
+ this.setDataToUpdate(this.activeEntry);
+ this.newData = {
+ id: this.activeEntry.id,
+ project_id: this.activeEntry.project_id,
+ uri: this.activeEntry.uri,
+ };
+ }
});
}
@@ -92,7 +95,6 @@ export class EntryFieldsComponent implements OnInit {
setTechnology(name: string) {
const index = this.selectedTechnology.indexOf(name);
-
if (index > -1) {
this.removeTag(index);
} else if (this.selectedTechnology.length < 10) {
@@ -111,4 +113,5 @@ export class EntryFieldsComponent implements OnInit {
onSubmit() {
this.store.dispatch(new entryActions.UpdateActiveEntry({ ...this.newData, ...this.entryForm.value }));
}
+
}
diff --git a/src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.spec.ts b/src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.spec.ts
index 420b56ea2..51c49f6f2 100644
--- a/src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.spec.ts
+++ b/src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.spec.ts
@@ -6,7 +6,6 @@ import { ProjectListHoverComponent } from './project-list-hover.component';
import { ProjectState } from '../../../customer-management/components/projects/components/store/project.reducer';
import { allProjects } from '../../../customer-management/components/projects/components/store/project.selectors';
import { FilterProjectPipe } from '../../../shared/pipes';
-import { NewEntry } from '../../../shared/models';
import * as action from '../../store/entry.actions';
describe('ProjectListHoverComponent', () => {
@@ -54,22 +53,11 @@ describe('ProjectListHoverComponent', () => {
expect(component).toBeTruthy();
});
- it('should set selectedId with Id and dispatch CreateEntry action', () => {
+ it('clock-in dispatchs a new action', () => {
spyOn(store, 'dispatch');
- const id = 'P1';
- const entryData: NewEntry = {
- project_id: id,
- start_date: new Date().toISOString(),
- };
- component.clockIn(id);
- expect(store.dispatch).toHaveBeenCalledWith(new action.CreateEntry(entryData));
- expect(component.selectedId).toBe(id);
- });
+ component.clockIn('id');
- it('should emit showFields event', () => {
- const id = 'P1';
- component.showFields.subscribe((showFields: boolean) => expect(showFields).toEqual(true));
- component.clockIn(id);
+ expect(store.dispatch).toHaveBeenCalledWith(new action.CreateEntry({project_id: 'id', start_date: new Date().toISOString() }));
});
});
diff --git a/src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.ts b/src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.ts
index bd70f87e4..95de4328d 100644
--- a/src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.ts
+++ b/src/app/modules/time-clock/components/project-list-hover/project-list-hover.component.ts
@@ -1,20 +1,19 @@
-import { Component, OnInit, Output, EventEmitter } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
import { Store, select } from '@ngrx/store';
+
+import { getActiveTimeEntry } from './../../store/entry.selectors';
import { Project } from 'src/app/modules/shared/models';
import { allProjects } from '../../../customer-management/components/projects/components/store/project.selectors';
import { ProjectState } from '../../../customer-management/components/projects/components/store/project.reducer';
import * as actions from '../../../customer-management/components/projects/components/store/project.actions';
import * as entryActions from '../../store/entry.actions';
-import { selectActiveEntry } from '../../store/entry.selectors';
-
@Component({
selector: 'app-project-list-hover',
templateUrl: './project-list-hover.component.html',
styleUrls: ['./project-list-hover.component.scss'],
})
export class ProjectListHoverComponent implements OnInit {
- @Output() showFields = new EventEmitter();
selectedId: string;
listProjects: Project[] = [];
@@ -24,7 +23,7 @@ export class ProjectListHoverComponent implements OnInit {
keyword = 'name';
nameActiveProject: string;
- constructor(private store: Store) {}
+ constructor(private store: Store) { }
ngOnInit(): void {
this.store.dispatch(new actions.LoadProjects());
@@ -33,15 +32,24 @@ export class ProjectListHoverComponent implements OnInit {
projects$.subscribe((response) => {
this.isLoading = response.isLoading;
this.listProjects = response.projectList;
+ this.loadActiveTimeEntry();
});
- this.store.dispatch(new entryActions.LoadActiveEntry());
- const activeEntry$ = this.store.pipe(select(selectActiveEntry));
+ }
- activeEntry$.subscribe((response) => {
- if (response) {
- this.nameActiveProject = response.name;
- this.showFields.emit(true);
+ private loadActiveTimeEntry() {
+ this.store.dispatch(new entryActions.LoadActiveEntry());
+ const activeEntry$ = this.store.pipe(select(getActiveTimeEntry));
+ activeEntry$.subscribe((activeEntry) => {
+ if (activeEntry) {
+ for (const project of this.listProjects) {
+ if (project.id === activeEntry.project_id) {
+ this.nameActiveProject = project.name;
+ break;
+ }
+ }
+ } else {
+ this.nameActiveProject = null;
}
});
}
@@ -49,6 +57,5 @@ export class ProjectListHoverComponent implements OnInit {
clockIn(id: string) {
const newEntry = { project_id: id, start_date: new Date().toISOString() };
this.store.dispatch(new entryActions.CreateEntry(newEntry));
- this.selectedId = id;
}
}
diff --git a/src/app/modules/time-clock/pages/time-clock.component.html b/src/app/modules/time-clock/pages/time-clock.component.html
index 4e8a461a0..f993c54db 100644
--- a/src/app/modules/time-clock/pages/time-clock.component.html
+++ b/src/app/modules/time-clock/pages/time-clock.component.html
@@ -1,52 +1,53 @@
-
- Field technology is requiered. Enter this field for clock out.
+
+ {{message}}
-
- {{ 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
+
Summary
-
-
Current
- {{ hour | number: '2.0-2' }}:{{ minute | number: '2.0-2' }}:{{ seconds | number: '2.0-2' }}
-
Day
4:22
Week
- 14:00
+ 14:25
+
+
+
Month
+ 49:32
+
+
+
+
+
+
+ {{ username }} clocked in at
+ {{ activeTimeEntry?.start_date | date:'shortTime' }}
+
+
+ {{ username }} you did not clock-in yet.
+
+
-
-
+
-
-
diff --git a/src/app/modules/time-clock/pages/time-clock.component.spec.ts b/src/app/modules/time-clock/pages/time-clock.component.spec.ts
index 50e9ae77e..1be0de819 100644
--- a/src/app/modules/time-clock/pages/time-clock.component.spec.ts
+++ b/src/app/modules/time-clock/pages/time-clock.component.spec.ts
@@ -1,8 +1,7 @@
+import { StopTimeEntryRunning } from './../store/entry.actions';
import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { provideMockStore, MockStore } from '@ngrx/store/testing';
-import { DebugElement } from '@angular/core';
-import { By } from '@angular/platform-browser';
import { TimeClockComponent } from './time-clock.component';
import { ProjectState } from '../../customer-management/components/projects/components/store/project.reducer';
@@ -14,7 +13,6 @@ import { AzureAdB2CService } from '../../login/services/azure.ad.b2c.service';
describe('TimeClockComponent', () => {
let component: TimeClockComponent;
let fixture: ComponentFixture
;
- let de: DebugElement;
let store: MockStore;
let projectService: ProjectService;
let azureAdB2CService: AzureAdB2CService;
@@ -30,6 +28,7 @@ describe('TimeClockComponent', () => {
},
entries: {
active: {
+ id: 'id',
project_id: '2b87372b-3d0d-4dc0-832b-ae5863cd39e5',
start_date: '2020-04-23T16:11:06.455000+00:00',
technologies: ['java', 'typescript'],
@@ -52,7 +51,6 @@ describe('TimeClockComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(TimeClockComponent);
component = fixture.componentInstance;
- de = fixture.debugElement;
fixture.detectChanges();
projectService = TestBed.inject(ProjectService);
azureAdB2CService = TestBed.inject(AzureAdB2CService);
@@ -85,196 +83,12 @@ describe('TimeClockComponent', () => {
}
));
- it('should set showfileds as true', () => {
- const show = true;
- component.setShowFields(show);
- expect(component.showFields).toBe(true);
- });
-
- it('should be called the setShowFields event #1', () => {
- spyOn(component, 'setShowFields');
- const showFields = de.query(By.directive(ProjectListHoverComponent));
- const cmp = showFields.componentInstance;
- cmp.showFields.emit(true);
- expect(component.setShowFields).toHaveBeenCalledWith(true);
- });
-
- /* ---------------------- EMPLOYE CLOCK IN ------------------------------------- */
- it('should be verify the init state of vars', () => {
- expect(component.isClockIn).toBeTruthy();
- expect(component.isEnterTechnology).toBeFalsy();
- expect(component.showAlertEnterTecnology).toBeFalsy();
- expect(component.showFields).toBeFalsy();
- expect(component.execOnlyOneTimeCounter).toBeFalsy();
- expect(component.execOnlyOneTimeClockIn).toBeFalsy();
- expect(component.isClockInEnable).toBeFalsy();
- expect(component.isHidenForm).toBeTruthy();
-
- expect(component.hourCounterRealTime).toEqual(0);
- expect(component.minuteCounterRealTime).toEqual(0);
- expect(component.secondsCounterRealTime).toEqual(0);
-
- expect(component.hour).toEqual(0);
- expect(component.minute).toEqual(0);
- expect(component.seconds).toEqual(0);
- });
-
- it('should be change state of isClockInEnale, isClockIn, isHidenForm when function is called', () => {
- component.employeClockIn();
- expect(component.isClockInEnable).toBeTruthy();
- expect(component.isClockIn).toBeFalsy();
- });
-
- it('the function should return false', () => {
- expect(component.employeClockIn()).toEqual(false);
- });
-
- it('should be called to intern methods of employeClockIn', () => {
- spyOn(component, 'startTimer');
- spyOn(component, 'setArrivalAndDepartureTimes');
+ it('clockOut dispatch a StopTimeEntryRunning action', () => {
+ spyOn(store, 'dispatch');
- component.employeClockIn();
+ component.clockOut();
- expect(component.startTimer).toHaveBeenCalled();
- expect(component.setArrivalAndDepartureTimes).toHaveBeenCalled();
+ expect(store.dispatch).toHaveBeenCalledWith(new StopTimeEntryRunning('id'));
});
- /* ---------------------- EMPLOYE CLOCK OUT ------------------------------------- */
- it('should enter if and assign the value to vars', () => {
- component.isEnterTechnology = false;
- component.employeClockOut();
- expect(component.isClockIn).toBeFalsy();
- expect(component.showAlertEnterTecnology).toBeTruthy();
- });
-
- it('should enter if and not called to intern methods', () => {
- component.isEnterTechnology = false;
- spyOn(component, 'setDefaultValuesToFields');
- spyOn(component, 'pauseTimer');
- spyOn(component, 'setArrivalAndDepartureTimes');
- component.employeClockOut();
- expect(component.setDefaultValuesToFields).not.toHaveBeenCalled();
- expect(component.pauseTimer).not.toHaveBeenCalled();
- expect(component.setArrivalAndDepartureTimes).not.toHaveBeenCalled();
- });
-
- it('should enter else and execute internal methods', () => {
- component.isEnterTechnology = true;
-
- spyOn(component, 'setDefaultValuesToFields');
- spyOn(component, 'pauseTimer');
- spyOn(component, 'setArrivalAndDepartureTimes');
-
- component.employeClockOut();
-
- expect(component.setDefaultValuesToFields).toHaveBeenCalled();
- expect(component.pauseTimer).toHaveBeenCalled();
- expect(component.setArrivalAndDepartureTimes).toHaveBeenCalled();
- });
-
- /* ---------------------- ENTER TECHNOLOGY ------------------------------------- */
- it('should enter if and assign the value to var', () => {
- const dataTechnology = 'Angular';
- component.enterTechnology(dataTechnology);
- expect(component.isEnterTechnology).toBeTruthy();
- });
-
- it('should enter else and assign the value to var ', () => {
- const dataTechnology = '';
- component.enterTechnology(dataTechnology);
- expect(component.isEnterTechnology).toBeFalsy();
- });
-
- /* ---------------------- SET SHOW FIELDS ------------------------------------- */
- it('should execute all internal methods', () => {
- const show = true;
- component.isClockInEnable = false;
- component.execOnlyOneTimeCounter = false;
-
- spyOn(component, 'startTimer');
- spyOn(component, 'setArrivalAndDepartureTimes');
-
- component.setShowFields(show);
-
- expect(component.isHidenForm).toBeFalsy();
- expect(component.isClockIn).toBeFalsy();
- expect(component.showFields).toEqual(show);
- expect(component.startTimer).toHaveBeenCalled();
- expect(component.execOnlyOneTimeCounter).toBeTruthy();
- expect(component.setArrivalAndDepartureTimes).toHaveBeenCalled();
- });
-
- it('should not call nested if internal methods', () => {
- const show = true;
- component.isClockInEnable = false;
- component.execOnlyOneTimeCounter = true;
-
- spyOn(component, 'startTimer');
- spyOn(component, 'setArrivalAndDepartureTimes');
-
- component.setShowFields(show);
-
- expect(component.isHidenForm).toBeFalsy();
- expect(component.isClockIn).toBeFalsy();
- expect(component.showFields).toEqual(show);
- expect(component.startTimer).not.toHaveBeenCalled();
- expect(component.execOnlyOneTimeCounter).toBeTruthy();
- expect(component.setArrivalAndDepartureTimes).toHaveBeenCalled();
- });
-
- it('shouldn not execute any main if method', () => {
- const show = true;
- component.isClockInEnable = true;
- component.execOnlyOneTimeCounter = true;
-
- spyOn(component, 'startTimer');
- spyOn(component, 'setArrivalAndDepartureTimes');
-
- component.setShowFields(show);
-
- expect(component.isHidenForm).toBeFalsy();
- expect(component.isClockIn).toBeTruthy();
- expect(component.showFields).toEqual(undefined);
- expect(component.startTimer).not.toHaveBeenCalled();
- expect(component.execOnlyOneTimeCounter).toBeTruthy();
- expect(component.setArrivalAndDepartureTimes).not.toHaveBeenCalled();
- });
-
- /* ---------------------- TIMER ------------------------------------- */
- it('should be var not equal to zero', () => {
- component.timer();
- expect(component.secondsCounterRealTime).not.toEqual(0);
- });
-
- /* ---------------------- ARRIVALS ------------------------------------- */
- it('should execute intern methods of arrivals', () => {
- const currentDate = new Date();
- component.execOnlyOneTimeClockIn = false;
- component.setArrivalAndDepartureTimes();
- expect(component.hour).toEqual(currentDate.getHours());
- expect(component.minute).toEqual(currentDate.getMinutes());
- expect(component.seconds).toEqual(currentDate.getSeconds());
- expect(component.execOnlyOneTimeClockIn).toEqual(true);
- });
-
- it('should not execute intern methods of arrivals', () => {
- component.execOnlyOneTimeClockIn = true;
- component.setArrivalAndDepartureTimes();
- expect(component.hour).toEqual(0);
- expect(component.minute).toEqual(0);
- expect(component.seconds).toEqual(0);
- expect(component.execOnlyOneTimeClockIn).toEqual(true);
- });
-
- /* ---------------------- DEFAULT FIELDS ------------------------------------- */
- it('set values to empty', () => {
- component.setDefaultValuesToFields();
- expect(component.isHidenForm).toBeTruthy();
- expect(component.isClockIn).toBeTruthy();
- expect(component.isEnterTechnology).toBeFalsy();
- expect(component.showAlertEnterTecnology).toBeFalsy();
- expect(component.execOnlyOneTimeClockIn).toBeFalsy();
- expect(component.execOnlyOneTimeCounter).toBeFalsy();
- expect(component.isClockInEnable).toBeFalsy();
- });
});
diff --git a/src/app/modules/time-clock/pages/time-clock.component.ts b/src/app/modules/time-clock/pages/time-clock.component.ts
index 9b0d048a6..4a1a4582b 100644
--- a/src/app/modules/time-clock/pages/time-clock.component.ts
+++ b/src/app/modules/time-clock/pages/time-clock.component.ts
@@ -1,3 +1,8 @@
+import { getStatusMessage } from './../../customer-management/store/customer-management.selectors';
+import { getActiveTimeEntry } from './../store/entry.selectors';
+import { StopTimeEntryRunning } from './../store/entry.actions';
+import { Entry } from './../../shared/models/entry.model';
+import { Store, select } from '@ngrx/store';
import { Component, OnInit } from '@angular/core';
import { AzureAdB2CService } from '../../login/services/azure.ad.b2c.service';
@@ -7,120 +12,33 @@ import { AzureAdB2CService } from '../../login/services/azure.ad.b2c.service';
styleUrls: ['./time-clock.component.scss'],
})
export class TimeClockComponent implements OnInit {
- currentDate: Date = new Date();
+
username: string;
- isClockIn: boolean;
- isEnterTechnology: boolean;
- showAlertEnterTecnology: boolean;
- showFields: boolean;
- hourCounterRealTime: number;
- minuteCounterRealTime: number;
- secondsCounterRealTime: number;
- hour: number;
- minute: number;
- seconds: number;
- interval;
- dataTechnology: string[] = new Array();
- execOnlyOneTimeCounter = false;
- execOnlyOneTimeClockIn = false;
- isClockInEnable = false;
- isHidenForm = true;
+ areFieldsVisible = false;
+ activeTimeEntry: Entry;
+ message: string;
- constructor(private azureAdB2CService: AzureAdB2CService) {
- this.isClockIn = true;
- this.isEnterTechnology = false;
- this.hourCounterRealTime = 0;
- this.minuteCounterRealTime = 0;
- this.secondsCounterRealTime = 0;
- this.hour = 0;
- this.minute = 0;
- this.seconds = 0;
+ constructor(private azureAdB2CService: AzureAdB2CService, private store: Store) {
}
ngOnInit() {
this.username = this.azureAdB2CService.isLogin() ? this.azureAdB2CService.getName() : '';
- }
-
- 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) {
- this.isClockIn = false;
- this.showFields = show;
- if (!this.execOnlyOneTimeCounter) {
- this.startTimer();
- this.execOnlyOneTimeCounter = true;
+ this.store.pipe(select(getActiveTimeEntry)).subscribe((activeTimeEntry) => {
+ this.activeTimeEntry = activeTimeEntry;
+ if (this.activeTimeEntry) {
+ this.areFieldsVisible = true;
+ } else {
+ this.areFieldsVisible = false;
}
- this.setArrivalAndDepartureTimes();
- }
+ });
+ this.store.pipe(select(getStatusMessage)).subscribe((valueMessage) => {
+ this.message = valueMessage;
+ });
}
- startTimer() {
- this.interval = setInterval(() => {
- this.timer();
- }, 1000);
+ clockOut() {
+ this.store.dispatch(new StopTimeEntryRunning(this.activeTimeEntry.id));
+ this.areFieldsVisible = false;
}
- pauseTimer() {
- clearInterval(this.interval);
- }
-
- timer() {
- this.secondsCounterRealTime += 1;
- if (this.secondsCounterRealTime === 59) {
- this.minuteCounterRealTime += 1;
- this.secondsCounterRealTime = 0;
- if (this.minuteCounterRealTime === 59) {
- this.hourCounterRealTime += 1;
- this.minuteCounterRealTime = 0;
- }
- }
- }
-
- setArrivalAndDepartureTimes() {
- if (!this.execOnlyOneTimeClockIn) {
- this.currentDate = new Date();
- this.hour = this.currentDate.getHours();
- this.minute = this.currentDate.getMinutes();
- this.seconds = this.currentDate.getSeconds();
- this.execOnlyOneTimeClockIn = true;
- }
- }
-
- setDefaultValuesToFields() {
- this.isHidenForm = true;
- this.isClockIn = true;
- this.isEnterTechnology = false;
- this.showAlertEnterTecnology = false;
- this.execOnlyOneTimeClockIn = false;
- this.execOnlyOneTimeCounter = false;
- this.isClockInEnable = false;
- }
}
diff --git a/src/app/modules/time-clock/services/entry.service.spec.ts b/src/app/modules/time-clock/services/entry.service.spec.ts
index 9081a8bdc..4c8f8b0f1 100644
--- a/src/app/modules/time-clock/services/entry.service.spec.ts
+++ b/src/app/modules/time-clock/services/entry.service.spec.ts
@@ -14,10 +14,6 @@ describe('EntryService', () => {
httpMock = TestBed.inject(HttpTestingController);
});
- afterEach(() => {
- httpMock.verify();
- });
-
it('services are ready to be used', inject(
[HttpClientTestingModule, EntryService],
(httpClient: HttpClientTestingModule, entryService: EntryService) => {
@@ -27,9 +23,8 @@ describe('EntryService', () => {
));
it('create entry using POST from baseUrl', () => {
- const entry: NewEntry[] = [{ project_id: '1', start_date: new Date().toISOString() }];
-
service.baseUrl = 'time-entries';
+ const entry: NewEntry[] = [{ project_id: '1', start_date: new Date().toISOString() }];
service.createEntry(entry).subscribe((response) => {
expect(response.length).toBe(1);
@@ -39,4 +34,33 @@ describe('EntryService', () => {
expect(createEntryRequest.request.method).toBe('POST');
createEntryRequest.flush(entry);
});
+
+
+ it('loads an activeEntry with /running', () => {
+ service.baseUrl = 'time-entries';
+
+ service.loadActiveEntry().subscribe((response) => {
+ const loadEntryRequest = httpMock.expectOne(`${service.baseUrl}/running`);
+ expect(loadEntryRequest.request.method).toBe('GET');
+ });
+ });
+
+ it('update an entry using PUT', () => {
+ service.baseUrl = 'time-entries';
+
+ const updatedEntry = {foo: 'bar', id: 'id'};
+ service.updateActiveEntry(updatedEntry).subscribe((response) => {
+ const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/id`);
+ expect(updateEntryRequest.request.method).toBe('PUT');
+ });
+ });
+
+ it('stops an entry using POST', () => {
+ service.baseUrl = 'time-entries';
+
+ service.stopEntryRunning('id').subscribe((response) => {
+ const updateEntryRequest = httpMock.expectOne(`${service.baseUrl}/id/stop`);
+ expect(updateEntryRequest.request.method).toBe('POST');
+ });
+ });
});
diff --git a/src/app/modules/time-clock/services/entry.service.ts b/src/app/modules/time-clock/services/entry.service.ts
index c4d2b7ea2..c903343f8 100644
--- a/src/app/modules/time-clock/services/entry.service.ts
+++ b/src/app/modules/time-clock/services/entry.service.ts
@@ -24,4 +24,9 @@ export class EntryService {
const { id } = entryData;
return this.http.put(`${this.baseUrl}/${id}`, entryData);
}
+
+ stopEntryRunning(idEntry: string): Observable {
+ const url = `${this.baseUrl}/${idEntry}/stop`;
+ return this.http.post(url, null);
+ }
}
diff --git a/src/app/modules/time-clock/store/entry.actions.ts b/src/app/modules/time-clock/store/entry.actions.ts
index 34df7e70a..927eca860 100644
--- a/src/app/modules/time-clock/store/entry.actions.ts
+++ b/src/app/modules/time-clock/store/entry.actions.ts
@@ -11,6 +11,9 @@ export enum EntryActionTypes {
UDPATE_ACTIVE_ENTRY = '[Entry] UDPATE_ACTIVE_ENTRY',
UDPATE_ACTIVE_ENTRY_SUCCESS = '[Entry] UDPATE_ACTIVE_ENTRY_SUCCESS',
UDPATE_ACTIVE_ENTRY_FAIL = '[Entry] UDPATE_ACTIVE_ENTRY_FAIL',
+ STOP_TIME_ENTRY_RUNNING = '[Entry] STOP_TIME_ENTRIES_RUNNING',
+ STOP_TIME_ENTRY_RUNNING_SUCCESS = '[Entry] STOP_TIME_ENTRIES_RUNNING_SUCCESS',
+ STOP_TIME_ENTRY_RUNNING_FAILED = '[Entry] STOP_TIME_ENTRIES_RUNNING_FAILED',
}
export class LoadActiveEntry implements Action {
@@ -64,6 +67,21 @@ export class UpdateActiveEntryFail implements Action {
constructor(public error: string) {}
}
+export class StopTimeEntryRunning implements Action {
+ public readonly type = EntryActionTypes.STOP_TIME_ENTRY_RUNNING;
+ constructor(readonly payload: string) {}
+}
+
+export class StopTimeEntryRunningSuccess implements Action {
+ public readonly type = EntryActionTypes.STOP_TIME_ENTRY_RUNNING_SUCCESS;
+ constructor(readonly payload: string) {}
+}
+
+export class StopTimeEntryRunningFail implements Action {
+ public readonly type = EntryActionTypes.STOP_TIME_ENTRY_RUNNING_FAILED;
+ constructor(public error: string) {}
+}
+
export type EntryActions =
| LoadActiveEntry
| LoadActiveEntrySuccess
@@ -73,4 +91,7 @@ export type EntryActions =
| CreateEntryFail
| UpdateActiveEntry
| UpdateActiveEntrySuccess
- | UpdateActiveEntryFail;
+ | UpdateActiveEntryFail
+ | StopTimeEntryRunning
+ | StopTimeEntryRunningSuccess
+ | StopTimeEntryRunningFail;
diff --git a/src/app/modules/time-clock/store/entry.effects.ts b/src/app/modules/time-clock/store/entry.effects.ts
index c6763fb4c..5dc481e15 100644
--- a/src/app/modules/time-clock/store/entry.effects.ts
+++ b/src/app/modules/time-clock/store/entry.effects.ts
@@ -50,4 +50,18 @@ export class EntryEffects {
)
)
);
+
+ @Effect()
+ stopTimeEntryRunning$: Observable = this.actions$.pipe(
+ ofType(actions.EntryActionTypes.STOP_TIME_ENTRY_RUNNING),
+ map((action: actions.StopTimeEntryRunning) => action.payload),
+ mergeMap((timeEntryId) =>
+ this.entryService.stopEntryRunning(timeEntryId).pipe(
+ map(() => {
+ return new actions.StopTimeEntryRunningSuccess(timeEntryId);
+ }),
+ catchError((error) => of(new actions.StopTimeEntryRunningFail(error.error.message)))
+ )
+ )
+ );
}
diff --git a/src/app/modules/time-clock/store/entry.reducer.spec.ts b/src/app/modules/time-clock/store/entry.reducer.spec.ts
index 726b0b989..6e2a0eba8 100644
--- a/src/app/modules/time-clock/store/entry.reducer.spec.ts
+++ b/src/app/modules/time-clock/store/entry.reducer.spec.ts
@@ -4,7 +4,9 @@ import { entryReducer, EntryState } from './entry.reducer';
describe('entryReducer', () => {
const initialState: EntryState = { active: null, entryList: [], isLoading: false, message: '' };
- const newEntry: NewEntry = { project_id: '112', description: 'aaa', technologies: ['angular', 'typescript'] };
+
+ const entry: NewEntry = { start_date: 'start-date', description:
+ 'description', project_id: '112', technologies: ['angular', 'typescript']};
it('on LoadActiveEntry, isLoading is true', () => {
const action = new actions.LoadActiveEntry();
@@ -28,22 +30,13 @@ describe('entryReducer', () => {
});
it('on CreateEntry, isLoading is true', () => {
- const entry: NewEntry = { project_id: '1', start_date: '2020-04-21T19:51:36.559000+00:00' };
- const action = new actions.CreateEntry(entry);
+ const entryToCreate: NewEntry = { project_id: '1', start_date: '2020-04-21T19:51:36.559000+00:00' };
+ const action = new actions.CreateEntry(entryToCreate);
const state = entryReducer(initialState, action);
expect(state.isLoading).toEqual(true);
});
- it('on CreateEntrySuccess, entry is saved in the store', () => {
- const entry: NewEntry = { project_id: '1', start_date: '2020-04-21T19:51:36.559000+00:00' };
- const action = new actions.CreateEntrySuccess(entry);
- const state = entryReducer(initialState, action);
-
- expect(state.entryList).toEqual([entry]);
- expect(state.isLoading).toEqual(false);
- });
-
it('on CreateEntryFail, entryList equal []', () => {
const action = new actions.CreateEntryFail('error');
const state = entryReducer(initialState, action);
@@ -53,23 +46,22 @@ describe('entryReducer', () => {
});
it('on UpdateActiveEntry, isLoading is true', () => {
- const action = new actions.UpdateActiveEntry(newEntry);
+ const action = new actions.UpdateActiveEntry(entry);
const state = entryReducer(initialState, action);
expect(state.isLoading).toEqual(true);
});
- it('on UpdateActiveEntrySuccess, active is saved in the store', () => {
+ it('on UpdateActiveEntrySuccess, loading is false', () => {
const currentState: EntryState = {
- active: newEntry,
+ active: null,
entryList: [],
isLoading: false,
message: '',
};
- const action = new actions.UpdateActiveEntrySuccess(newEntry);
+ const action = new actions.UpdateActiveEntrySuccess(entry);
const state = entryReducer(currentState, action);
- expect(state.active).toEqual(newEntry);
expect(state.isLoading).toEqual(false);
});
@@ -80,4 +72,29 @@ describe('entryReducer', () => {
expect(state.active).toBe(null);
expect(state.isLoading).toEqual(false);
});
+
+ it('on StopTimeEntryRunning, is loading false', () => {
+ const action = new actions.StopTimeEntryRunning('id');
+
+ const state = entryReducer(initialState, action);
+
+ expect(state.isLoading).toEqual(true);
+ });
+
+ it('on StopTimeEntryRunningSuccess, active to be null', () => {
+ const action = new actions.StopTimeEntryRunningSuccess('id');
+
+ const state = entryReducer(initialState, action);
+
+ expect(state.active).toEqual(null);
+ });
+
+ it('on UpdateActiveEntryFail, isLoading is false', () => {
+ const action = new actions.StopTimeEntryRunningFail('id');
+
+ const state = entryReducer(initialState, action);
+
+ expect(state.isLoading).toBeFalsy();
+ });
+
});
diff --git a/src/app/modules/time-clock/store/entry.reducer.ts b/src/app/modules/time-clock/store/entry.reducer.ts
index 67e5b2aa6..241d0d809 100644
--- a/src/app/modules/time-clock/store/entry.reducer.ts
+++ b/src/app/modules/time-clock/store/entry.reducer.ts
@@ -1,8 +1,8 @@
import { EntryActions, EntryActionTypes } from './entry.actions';
-import { Entry, NewEntry } from '../../shared/models';
+import { Entry } from '../../shared/models';
export interface EntryState {
- active: NewEntry;
+ active: Entry;
entryList: Entry[];
isLoading: boolean;
message: string;
@@ -49,6 +49,7 @@ export const entryReducer = (state: EntryState = initialState, action: EntryActi
case EntryActionTypes.CREATE_ENTRY_SUCCESS: {
return {
...state,
+ active: action.payload,
entryList: [...state.entryList, action.payload],
isLoading: false,
message: 'Entry Created',
@@ -89,7 +90,28 @@ export const entryReducer = (state: EntryState = initialState, action: EntryActi
};
}
- default:
- return state;
+ case EntryActionTypes.STOP_TIME_ENTRY_RUNNING: {
+ return {
+ ...state,
+ isLoading: true,
+ };
+ }
+
+ case EntryActionTypes.STOP_TIME_ENTRY_RUNNING_SUCCESS: {
+ return {
+ ...state,
+ active: null,
+ isLoading: false,
+ message: 'You just clocked-out successfully',
+ };
+ }
+
+ case EntryActionTypes.STOP_TIME_ENTRY_RUNNING_FAILED: {
+ return {
+ ...state,
+ isLoading: false,
+ message: 'An unexpected error happened, try again later',
+ };
+ }
}
};
diff --git a/src/app/modules/time-clock/store/entry.selectors.ts b/src/app/modules/time-clock/store/entry.selectors.ts
index 3ac5beec5..51b9e32a5 100644
--- a/src/app/modules/time-clock/store/entry.selectors.ts
+++ b/src/app/modules/time-clock/store/entry.selectors.ts
@@ -11,8 +11,12 @@ export const allEntries = createSelector(getEntryState, (state: EntryState) => {
export const selectProjects = (state) => state.projects.projectList;
export const selectEntries = (state) => state.entries.active;
-export const selectActiveEntry = createSelector(selectProjects, selectEntries, (selectedProject, selectedEntry) => {
- if (selectedProject && selectedEntry) {
- return selectedProject.find((project) => project.id === selectedEntry.project_id);
+export const getActiveTimeEntry = createSelector(getEntryState, (state: EntryState) => {
+ return state.active;
+});
+
+export const getStatusMessage = createSelector(getEntryState, (state: EntryState) => {
+ if (state) {
+ return state.message;
}
});
diff --git a/src/app/modules/time-entries/pages/time-entries.component.spec.ts b/src/app/modules/time-entries/pages/time-entries.component.spec.ts
index 55459b4c2..e645b9916 100644
--- a/src/app/modules/time-entries/pages/time-entries.component.spec.ts
+++ b/src/app/modules/time-entries/pages/time-entries.component.spec.ts
@@ -43,13 +43,13 @@ describe('TimeEntriesComponent', () => {
const entry = {
id: 'entry_1',
- project: 'Mido - 05 de Febrero',
- startDate: '2020-02-05T15:36:15.887Z',
- endDate: '2020-02-05T18:36:15.887Z',
+ project_id: 'Mido - 05 de Febrero',
+ start_date: new Date('2020-02-05T15:36:15.887Z'),
+ end_date: new Date('2020-02-05T18:36:15.887Z'),
activity: 'development',
technologies: ['Angular', 'TypeScript'],
comments: 'No comments',
- ticket: 'EY-25',
+ uri: 'EY-25',
};
beforeEach(async(() => {
@@ -91,31 +91,6 @@ describe('TimeEntriesComponent', () => {
expect(component.showModal).toBe(true);
});
- it('should filter the Entry to edit', () => {
- const entryId = 'entry_1';
- component.editEntry(entryId);
- expect(component.entry.project).toBe(entry.project);
- expect(component.entry.startDate).toBe(entry.startDate);
- expect(component.entry.endDate).toBe(entry.endDate);
- expect(component.entry.activity).toBe(entry.activity);
- expect(component.entry.technologies).toEqual(entry.technologies);
- });
-
- it('should save an Entry', () => {
- component.entryId = 'entry_1';
- component.saveEntry(entry);
- expect(component.entryList[0].project).toBe('Mido - 05 de Febrero');
- expect(component.entryList[0].startDate).toBe('2020-02-05T15:36:15.887Z');
- expect(component.entryList[0].endDate).toBe('2020-02-05T18:36:15.887Z');
- expect(component.entryList[0].activity).toBe('development');
- });
-
- it('should delete a Entry', () => {
- const entryId = 'entry_5';
- component.removeEntry(entryId);
- expect(component.dataByMonth.length).toBe(0);
- });
-
it('should get the entry List by Month', () => {
const month = 3;
component.getMonth(month);
diff --git a/src/app/modules/time-entries/pages/time-entries.component.ts b/src/app/modules/time-entries/pages/time-entries.component.ts
index a99be1d24..3c856eded 100644
--- a/src/app/modules/time-entries/pages/time-entries.component.ts
+++ b/src/app/modules/time-entries/pages/time-entries.component.ts
@@ -17,8 +17,8 @@ export class TimeEntriesComponent implements OnInit {
{
id: 'entry_1',
project: 'Mido - 05 de Febrero',
- startDate: '2020-02-05T15:36:15.887Z',
- endDate: '2020-02-05T18:36:15.887Z',
+ start_date: new Date('2020-02-05T15:36:15.887Z'),
+ end_date: new Date('2020-02-05T18:36:15.887Z'),
activity: 'development',
technologies: ['Angular', 'TypeScript'],
comments: 'No comments',
@@ -27,8 +27,8 @@ export class TimeEntriesComponent implements OnInit {
{
id: 'entry_2',
project: 'Mido 15 de Marzo',
- startDate: '2020-03-15T20:36:15.887Z',
- endDate: '2020-03-15T23:36:15.887Z',
+ start_date: new Date('2020-03-15T20:36:15.887Z'),
+ end_date: new Date('2020-03-15T23:36:15.887Z'),
activity: 'development',
technologies: ['Angular', 'TypeScript'],
comments: 'No comments',
@@ -37,8 +37,8 @@ export class TimeEntriesComponent implements OnInit {
{
id: 'entry_3',
project: 'GoSpace 15 y 16 de Marzo',
- startDate: '2020-03-15T23:36:15.887Z',
- endDate: '2020-03-16T05:36:15.887Z',
+ start_date: new Date('2020-03-15T23:36:15.887Z'),
+ end_date: new Date('2020-03-16T05:36:15.887Z'),
activity: 'development',
technologies: ['Angular', 'TypeScript'],
comments: 'No comments',
@@ -47,8 +47,8 @@ export class TimeEntriesComponent implements OnInit {
{
id: 'entry_4',
project: 'Mido 16 de Marzo',
- startDate: '2020-03-16T15:36:15.887Z',
- endDate: '2020-03-16T18:36:15.887Z',
+ start_date: new Date('2020-03-16T15:36:15.887Z'),
+ end_date: new Date('2020-03-16T18:36:15.887Z'),
activity: 'development',
technologies: ['javascript', 'java-stream'],
comments: 'No comments',
@@ -57,8 +57,8 @@ export class TimeEntriesComponent implements OnInit {
{
id: 'entry_5',
project: 'Ernst&Young 01 de Abril',
- startDate: '2020-04-01T09:36:15.887Z',
- endDate: '2020-04-01T15:36:15.887Z',
+ start_date: new Date('2020-04-01T09:36:15.887Z'),
+ end_date: new Date('2020-04-01T15:36:15.887Z'),
activity: 'development',
technologies: ['javascript', 'java', 'java-stream'],
comments: 'No comments',
@@ -69,7 +69,7 @@ export class TimeEntriesComponent implements OnInit {
constructor() {}
ngOnInit(): void {
- this.dataByMonth = this.entryList.filter((entry) => new Date(entry.startDate).getMonth() === new Date().getMonth());
+ this.dataByMonth = this.entryList.filter((entry) => entry.start_date.getMonth() === new Date().getMonth());
}
openModal(itemToDelete: Entry) {
@@ -78,23 +78,18 @@ export class TimeEntriesComponent implements OnInit {
}
editEntry(entryId: string) {
- this.entryId = entryId;
- this.entry = this.entryList.find((entry) => entry.id === entryId);
+ // TODO: implement the required logic to edit an entry using the API
}
saveEntry(newData): void {
- const entryIndex = this.entryList.findIndex((entry) => entry.id === this.entryId);
- this.entryList[entryIndex].project = newData.project;
- this.entryList[entryIndex].activity = newData.activity;
- this.entryList[entryIndex].ticket = newData.jiraTicket;
- this.entryList[entryIndex].comments = newData.notes;
+ // TODO: implement the required logic to save an entry using the API
}
removeEntry(entryId: string) {
- this.dataByMonth = this.dataByMonth.filter((entry: Entry) => entry.id !== entryId);
+ // TODO: implement the required logic to delete an entry using the API
}
getMonth(month: number) {
- this.dataByMonth = this.entryList.filter((entry) => new Date(entry.startDate).getMonth() === month);
+ this.dataByMonth = this.entryList.filter((entry) => new Date(entry.start_date).getMonth() === month);
}
}