make it so you only can edit weight of main allowance
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
2678280400
commit
8cb9a1d508
@ -34,13 +34,13 @@ export class EditAllowancePage implements OnInit {
|
|||||||
private router: Router
|
private router: Router
|
||||||
) {
|
) {
|
||||||
this.userId = this.route.snapshot.params['id'];
|
this.userId = this.route.snapshot.params['id'];
|
||||||
this.goalId = +this.route.snapshot.params['goalId'];
|
this.goalId = this.route.snapshot.params['goalId'];
|
||||||
this.isAddMode = !this.goalId;
|
this.isAddMode = !this.goalId;
|
||||||
|
|
||||||
this.allowanceService.getAllowanceList(this.userId).subscribe((list) => {
|
this.allowanceService.getAllowanceList(this.userId).subscribe((list) => {
|
||||||
for (let allowance of list) {
|
for (let allowance of list) {
|
||||||
this.possibleColors = this.possibleColors.filter(color => color !== allowance.colour);
|
this.possibleColors = this.possibleColors.filter(color => color !== allowance.colour);
|
||||||
if (!this.isAddMode && this.goalId === allowance.id) {
|
if (!this.isAddMode && +this.goalId === allowance.id) {
|
||||||
this.possibleColors.unshift(allowance.colour);
|
this.possibleColors.unshift(allowance.colour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ export class EditAllowancePage implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (!this.isAddMode) {
|
if (!this.isAddMode) {
|
||||||
this.allowanceService.getAllowanceById(this.goalId, this.userId).subscribe((allowance) => {
|
this.allowanceService.getAllowanceById(this.goalId, this.userId).subscribe((allowance) => {
|
||||||
if (this.goalId === 0) {
|
if (+this.goalId === 0) {
|
||||||
this.form.setValue({
|
this.form.setValue({
|
||||||
name: 'Main Allowance',
|
name: 'Main Allowance',
|
||||||
target: 0,
|
target: 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user