Skip to content

Commit efa7ede

Browse files
authored
Merge pull request #240 from ioet/176-display-time-entries-summary
176 display time entries summary
2 parents 9603281 + 8b8389e commit efa7ede

21 files changed

+820
-225
lines changed

package-lock.json

Lines changed: 585 additions & 185 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@
6161
"karma-jasmine": "~2.0.1",
6262
"karma-jasmine-html-reporter": "^1.4.2",
6363
"karma-json-fixtures-preprocessor": "0.0.6",
64+
"popper.js": "^1.16.0",
6465
"prettier": "^2.0.2",
65-
"protractor": "~5.4.3",
66+
"protractor": "^7.0.0",
6667
"semantic-release": "^17.0.4",
6768
"ts-node": "~8.3.0",
6869
"tslint": "~5.18.0",
69-
"typescript": "~3.7.5",
70-
"popper.js": "^1.16.0"
70+
"typescript": "~3.7.5"
7171
},
7272
"husky": {
7373
"hooks": {

src/app/app.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ import { EntryEffects } from './modules/time-clock/store/entry.effects';
5858
import { InjectTokenInterceptor } from './modules/shared/interceptors/inject.token.interceptor';
5959
import { SubstractDatePipe } from './modules/shared/pipes/substract-date/substract-date.pipe';
6060
import {TechnologiesComponent} from './modules/shared/components/technologies/technologies.component';
61+
import { TimeEntriesSummaryComponent } from './modules/time-clock/components/time-entries-summary/time-entries-summary.component';
62+
import { TimeDetailsPipe } from './modules/time-clock/pipes/time-details.pipe';
6163

6264
@NgModule({
6365
declarations: [
@@ -94,6 +96,8 @@ import {TechnologiesComponent} from './modules/shared/components/technologies/te
9496
EntryFieldsComponent,
9597
SubstractDatePipe,
9698
TechnologiesComponent,
99+
TimeEntriesSummaryComponent,
100+
TimeDetailsPipe,
97101
],
98102
imports: [
99103
CommonModule,

src/app/modules/shared/components/details-fields/details-fields.component.spec.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ describe('DetailsFieldsComponent', () => {
8888
});
8989

9090
it('should emit ngOnChange with new data', () => {
91-
const project = { id: 'id', name: 'name', project_type_id: '' };
9291
const entryToEdit = {
9392
project_id: 'id',
9493
activity_id: 'fc5fab41-a21e-4155-9d05-511b956ebd05',
@@ -116,7 +115,6 @@ describe('DetailsFieldsComponent', () => {
116115
});
117116

118117
it('should emit ngOnChange with new data', () => {
119-
const project = { id: 'id', name: 'name', project_type_id: '' };
120118
const entryToEdit = {
121119
project_id: 'id',
122120
activity_id: '',

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {TechnologyState} from '../../store/technology.reducers';
66
import {allTechnologies} from '../../store/technology.selectors';
77
import {TechnologiesComponent} from './technologies.component';
88
import * as actions from '../../store/technology.actions';
9-
import {ProjectState} from '../../../customer-management/components/projects/components/store/project.reducer';
109

1110
describe('Technologies component', () => {
1211
let component: TechnologiesComponent;

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ export class TechnologiesComponent implements OnInit {
5454
}
5555

5656
addTechnology(name: string) {
57-
const index = this.selectedTechnologies.indexOf(name);
58-
if (index > -1) {
59-
this.removeTechnology(index);
60-
} else if (this.selectedTechnologies.length < this.MAX_NUM_TECHNOLOGIES) {
57+
if (this.selectedTechnologies.length < this.MAX_NUM_TECHNOLOGIES) {
6158
this.selectedTechnologies = [...this.selectedTechnologies, name];
6259
this.technologyAdded.emit(this.selectedTechnologies);
6360
this.showList = false;

src/app/modules/time-clock/components/time-entries-summary/time-entries-summary.component.css

Whitespace-only changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<h6 class="text-left"><strong>Summary</strong></h6>
2+
<hr />
3+
<div class="row pb-4">
4+
<div class="col-4">
5+
<h6>Day</h6>
6+
<h3>{{ timeEntriesSummary.day | timeDetails }}</h3>
7+
</div>
8+
<div class="col-4">
9+
<h6>Week</h6>
10+
<h3>{{ timeEntriesSummary.week | timeDetails }}</h3>
11+
</div>
12+
<div class="col-4">
13+
<h6>Month</h6>
14+
<h3>{{ timeEntriesSummary.month | timeDetails }}</h3>
15+
</div>
16+
</div>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { TimeDetailsPipe } from './../../pipes/time-details.pipe';
2+
import { provideMockStore } from '@ngrx/store/testing';
3+
import { TimeEntriesSummary } from './../../models/time.entry.summary';
4+
import { TimeDetails } from './../../models/time.entry.summary';
5+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
6+
7+
import { TimeEntriesSummaryComponent } from './time-entries-summary.component';
8+
9+
describe('TimeEntriesSummaryComponent', () => {
10+
let component: TimeEntriesSummaryComponent;
11+
let fixture: ComponentFixture<TimeEntriesSummaryComponent>;
12+
13+
14+
const emptyTimeDetails: TimeDetails = { hours: '--:--', minutes: '--:--', seconds: '--:--' };
15+
const emptyTimeEntriesSummary: TimeEntriesSummary = { day: emptyTimeDetails, week: emptyTimeDetails, month: emptyTimeDetails };
16+
17+
const state = {
18+
entries: {
19+
timeEntriesSummary: emptyTimeEntriesSummary
20+
},
21+
};
22+
23+
beforeEach(async(() => {
24+
TestBed.configureTestingModule({
25+
declarations: [ TimeEntriesSummaryComponent, TimeDetailsPipe ],
26+
providers: [provideMockStore({ initialState: state })
27+
],
28+
})
29+
.compileComponents();
30+
}));
31+
32+
beforeEach(() => {
33+
fixture = TestBed.createComponent(TimeEntriesSummaryComponent);
34+
component = fixture.componentInstance;
35+
fixture.detectChanges();
36+
});
37+
38+
it('should create', () => {
39+
expect(component).toBeTruthy();
40+
});
41+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { getEntriesSummary } from './../../store/entry.selectors';
2+
import { TimeEntriesSummary } from '../../models/time.entry.summary';
3+
import { LoadEntriesSummary } from './../../store/entry.actions';
4+
import { EntryState } from './../../store/entry.reducer';
5+
import { Store, select } from '@ngrx/store';
6+
import { Component, OnInit } from '@angular/core';
7+
8+
@Component({
9+
selector: 'app-time-entries-summary',
10+
templateUrl: './time-entries-summary.component.html',
11+
styleUrls: ['./time-entries-summary.component.css']
12+
})
13+
export class TimeEntriesSummaryComponent implements OnInit {
14+
15+
timeEntriesSummary: TimeEntriesSummary;
16+
17+
constructor(private store: Store<EntryState>) { }
18+
19+
ngOnInit(): void {
20+
this.store.dispatch(new LoadEntriesSummary());
21+
const timeEntriesSummary$ = this.store.pipe(select(getEntriesSummary));
22+
timeEntriesSummary$.subscribe((response) => {
23+
this.timeEntriesSummary = response;
24+
});
25+
}
26+
27+
}

0 commit comments

Comments
 (0)