Fix: Discount and payment received were not working

This commit is contained in:
2024-12-16 21:17:58 +05:30
parent a5efcc9061
commit 659fed549a
6 changed files with 64 additions and 66 deletions
@@ -1,45 +1,41 @@
<h2 mat-dialog-title>Receive Payment</h2>
<mat-dialog-content>
<form [formGroup]="form" class="flex flex-col">
@if (this.displayTable) {
<mat-table #table [dataSource]="dataSource" formArrayName="amounts">
<!-- Name Column -->
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef class="bold">Amount</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" (click)="maxAmount(row, i)">{{ row.name }}</mat-cell>
<mat-footer-cell *matFooterCellDef class="bold">Balance</mat-footer-cell>
</ng-container>
<!-- Discount Column -->
<ng-container matColumnDef="amount">
<mat-header-cell *matHeaderCellDef class="center bold" class="flex-auto">{{
amount | currency: 'INR'
}}</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" class="center" [formGroupName]="i" class="flex-auto">
<mat-form-field>
<input matInput type="number" formControlName="amount" autocomplete="off" />
</mat-form-field>
</mat-cell>
<mat-footer-cell *matFooterCellDef class="bold">{{ balance | currency: 'INR' }}</mat-footer-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
<mat-footer-row *matFooterRowDef="displayedColumns"></mat-footer-row>
</mat-table>
}
@if (this.displayReason) {
<mat-form-field class="flex-auto">
<mat-label>Reason</mat-label>
<input
type="text"
matInput
#son
formControlName="son"
autocomplete="off"
(focus)="select(son.value) && son.select()"
(input)="select(son.value)"
/>
</mat-form-field>
}
<mat-table #table [dataSource]="dataSource" formArrayName="amounts" [style.visibility]="this.displayTable ? 'visible': 'hidden'">
<!-- Name Column -->
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef class="bold">Amount</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" (click)="maxAmount(row, i)">{{ row.name }}</mat-cell>
<mat-footer-cell *matFooterCellDef class="bold">Balance</mat-footer-cell>
</ng-container>
<!-- Amount Column -->
<ng-container matColumnDef="amount">
<mat-header-cell *matHeaderCellDef class="center bold" class="flex-auto">{{
amount | currency: 'INR'
}}</mat-header-cell>
<mat-cell *matCellDef="let row; let i = index" class="center" [formGroupName]="i" class="flex-auto">
<mat-form-field>
<input matInput type="number" formControlName="amount" autocomplete="off" />
</mat-form-field>
</mat-cell>
<mat-footer-cell *matFooterCellDef class="bold">{{ balance | currency: 'INR' }}</mat-footer-cell>
</ng-container>
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
<mat-footer-row *matFooterRowDef="displayedColumns"></mat-footer-row>
</mat-table>
<mat-form-field class="flex-auto" [style.visibility]="this.displayReason ? 'visible': 'hidden'">
<mat-label>Reason</mat-label>
<input
type="text"
matInput
#son
formControlName="son"
autocomplete="off"
(focus)="select(son.value) && son.select()"
(input)="select(son.value)"
/>
</mat-form-field>
</form>
</mat-dialog-content>
<mat-dialog-actions align="end">