feat: Ajout d'un groupe de tâches
This commit is contained in:
@@ -16,6 +16,7 @@ import { Observable } from 'rxjs';
|
||||
templateUrl: './home.component.html',
|
||||
})
|
||||
export class Home {
|
||||
//#region Attributs
|
||||
private taskService: TaskService = inject(TaskService);
|
||||
private groupService: GroupService = inject(GroupService);
|
||||
private projectService: ProjectService = inject(ProjectService);
|
||||
@@ -33,6 +34,13 @@ export class Home {
|
||||
|
||||
showTaskForm: boolean = false;
|
||||
|
||||
newGroupForm = new FormGroup({
|
||||
name: new FormControl('', Validators.required),
|
||||
});
|
||||
|
||||
showGroupForm: boolean = false;
|
||||
//#endregion
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.taskService.getTasks().subscribe((response: Task[]): void => {
|
||||
this.tasks.set(response);
|
||||
@@ -47,7 +55,7 @@ export class Home {
|
||||
})
|
||||
}
|
||||
|
||||
public toggleForm(): void {
|
||||
public toggleTaskForm(): void {
|
||||
this.showTaskForm = !this.showTaskForm;
|
||||
}
|
||||
|
||||
@@ -66,4 +74,22 @@ export class Home {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public toggleGroupForm(): void {
|
||||
this.showGroupForm = !this.showGroupForm;
|
||||
}
|
||||
|
||||
/**
|
||||
* submitGroup
|
||||
*/
|
||||
public submitGroup() {
|
||||
let response: Observable<Group> = this.groupService.addGroup(this.newGroupForm.controls.name.value!);
|
||||
|
||||
response.subscribe(response => {
|
||||
this.groups.update(values => {
|
||||
return [...values, response];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user