parent
5bcbde46ea
commit
93ec3cbc19
@ -1,7 +1,14 @@
|
|||||||
<ion-header [translucent]="true">
|
<ion-header [translucent]="true">
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-title *ngIf="isAddMode">Create Task</ion-title>
|
<div class="toolbar">
|
||||||
<ion-title *ngIf="!isAddMode">Edit Task</ion-title>
|
<ion-title *ngIf="isAddMode">Create Task</ion-title>
|
||||||
|
<ion-title *ngIf="!isAddMode">Edit Task</ion-title>
|
||||||
|
<button
|
||||||
|
*ngIf="!isAddMode"
|
||||||
|
class="remove-button"
|
||||||
|
(click)="deleteTask()"
|
||||||
|
>Delete task</button>
|
||||||
|
</div>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
.toolbar {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.remove-button {
|
||||||
|
background-color: var(--ion-color-primary);
|
||||||
|
margin-right: 15px;
|
||||||
|
width: 85px;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
form {
|
form {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
@ -72,4 +72,9 @@ export class EditTaskPage implements OnInit {
|
|||||||
|
|
||||||
this.router.navigate(['/tabs/tasks']);
|
this.router.navigate(['/tabs/tasks']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteTask() {
|
||||||
|
this.taskService.deleteTask(this.id);
|
||||||
|
this.router.navigate(['/tabs/tasks']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ export class TasksPage implements ViewWillEnter {
|
|||||||
this.taskService.getTaskList().subscribe(tasks => {
|
this.taskService.getTaskList().subscribe(tasks => {
|
||||||
this.tasks$.next(tasks);
|
this.tasks$.next(tasks);
|
||||||
});
|
});
|
||||||
}, 1)
|
}, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
createTask() {
|
createTask() {
|
||||||
|
@ -30,4 +30,8 @@ export class TaskService {
|
|||||||
completeTask(id: number) {
|
completeTask(id: number) {
|
||||||
this.http.post(`${this.url}/task/${id}/complete`, {}).subscribe();
|
this.http.post(`${this.url}/task/${id}/complete`, {}).subscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteTask(id: number) {
|
||||||
|
this.http.delete(`${this.url}/task/${id}`).subscribe();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user