mirror of
https://github.com/a-mayb3/KanbanCloneAngular.git
synced 2026-03-21 18:05:38 +01:00
Added task editing page
This commit is contained in:
parent
ffc79a28dc
commit
69edc4e197
9 changed files with 322 additions and 2 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, Output, inject } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { Task } from '../../models/tasks.models';
|
||||
|
|
@ -11,6 +12,7 @@ import { Task } from '../../models/tasks.models';
|
|||
styleUrl: './task-item.component.css',
|
||||
})
|
||||
export class TaskItemComponent {
|
||||
private router = inject(Router);
|
||||
private _task!: Task;
|
||||
statusValue: Task['status'] = 'pending';
|
||||
|
||||
|
|
@ -24,6 +26,9 @@ export class TaskItemComponent {
|
|||
return this._task;
|
||||
}
|
||||
|
||||
@Input()
|
||||
projectId?: number;
|
||||
|
||||
@Output() statusChange = new EventEmitter<{
|
||||
task: Task;
|
||||
status: Task['status'];
|
||||
|
|
@ -59,4 +64,14 @@ export class TaskItemComponent {
|
|||
this.remove.emit(this._task);
|
||||
}
|
||||
}
|
||||
|
||||
onEdit() {
|
||||
if (!this._task || this.projectId == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.router.navigate(['/projects', this.projectId, 'tasks', this._task.id, 'edit'], {
|
||||
state: { task: this._task },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue