Skip to content

Commit 6b90400

Browse files
committed
Ajust layout sub-task
1 parent db7257a commit 6b90400

3 files changed

Lines changed: 14 additions & 22 deletions

File tree

src/app/models/sub-task.model.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ export class SubTask {
22
id: number = 0;
33
title: string = "";
44
checked: boolean = false;
5-
edit: boolean = false;
65

76
constructor(title: string) {
87
this.title = title;

src/app/pages/add-task/add-task.component.html

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<div class="modal-header py-2">
22
<h5 class="modal-title" id="modal-basic-title">
3-
<fa-icon [icon]="getIconType(task.type)" [ngClass]="'task-icon-' + task.type"></fa-icon> New Task
3+
<fa-icon [icon]="getIconType(task.type)" [ngClass]="'task-icon-' + task.type"></fa-icon>
4+
{{ task.ready ? 'Edit Tak' : 'New Task' }}
45
</h5>
56
<button type="button" class="btn-close" aria-label="Close" (click)="close.emit()"></button>
67
</div>
@@ -22,34 +23,27 @@ <h5 class="modal-title" id="modal-basic-title">
2223
<b>Description:</b>
2324
<textarea name="description" class="form-control form-control-sm" [(ngModel)]="task.description"></textarea>
2425

25-
<b>CheckList</b>
26+
<b class="mt-1">CheckList</b>
2627
<hr />
2728
@if (hasSubTasks() && task.ready) {
2829
<div class="progress">
2930
<div class="progress-bar" role="progressbar" [style.width.%]="getCheckedPercentage()" aria-valuenow="getCheckedPercentage()" aria-valuemin="0" aria-valuemax="100">
30-
{{ getCheckedPercentage() }}%
31+
{{ getCheckedPercentage() | number: '1.0-2' }}%
3132
</div>
3233
</div>
3334
}
3435
@for(sub of task.subTasks; track $index; let i = $index) {
35-
<div class="d-flex mb-2">
36-
@if (task.ready && !sub.edit) {
37-
<input type="checkbox" [(ngModel)]="sub.checked" />
38-
}
39-
@if (sub.edit) {
40-
<input type="text" [(ngModel)]="sub.title" class="form-control form-control-sm w-auto" />
41-
<button class="btn btn-sm btn-success ms-2" (click)="sub.edit = false">
42-
<fa-icon [icon]="faCheck"></fa-icon>
43-
</button>
44-
} @else {
45-
<b class="p-1">{{sub.title}}</b>
46-
<button class="btn btn-sm btn-primary ms-2" (click)="sub.edit = true">
47-
<fa-icon [icon]="faPencil"></fa-icon>
48-
</button>
49-
<button class="btn btn-sm btn-danger ms-2" (click)="removeSubTask(i)">
50-
<fa-icon [icon]="faTrash"></fa-icon>
51-
</button>
36+
<div class="d-flex my-1">
37+
@if (task.ready) {
38+
<div class="form-check">
39+
<input [id]="'check-sub-task' + i" class="form-check-input" type="checkbox" [(ngModel)]="sub.checked" />
40+
<label [for]="'check-sub-task' + i" class="form-check-label"></label>
41+
</div>
5242
}
43+
<input type="text" [(ngModel)]="sub.title" class="form-control form-control-sm w-auto" />
44+
<button class="btn btn-sm btn-danger ms-2" (click)="removeSubTask(i)">
45+
<fa-icon [icon]="faTrash"></fa-icon>
46+
</button>
5347
</div>
5448
}
5549
<button class="btn btn-sm btn-primary mt-2" (click)="addSubTask()">

src/app/pages/add-task/add-task.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export class AddTaskComponent implements OnInit {
4040

4141
addSubTask() {
4242
let sub = new SubTask("");
43-
sub.edit = true;
4443
this.task.subTasks.push(sub);
4544
}
4645

0 commit comments

Comments
 (0)