Add recreate task button
All checks were successful
Backend Build and Test / build (push) Successful in 2m13s
All checks were successful
Backend Build and Test / build (push) Successful in 2m13s
This commit is contained in:
parent
06c8ebcbcc
commit
b8ffa6f894
@ -6,6 +6,7 @@
|
||||
</div>
|
||||
<ion-title *ngIf="isAddMode">Create Task</ion-title>
|
||||
<ion-title *ngIf="!isAddMode">Edit Task</ion-title>
|
||||
<button class="done-button" *ngIf="!isAddMode" (click)="completeAndRecreateTask()">Done & Re-create</button>
|
||||
</div>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
@ -42,6 +42,13 @@ button {
|
||||
margin-top: 100px;
|
||||
}
|
||||
|
||||
.done-button {
|
||||
width: 150px;
|
||||
margin-top: unset;
|
||||
margin-right: 20px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
button:disabled,
|
||||
button[disabled]{
|
||||
opacity: 0.5;
|
||||
|
@ -57,13 +57,13 @@ export class EditTaskPage implements OnInit {
|
||||
let assigned: number | null = Number(formValue.assigned);
|
||||
if (assigned === 0) {
|
||||
assigned = null;
|
||||
}
|
||||
};
|
||||
|
||||
const task = {
|
||||
name: formValue.name,
|
||||
reward: formValue.reward,
|
||||
assigned
|
||||
}
|
||||
};
|
||||
|
||||
if (this.isAddMode) {
|
||||
this.taskService.createTask(task);
|
||||
@ -79,6 +79,25 @@ export class EditTaskPage implements OnInit {
|
||||
this.router.navigate(['/tabs/tasks']);
|
||||
}
|
||||
|
||||
completeAndRecreateTask() {
|
||||
const formValue = this.form.value;
|
||||
let assigned: number | null = Number(formValue.assigned);
|
||||
if (assigned === 0) {
|
||||
assigned = null;
|
||||
};
|
||||
|
||||
const task = {
|
||||
name: formValue.name,
|
||||
reward: formValue.reward,
|
||||
assigned
|
||||
};
|
||||
|
||||
this.taskService.createTask(task);
|
||||
this.taskService.completeTask(this.id);
|
||||
|
||||
this.router.navigate(['/tabs/tasks']);
|
||||
}
|
||||
|
||||
navigateBack() {
|
||||
this.location.back();
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import { Allowance } from '../models/allowance';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AllowanceService {
|
||||
private url = 'https://allowanceplanner.seeseepuff.be/api';
|
||||
private url = 'http://localhost:8080/api';
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import { History } from '../models/history';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class HistoryService {
|
||||
private url = 'https://allowanceplanner.seeseepuff.be/api';
|
||||
private url = 'http://localhost:8080/api';
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import { Task } from '../models/task';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TaskService {
|
||||
private url = 'https://allowanceplanner.seeseepuff.be/api';
|
||||
private url = 'http://localhost:8080/api';
|
||||
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import { User } from '../models/user';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class UserService {
|
||||
private url = 'https://allowanceplanner.seeseepuff.be/api';
|
||||
private url = 'http://localhost:8080/api';
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
getUserList(): Observable<Array<User>> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user