refactor: loans module (#1237)

This commit is contained in:
Muskan Khedia
2020-08-30 19:50:58 +05:30
committed by GitHub
parent d357263c3e
commit 3c858e308c
83 changed files with 1480 additions and 1369 deletions
@@ -1,91 +1,97 @@
<div class="container">
<form [formGroup]="disbursementLoanForm" (ngSubmit)="submit()">
<mat-card>
<mat-card-content>
<form [formGroup]="disbursementLoanForm" (ngSubmit)="submit()">
<div fxLayout="column">
<mat-card-content>
<mat-form-field>
<mat-label>Disbursed On</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="actualDisbursementDatePicker" required formControlName="actualDisbursementDate">
<mat-datepicker-toggle matSuffix [for]="actualDisbursementDatePicker"></mat-datepicker-toggle>
<mat-datepicker #actualDisbursementDatePicker></mat-datepicker>
<mat-error *ngIf="disbursementLoanForm.controls.actualDisbursementDate.hasError('required')">
Disbursed On Date<strong>is required</strong>
</mat-error>
</mat-form-field>
<div fxLayout="column">
<mat-form-field>
<mat-label>Transaction Amount</mat-label>
<input matInput required formControlName="transactionAmount">
<mat-error *ngIf="disbursementLoanForm.controls.transactionAmount.hasError('required')">
Transaction Amount <strong>is required</strong>
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>Disbursed On</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="actualDisbursementDatePicker" required
formControlName="actualDisbursementDate">
<mat-datepicker-toggle matSuffix [for]="actualDisbursementDatePicker"></mat-datepicker-toggle>
<mat-datepicker #actualDisbursementDatePicker></mat-datepicker>
<mat-error *ngIf="disbursementLoanForm.controls.actualDisbursementDate.hasError('required')">
Disbursed On Date<strong>is required</strong>
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>Payment Type</mat-label>
<mat-select formControlName="paymentTypeId">
<mat-option *ngFor="let paymentType of paymentTypes" [value]="paymentType.id">
{{ paymentType.name }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-label>Transaction Amount</mat-label>
<input matInput required formControlName="transactionAmount">
<mat-error *ngIf="disbursementLoanForm.controls.transactionAmount.hasError('required')">
Transaction Amount <strong>is required</strong>
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>Payment Type</mat-label>
<mat-select formControlName="paymentTypeId">
<mat-option *ngFor="let paymentType of paymentTypes" [value]="paymentType.id">
{{ paymentType.name }}
</mat-option>
</mat-select>
</mat-form-field>
<div fxFlexFill>
<span fxFlex="25%">Show Payment Details</span>
<span fxFlex="75%" class="expandCollapsebutton" (click)="addPaymentDetails()">
<button mat-raised-button color="primary" *ngIf="showPaymentDetails">
<i class="fa fa-minus"></i>
</button>
<button mat-raised-button color="primary" *ngIf="!showPaymentDetails">
<i class="fa fa-plus"></i>
</button>
</span>
</div>
<ng-container *ngIf="showPaymentDetails">
<mat-form-field>
<mat-label> Account #</mat-label>
<input matInput formControlName="accountNumber">
</mat-form-field>
<mat-form-field>
<mat-label>Cheque #</mat-label>
<input matInput formControlName="checkNumber">
</mat-form-field>
<mat-form-field>
<mat-label>Routing Code</mat-label>
<input matInput formControlName="routingCode">
</mat-form-field>
<mat-form-field>
<mat-label>Reciept #</mat-label>
<input matInput formControlName="receiptNumber">
</mat-form-field>
<mat-form-field>
<mat-label>Bank #</mat-label>
<input matInput formControlName="bankNumber">
</mat-form-field>
</ng-container>
<mat-form-field>
<mat-label>Note</mat-label>
<textarea matInput formControlName="note"></textarea>
</mat-form-field>
<div fxFlexFill>
<span fxFlex="25%">Show Payment Details</span>
<span fxFlex="75%" class="expandCollapsebutton" (click)="addPaymentDetails()">
<button mat-raised-button color="primary" *ngIf="showPaymentDetails">
<i class="fa fa-minus"></i>
</button>
<button mat-raised-button color="primary" *ngIf="!showPaymentDetails">
<i class="fa fa-plus"></i>
</button>
</span>
</div>
<ng-container *ngIf="showPaymentDetails">
<mat-form-field>
<mat-label> Account #</mat-label>
<input matInput formControlName="accountNumber">
</mat-form-field>
<mat-form-field>
<mat-label>Cheque #</mat-label>
<input matInput formControlName="checkNumber">
</mat-form-field>
<mat-form-field>
<mat-label>Routing Code</mat-label>
<input matInput formControlName="routingCode">
</mat-form-field>
<mat-form-field>
<mat-label>Reciept #</mat-label>
<input matInput formControlName="receiptNumber">
</mat-form-field>
<mat-form-field>
<mat-label>Bank #</mat-label>
<input matInput formControlName="bankNumber">
</mat-form-field>
</ng-container>
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../../general']">Cancel</button>
<button mat-raised-button color="primary" [disabled]="!disbursementLoanForm.valid"
*mifosxHasPermission="'DISBURSE_LOAN'">Submit</button>
</mat-card-actions>
<mat-form-field>
<mat-label>Note</mat-label>
<textarea matInput formControlName="note"></textarea>
</mat-form-field>
</mat-card-content>
</div>
</form>
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../../general']">Cancel</button>
<button mat-raised-button color="primary" [disabled]="!disbursementLoanForm.valid" *mifosxHasPermission="'DISBURSE_LOAN'">Submit</button>
</mat-card-actions>
</mat-card-content>
</form>
</mat-card>
</div>