-
-
Notifications
You must be signed in to change notification settings - Fork 746
/
task-summary-table.component.ts
44 lines (38 loc) · 1.13 KB
/
task-summary-table.component.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
import {Task, TaskWithIssueData} from '../task.model';
import {getWorklogStr} from '../../../util/get-work-log-str';
import {TaskService} from '../task.service';
import {T} from '../../../t.const';
@Component({
selector: 'task-summary-table',
templateUrl: './task-summary-table.component.html',
styleUrls: ['./task-summary-table.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TaskSummaryTableComponent {
@Input() flatTasks: TaskWithIssueData[];
@Input() day: string = getWorklogStr();
T = T;
constructor(
private _taskService: TaskService,
) {
}
updateTimeSpentTodayForTask(task: Task, newVal: number | string) {
this._taskService.update(task.id, {
timeSpentOnDay: {
...task.timeSpentOnDay,
[this.day]: +newVal,
}
});
}
updateTaskTitle(task: Task, newVal: string) {
this._taskService.update(task.id, {
title: newVal
});
}
toggleTaskDone(task: Task) {
task.isDone
? this._taskService.setUnDone(task.id)
: this._taskService.setDone(task.id);
}
}