31 lines
777 B
TypeScript
31 lines
777 B
TypeScript
import {Component, Input} from '@angular/core';
|
|
import {type User} from '../user/user.model';
|
|
import {TaskComponent} from './task/task.component';
|
|
import {NewTaskComponent} from './new-task/new-task.component';
|
|
import {TasksService} from './tasks.service';
|
|
|
|
@Component({
|
|
selector: 'app-tasks',
|
|
imports: [TaskComponent, NewTaskComponent],
|
|
templateUrl: './tasks.component.html',
|
|
styleUrl: './tasks.component.css'
|
|
})
|
|
export class TasksComponent {
|
|
@Input({ required: true }) user!: User;
|
|
isAddingTask = false;
|
|
|
|
constructor(private tasksService: TasksService) {}
|
|
|
|
get selectedUserTasks() {
|
|
return this.tasksService.getUserTasks(this.user.id);
|
|
}
|
|
|
|
onStartAddTask() {
|
|
this.isAddingTask = true;
|
|
}
|
|
|
|
onCloseAddTask() {
|
|
this.isAddingTask = false;
|
|
}
|
|
}
|