add way of removing a goal
All checks were successful
Backend Build and Test / build (push) Successful in 2m59s

This commit is contained in:
Huffle 2025-05-26 10:04:22 +02:00
parent e7b4adfa95
commit a4706e6df4
4 changed files with 21 additions and 0 deletions

View File

@ -4,6 +4,11 @@
<ion-title *ngIf="isAddMode">Create Goal</ion-title>
<ion-title *ngIf="!isAddMode && goalId != 0">Edit Goal</ion-title>
<ion-title *ngIf="!isAddMode && goalId == 0">Edit Allowance</ion-title>
<button
*ngIf="!isAddMode && goalId !=0"
class="remove-button"
(click)="deleteAllowance()"
>Delete Goal</button>
</div>
</ion-toolbar>
</ion-header>

View File

@ -2,6 +2,13 @@
display: flex;
}
.remove-button {
background-color: var(--ion-color-primary);
margin-right: 15px;
width: 100px;
margin-bottom: 0;
}
form {
height: 100%;
}

View File

@ -93,4 +93,9 @@ export class EditAllowancePage implements OnInit {
this.router.navigate(['/tabs/allowance', this.userId]);
}
deleteAllowance() {
this.allowanceService.deleteAllowance(this.goalId, this.userId);
this.router.navigate(['/tabs/allowance', this.userId]);
}
}

View File

@ -26,4 +26,8 @@ export class AllowanceService {
updateAllowance(allowance: Partial<Allowance>, allowanceId: number, userId: number) {
this.http.put(`${this.url}/user/${userId}/allowance/${allowanceId}`, allowance).subscribe();
}
deleteAllowance(allowanceId: number, userId: number) {
this.http.delete(`${this.url}/user/${userId}/allowance/${allowanceId}`).subscribe();
}
}