| @@ -61,7 +61,7 @@ | ||||
|             <div class="buttons"> | ||||
|               <button class="add-button">Add</button> | ||||
|               <!-- <button class="move-button">Move</button> --> | ||||
|               <button class="spend-button" [disabled]="!canFinishGoal(goal)">Finish goal</button> | ||||
|               <button class="spend-button" [disabled]="!canFinishGoal(goal)" (click)="completeGoal(goal.id)">Finish goal</button> | ||||
|             </div> | ||||
|           </div> | ||||
|           <div class="color" [style.--background]="hexToRgb(goal.colour)" [style.width.%]="getPercentage(goal)"></div> | ||||
|   | ||||
| @@ -67,4 +67,9 @@ export class AllowancePage implements ViewWillEnter { | ||||
|   updateAllowance(id: number) { | ||||
|     this.router.navigate(['edit', id], { relativeTo: this.route }); | ||||
|   } | ||||
|  | ||||
|   completeGoal(goalId: number) { | ||||
|     this.allowanceService.completeGoal(goalId, this.id); | ||||
|     this.getAllowance(); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -30,4 +30,8 @@ export class AllowanceService { | ||||
|     deleteAllowance(allowanceId: number, userId: number) { | ||||
|         this.http.delete(`${this.url}/user/${userId}/allowance/${allowanceId}`).subscribe(); | ||||
|     } | ||||
|  | ||||
|     completeGoal(goalId: number, userId: number) { | ||||
|         this.http.post(`${this.url}/user/${userId}/allowance/${goalId}/complete`, {}).subscribe(); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user