Skip to content

Commit b3c016d

Browse files
committed
fix: #172 Create-time-entries-manually
1 parent eb1a20c commit b3c016d

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,17 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
8888
ngOnChanges(): void {
8989
if (this.entryToEdit) {
9090
this.selectedTechnology = this.entryToEdit.technologies;
91+
<<<<<<< HEAD
9192
this.project = this.listProjects.find((p) => p.id === this.entryToEdit.project_id);
9293
const activity = this.activities.find((a) => a.id === this.entryToEdit.activity_id);
9394
this.projectName = this.project.name;
9495
this.entryForm.setValue({
96+
=======
97+
const project = this.listProjects.find((p) => p.id === this.entryToEdit.project_id);
98+
const activity = this.activities.find((a) => a.id === this.entryToEdit.activity_id);
99+
this.entryForm.setValue({
100+
project: project ? project.name : '',
101+
>>>>>>> fix: #172 Create-time-entries-manually
95102
activity: activity ? activity.name : '',
96103
description: this.entryToEdit.description,
97104
start_date: this.entryToEdit.start_date ? formatDate(this.entryToEdit.start_date, 'yyyy-MM-dd', 'en') : '',
@@ -102,9 +109,14 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
102109
});
103110
} else {
104111
this.selectedTechnology = [];
112+
<<<<<<< HEAD
105113
this.project = '';
106114
this.projectName = '';
107115
this.entryForm.setValue({
116+
=======
117+
this.entryForm.setValue({
118+
project: '',
119+
>>>>>>> fix: #172 Create-time-entries-manually
108120
activity: '',
109121
description: '',
110122
start_date: formatDate(new Date(), 'yyyy-MM-dd', 'en'),
@@ -138,9 +150,14 @@ export class DetailsFieldsComponent implements OnChanges, OnInit {
138150

139151
onSubmit() {
140152
const activity = this.activities.find((a) => a.name === this.entryForm.value.activity);
153+
<<<<<<< HEAD
141154
this.project = this.projectName.id ? this.projectName : this.project;
142155
const entry = {
143156
project_id: this.project.id,
157+
=======
158+
const entry = {
159+
project_id: this.entryForm.value.project.id,
160+
>>>>>>> fix: #172 Create-time-entries-manually
144161
activity_id: activity ? activity.id : null,
145162
technologies: this.selectedTechnology,
146163
description: this.entryForm.value.description,

src/app/modules/time-entries/pages/time-entries.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ export class TimeEntriesComponent implements OnInit {
3535
const duration: any = moment.duration(endDate.diff(startDate));
3636
time = `${duration._data.hours} hour and ${duration._data.minutes} minutes`;
3737
}
38-
const date = moment(entry.start_date).format('YYYY-MM-DD');
39-
const item = { ...entry, time, date };
38+
const item = { ...entry, time };
4039
return [...acc, item];
4140
}
4241
return [];

0 commit comments

Comments
 (0)