refactor: loans module (#1237)
This commit is contained in:
+133
-128
@@ -1,156 +1,161 @@
|
||||
<div class="container">
|
||||
<form [formGroup]="newGuarantorForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
<mat-card>
|
||||
|
||||
<div fxLayout="column">
|
||||
<form [formGroup]="newGuarantorForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-checkbox labelPosition="before" formControlName="existingClient">
|
||||
Existing Client
|
||||
</mat-checkbox>
|
||||
<mat-card-content>
|
||||
|
||||
<ng-container *ngIf="!showClientDetailsForm">
|
||||
<div fxLayout="column">
|
||||
|
||||
<mat-form-field fxFlex="30%">
|
||||
<mat-label>Name</mat-label>
|
||||
<input matInput formControlName="name" [matAutocomplete]="clientsAutocomplete">
|
||||
<mat-error *ngIf="newGuarantorForm.controls.name.hasError('required')">
|
||||
Name <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-checkbox labelPosition="before" formControlName="existingClient">
|
||||
Existing Client
|
||||
</mat-checkbox>
|
||||
|
||||
<mat-autocomplete autoActiveFirstOption #clientsAutocomplete="matAutocomplete" [displayWith]="displayClient"
|
||||
(optionSelected)='clientSelected($event.option.value)'>
|
||||
<mat-option *ngFor="let client of clientsData" [value]="client">
|
||||
{{ client.displayName }}
|
||||
</mat-option>
|
||||
</mat-autocomplete>
|
||||
<ng-container *ngIf="!showClientDetailsForm">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Relationship</mat-label>
|
||||
<mat-select formControlName="clientRelationshipTypeId">
|
||||
<mat-option *ngFor="let relationType of relationTypes" [value]="relationType.id">
|
||||
{{ relationType.name }}
|
||||
<mat-form-field fxFlex="30%">
|
||||
<mat-label>Name</mat-label>
|
||||
<input matInput formControlName="name" [matAutocomplete]="clientsAutocomplete">
|
||||
<mat-error *ngIf="newGuarantorForm.controls.name.hasError('required')">
|
||||
Name <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-autocomplete autoActiveFirstOption #clientsAutocomplete="matAutocomplete" [displayWith]="displayClient"
|
||||
(optionSelected)='clientSelected($event.option.value)'>
|
||||
<mat-option *ngFor="let client of clientsData" [value]="client">
|
||||
{{ client.displayName }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<ng-container *ngIf="accountOptions.length > 0">
|
||||
</mat-autocomplete>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Account</mat-label>
|
||||
<mat-select formControlName="savingsId">
|
||||
<mat-option *ngFor="let accountOption of accountOptions" [value]="accountOption.id">
|
||||
{{ accountOption.productName }} - {{ accountOption.accountNo }}
|
||||
<mat-label>Relationship</mat-label>
|
||||
<mat-select formControlName="clientRelationshipTypeId">
|
||||
<mat-option *ngFor="let relationType of relationTypes" [value]="relationType.id">
|
||||
{{ relationType.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<ng-container *ngIf="accountOptions.length > 0">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Account</mat-label>
|
||||
<mat-select formControlName="savingsId">
|
||||
<mat-option *ngFor="let accountOption of accountOptions" [value]="accountOption.id">
|
||||
{{ accountOption.productName }} - {{ accountOption.accountNo }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Amount</mat-label>
|
||||
<input type="number" matInput required formControlName="amount" required>
|
||||
</mat-form-field>
|
||||
|
||||
</ng-container>
|
||||
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="showClientDetailsForm">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Relationship</mat-label>
|
||||
<mat-select formControlName="clientRelationshipTypeId">
|
||||
<mat-option *ngFor="let relationType of relationTypes" [value]="relationType.id">
|
||||
{{ relationType.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Amount</mat-label>
|
||||
<input type="number" matInput required formControlName="amount" required>
|
||||
<mat-label>First Name</mat-label>
|
||||
<input matInput required formControlName="firstname" required>
|
||||
<mat-error *ngIf="newGuarantorForm.controls.firstname.hasError('required')">
|
||||
First Name <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Last Name</mat-label>
|
||||
<input matInput required formControlName="lastname" required>
|
||||
<mat-error *ngIf="newGuarantorForm.controls.lastname.hasError('required')">
|
||||
Last Name <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Date Of Birth</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="dobDatePicker" formControlName="dob">
|
||||
<mat-datepicker-toggle matSuffix [for]="dobDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #dobDatePicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Address Line 1</mat-label>
|
||||
<input matInput formControlName="addressLine1">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Address Line 2</mat-label>
|
||||
<input matInput formControlName="addressLine2">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>City</mat-label>
|
||||
<input matInput formControlName="city">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Zip</mat-label>
|
||||
<input matInput formControlName="zip">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Mobile</mat-label>
|
||||
<input type="number" matInput formControlName="mobileNumber">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Residence Phone #</mat-label>
|
||||
<input type="number" matInput formControlName="housePhoneNumber">
|
||||
</mat-form-field>
|
||||
|
||||
</ng-container>
|
||||
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="showClientDetailsForm">
|
||||
<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]="!newGuarantorForm.valid"
|
||||
*mifosxHasPermission="'CREATE_GUARANTOR'">Submit</button>
|
||||
</mat-card-actions>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Relationship</mat-label>
|
||||
<mat-select formControlName="clientRelationshipTypeId">
|
||||
<mat-option *ngFor="let relationType of relationTypes" [value]="relationType.id">
|
||||
{{ relationType.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</mat-card-content>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>First Name</mat-label>
|
||||
<input matInput required formControlName="firstname" required>
|
||||
<mat-error *ngIf="newGuarantorForm.controls.firstname.hasError('required')">
|
||||
First Name <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Last Name</mat-label>
|
||||
<input matInput required formControlName="lastname" required>
|
||||
<mat-error *ngIf="newGuarantorForm.controls.lastname.hasError('required')">
|
||||
Last Name <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Date Of Birth</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="dobDatePicker" formControlName="dob">
|
||||
<mat-datepicker-toggle matSuffix [for]="dobDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #dobDatePicker></mat-datepicker>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Address Line 1</mat-label>
|
||||
<input matInput formControlName="addressLine1">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Address Line 2</mat-label>
|
||||
<input matInput formControlName="addressLine2">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>City</mat-label>
|
||||
<input matInput formControlName="city">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Zip</mat-label>
|
||||
<input matInput formControlName="zip">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Mobile</mat-label>
|
||||
<input type="number" matInput formControlName="mobileNumber">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Residence Phone #</mat-label>
|
||||
<input type="number" matInput formControlName="housePhoneNumber">
|
||||
</mat-form-field>
|
||||
|
||||
</ng-container>
|
||||
</form>
|
||||
|
||||
<ng-container *ngIf="!(newGuarantorForm.controls.name === undefined)">
|
||||
<div class="mat-table">
|
||||
<div class="mat-header-row">
|
||||
<div class="mat-header-cell">Client Details</div>
|
||||
</div>
|
||||
<div class="mat-row">
|
||||
<div class="mat-cell">Name</div>
|
||||
<div class="mat-cell">{{newGuarantorForm.controls.name.value.displayName}}</div>
|
||||
</div>
|
||||
<div class="mat-row">
|
||||
<div class="mat-cell">Id</div>
|
||||
<div class="mat-cell">{{newGuarantorForm.controls.name.value.id}}</div>
|
||||
</div>
|
||||
<div class="mat-row">
|
||||
<div class="mat-cell">Office</div>
|
||||
<div class="mat-cell">{{newGuarantorForm.controls.name.value.officeName}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</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]="!newGuarantorForm.valid"
|
||||
*mifosxHasPermission="'CREATE_GUARANTOR'">Submit</button>
|
||||
</mat-card-actions>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</form>
|
||||
|
||||
<ng-container *ngIf="!(newGuarantorForm.controls.name === undefined)">
|
||||
<div class="mat-table">
|
||||
<div class="mat-header-row">
|
||||
<div class="mat-header-cell">Client Details</div>
|
||||
</div>
|
||||
<div class="mat-row">
|
||||
<div class="mat-cell">Name</div>
|
||||
<div class="mat-cell">{{newGuarantorForm.controls.name.value.displayName}}</div>
|
||||
</div>
|
||||
<div class="mat-row">
|
||||
<div class="mat-cell">Id</div>
|
||||
<div class="mat-cell">{{newGuarantorForm.controls.name.value.id}}</div>
|
||||
</div>
|
||||
<div class="mat-row">
|
||||
<div class="mat-cell">Office</div>
|
||||
<div class="mat-cell">{{newGuarantorForm.controls.name.value.officeName}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user