AP-139 #141
@ -6,6 +6,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<ion-title *ngIf="isAddMode">Create Task</ion-title>
|
<ion-title *ngIf="isAddMode">Create Task</ion-title>
|
||||||
<ion-title *ngIf="!isAddMode">Edit Task</ion-title>
|
<ion-title *ngIf="!isAddMode">Edit Task</ion-title>
|
||||||
|
<button class="done-button" *ngIf="!isAddMode" (click)="completeAndRecreateTask()">Done & Re-create</button>
|
||||||
</div>
|
</div>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
@ -42,6 +42,13 @@ button {
|
|||||||
margin-top: 100px;
|
margin-top: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.done-button {
|
||||||
|
width: 150px;
|
||||||
|
margin-top: unset;
|
||||||
|
margin-right: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
button:disabled,
|
button:disabled,
|
||||||
button[disabled]{
|
button[disabled]{
|
||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
|
@ -57,13 +57,13 @@ export class EditTaskPage implements OnInit {
|
|||||||
let assigned: number | null = Number(formValue.assigned);
|
let assigned: number | null = Number(formValue.assigned);
|
||||||
if (assigned === 0) {
|
if (assigned === 0) {
|
||||||
assigned = null;
|
assigned = null;
|
||||||
}
|
};
|
||||||
|
|
||||||
const task = {
|
const task = {
|
||||||
name: formValue.name,
|
name: formValue.name,
|
||||||
reward: formValue.reward,
|
reward: formValue.reward,
|
||||||
assigned
|
assigned
|
||||||
}
|
};
|
||||||
|
|
||||||
if (this.isAddMode) {
|
if (this.isAddMode) {
|
||||||
this.taskService.createTask(task);
|
this.taskService.createTask(task);
|
||||||
@ -79,6 +79,25 @@ export class EditTaskPage implements OnInit {
|
|||||||
this.router.navigate(['/tabs/tasks']);
|
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() {
|
navigateBack() {
|
||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,6 @@
|
|||||||
<div
|
<div
|
||||||
class="amount"
|
class="amount"
|
||||||
[ngClass]="{ 'negative': history.allowance < 0 }"
|
[ngClass]="{ 'negative': history.allowance < 0 }"
|
||||||
>{{ history.allowance }} SP</div>
|
>{{ history.allowance.toFixed(2) }} SP</div>
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user