added assigned to task
This commit is contained in:
parent
b95a0fb328
commit
48e6e7b2d1
4 changed files with 34 additions and 8 deletions
|
|
@ -91,10 +91,10 @@
|
||||||
<span>Done</span
|
<span>Done</span
|
||||||
><img src="./../../../assets/img/board/add.svg" alt="add" />
|
><img src="./../../../assets/img/board/add.svg" alt="add" />
|
||||||
</div>
|
</div>
|
||||||
<div id="todo" class="details">
|
<div id="done" class="details">
|
||||||
@if(getTask('todo').length > 0) {
|
@if(getTask('done').length > 0) {
|
||||||
<app-task
|
<app-task
|
||||||
*ngFor="let task of getTask('todo')"
|
*ngFor="let task of getTask('done')"
|
||||||
[task]="task"
|
[task]="task"
|
||||||
></app-task>
|
></app-task>
|
||||||
} @else {
|
} @else {
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,9 @@
|
||||||
}
|
}
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<div class="footer-badge">
|
<div class="footer-badge">
|
||||||
@if (task.assigned) { @for (assigned of task.assigned; track assigned) {
|
@if (task.assigned.length > 0) { @for (assigned of task.assigned; track
|
||||||
<span class="footer-badged">{{ assigned }}</span>
|
assigned) {
|
||||||
|
<span class="footer-badged">{{ userBadged(assigned) }}</span>
|
||||||
} }
|
} }
|
||||||
</div>
|
</div>
|
||||||
<div class="footer-priority prio-{{ task.priority }}"></div>
|
<div class="footer-priority prio-{{ task.priority }}"></div>
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import { CommonModule } from '@angular/common';
|
||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { DragDropService } from '../../../services/drag-drop.service';
|
import { DragDropService } from '../../../services/drag-drop.service';
|
||||||
import { TaskService } from '../../../services/task.service';
|
import { TaskService } from '../../../services/task.service';
|
||||||
|
import { UserService } from '../../../services/user.service';
|
||||||
import { Task } from '../../../interfaces/task.interface';
|
import { Task } from '../../../interfaces/task.interface';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
@ -23,12 +24,17 @@ export class TaskComponent {
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public dragDropService: DragDropService,
|
public dragDropService: DragDropService,
|
||||||
private taskService: TaskService
|
private taskService: TaskService,
|
||||||
|
private userService: UserService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.userService.unsubUser();
|
||||||
|
}
|
||||||
|
|
||||||
// Subtasks
|
// Subtasks
|
||||||
|
|
||||||
completedSubtasks() {
|
completedSubtasks(): number {
|
||||||
return this.task.subtasksDone.filter((subtask: boolean) => subtask === true)
|
return this.task.subtasksDone.filter((subtask: boolean) => subtask === true)
|
||||||
.length;
|
.length;
|
||||||
}
|
}
|
||||||
|
|
@ -41,4 +47,22 @@ export class TaskComponent {
|
||||||
|
|
||||||
return (completedSubtasksCount / subtasks.length) * 100;
|
return (completedSubtasksCount / subtasks.length) * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Assigned
|
||||||
|
|
||||||
|
userBadged(id: number) {
|
||||||
|
const userId = String(id);
|
||||||
|
const user = this.userService.allUsers.find((user) => user.id === userId);
|
||||||
|
if (user) {
|
||||||
|
if (user.firstName === 'Guest') {
|
||||||
|
return user.firstName.charAt(0);
|
||||||
|
} else {
|
||||||
|
const firstNameLetter = user.firstName.charAt(0);
|
||||||
|
const lastNameLetter = user.lastName.charAt(0);
|
||||||
|
return firstNameLetter + lastNameLetter;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
export interface User {
|
export interface User {
|
||||||
id?: string;
|
id?: string;
|
||||||
name: string;
|
firstName: string;
|
||||||
|
lastName: string;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue