Feature: Added feature to click a name in receive payment to fill in the amount in that column

This commit is contained in:
2021-03-26 07:20:51 +05:30
parent 095f4fe473
commit 47381527c2
3 changed files with 14 additions and 6 deletions

View File

@ -1,5 +1,5 @@
import { Component, ElementRef, Inject, ViewChild } from '@angular/core';
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { distinctUntilChanged, map, tap } from 'rxjs/operators';
@ -99,4 +99,10 @@ export class ReceivePaymentComponent {
accept(): void {
this.dialogRef.close({ choices: this.choices, reason: this.reason });
}
maxAmount(row: ReceivePaymentItem, index: number) {
const array = this.form.get('amounts') as FormArray;
const ctrl = array.controls[index].get('amount') as FormControl;
ctrl.setValue('' + (row.amount + this.balance));
}
}