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,75 +1,80 @@
<div class="container">
<form [formGroup]="rescheduleLoanForm" (ngSubmit)="submit()">
<mat-card>
<mat-card-content>
<form [formGroup]="rescheduleLoanForm" (ngSubmit)="submit()">
<div fxLayout="column">
<mat-card-content>
<mat-form-field>
<mat-label>Reschedule from Installment On</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="rescheduleDatePicker" required formControlName="rescheduleFromDate">
<mat-datepicker-toggle matSuffix [for]="rescheduleDatePicker"></mat-datepicker-toggle>
<mat-datepicker #rescheduleDatePicker></mat-datepicker>
<mat-error *ngIf="rescheduleLoanForm.controls.rescheduleFromDate.hasError('required')">
Reschedule Date <strong>is required</strong>
</mat-error>
</mat-form-field>
<div fxLayout="column">
<mat-form-field>
<mat-label>Reason for Rescheduling</mat-label>
<mat-select formControlName="rescheduleReasonId">
<mat-option *ngFor="let rescheduleReasonCode of codes" [value]="rescheduleReasonCode.id">
{{ rescheduleReasonCode.name }}
</mat-option>
</mat-select>
<mat-error *ngIf="rescheduleLoanForm.controls.rescheduleReasonId.hasError('required')">
Reason for Rescheduling <strong>is required</strong>
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>Submitted On</mat-label>
<input matInput [min]="minDate" [matDatepicker]="submittedDatePicker" required formControlName="submittedOnDate">
<mat-datepicker-toggle matSuffix [for]="submittedDatePicker"></mat-datepicker-toggle>
<mat-datepicker #submittedDatePicker></mat-datepicker>
<mat-error *ngIf="rescheduleLoanForm.controls.submittedOnDate.hasError('required')">
Submitted On Date <strong>is required</strong>
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>Comments</mat-label>
<textarea matInput formControlName="rescheduleReasonComment"></textarea>
</mat-form-field>
<mat-checkbox [formControl]="changeRepaymentDate"> Change Repayment Date </mat-checkbox>
<ng-container *ngIf="changeRepaymentDate.value">
<mat-form-field>
<mat-label>Installment Rescheduled to</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="installmentrescheduledDatePicker" formControlName="adjustedDueDate">
<mat-datepicker-toggle matSuffix [for]="installmentrescheduledDatePicker"></mat-datepicker-toggle>
<mat-datepicker #installmentrescheduledDatePicker></mat-datepicker>
</mat-form-field>
</ng-container>
<mat-checkbox [formControl]="introduceGracePeriods"> Introduce Mid-term grace periods </mat-checkbox>
<ng-container *ngIf="introduceGracePeriods.value">
<mat-form-field>
<mat-label>Principal Grace Periods </mat-label>
<input matInput formControlName="graceOnPrincipal">
<mat-label>Reschedule from Installment On</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="rescheduleDatePicker" required
formControlName="rescheduleFromDate">
<mat-datepicker-toggle matSuffix [for]="rescheduleDatePicker"></mat-datepicker-toggle>
<mat-datepicker #rescheduleDatePicker></mat-datepicker>
<mat-error *ngIf="rescheduleLoanForm.controls.rescheduleFromDate.hasError('required')">
Reschedule Date <strong>is required</strong>
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>Interest Grace Periods </mat-label>
<input matInput formControlName="graceOnInterest">
<mat-label>Reason for Rescheduling</mat-label>
<mat-select formControlName="rescheduleReasonId">
<mat-option *ngFor="let rescheduleReasonCode of codes" [value]="rescheduleReasonCode.id">
{{ rescheduleReasonCode.name }}
</mat-option>
</mat-select>
<mat-error *ngIf="rescheduleLoanForm.controls.rescheduleReasonId.hasError('required')">
Reason for Rescheduling <strong>is required</strong>
</mat-error>
</mat-form-field>
</ng-container>
<mat-checkbox [formControl]="extendRepaymentPeriod"> Extend Repayment Period </mat-checkbox>
<mat-form-field>
<mat-label>Submitted On</mat-label>
<input matInput [min]="minDate" [matDatepicker]="submittedDatePicker" required
formControlName="submittedOnDate">
<mat-datepicker-toggle matSuffix [for]="submittedDatePicker"></mat-datepicker-toggle>
<mat-datepicker #submittedDatePicker></mat-datepicker>
<mat-error *ngIf="rescheduleLoanForm.controls.submittedOnDate.hasError('required')">
Submitted On Date <strong>is required</strong>
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>Comments</mat-label>
<textarea matInput formControlName="rescheduleReasonComment"></textarea>
</mat-form-field>
<mat-checkbox [formControl]="changeRepaymentDate"> Change Repayment Date </mat-checkbox>
<ng-container *ngIf="changeRepaymentDate.value">
<mat-form-field>
<mat-label>Installment Rescheduled to</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="installmentrescheduledDatePicker"
formControlName="adjustedDueDate">
<mat-datepicker-toggle matSuffix [for]="installmentrescheduledDatePicker"></mat-datepicker-toggle>
<mat-datepicker #installmentrescheduledDatePicker></mat-datepicker>
</mat-form-field>
</ng-container>
<mat-checkbox [formControl]="introduceGracePeriods"> Introduce Mid-term grace periods </mat-checkbox>
<ng-container *ngIf="introduceGracePeriods.value">
<mat-form-field>
<mat-label>Principal Grace Periods </mat-label>
<input matInput formControlName="graceOnPrincipal">
</mat-form-field>
<mat-form-field>
<mat-label>Interest Grace Periods </mat-label>
<input matInput formControlName="graceOnInterest">
</mat-form-field>
</ng-container>
<mat-checkbox [formControl]="extendRepaymentPeriod"> Extend Repayment Period </mat-checkbox>
<ng-container *ngIf="extendRepaymentPeriod.value">
<mat-form-field>
<mat-label>Number Of new Repayments</mat-label>
@@ -77,7 +82,7 @@
</mat-form-field>
</ng-container>
<mat-checkbox [formControl]="adjustinterestrates"> Adjust interest rates for remainder of loan </mat-checkbox>
<mat-checkbox [formControl]="adjustinterestrates"> Adjust interest rates for remainder of loan </mat-checkbox>
<ng-container *ngIf="adjustinterestrates.value">
<mat-form-field>
<mat-label>New Interest Rate</mat-label>
@@ -85,15 +90,18 @@
</mat-form-field>
</ng-container>
</div>
</div>
<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]="!rescheduleLoanForm.valid" *mifosxHasPermission="'APPROVE_RESCHEDULELOAN'">Submit</button>
</mat-card-actions>
<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]="!rescheduleLoanForm.valid"
*mifosxHasPermission="'APPROVE_RESCHEDULELOAN'">Submit</button>
</mat-card-actions>
</mat-card-content>
</mat-card-content>
</form>
</form>
</mat-card>
</div>