feat: create group loan aplication functionality added (#1460)
* feat: create group loan aplication functionality added * lint fixes * lint fix
This commit is contained in:
@@ -72,7 +72,7 @@
|
|||||||
<span *ngIf="groupViewData.clientMembers">
|
<span *ngIf="groupViewData.clientMembers">
|
||||||
<button mat-menu-item *mifosxHasPermission="'CREATE_LOAN'">Bulk JLG Loan Application</button></span>
|
<button mat-menu-item *mifosxHasPermission="'CREATE_LOAN'">Bulk JLG Loan Application</button></span>
|
||||||
<button mat-menu-item *mifosxHasPermission="'CREATE_SAVINGSACCOUNT'" [routerLink]="['savings-accounts', 'create']">Group Saving Application</button>
|
<button mat-menu-item *mifosxHasPermission="'CREATE_SAVINGSACCOUNT'" [routerLink]="['savings-accounts', 'create']">Group Saving Application</button>
|
||||||
<button mat-menu-item *mifosxHasPermission="'CREATE_LOAN'">Group Loan Application</button>
|
<button mat-menu-item *mifosxHasPermission="'CREATE_LOAN'" [routerLink]="['loans-accounts', 'create']">Group Loan Application</button>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
|
|
||||||
<button mat-raised-button [matMenuTriggerFor]="More">More</button>
|
<button mat-raised-button [matMenuTriggerFor]="More">More</button>
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ export class LoansAccountTemplateResolver implements Resolve<Object> {
|
|||||||
* @returns {Observable<any>}
|
* @returns {Observable<any>}
|
||||||
*/
|
*/
|
||||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||||
const clientId = route.parent.parent.paramMap.get('clientId');
|
const entityId = route.parent.parent.paramMap.get('clientId') || route.parent.parent.paramMap.get('groupId');
|
||||||
return this.loansService.getLoansAccountTemplateResource(clientId);
|
const isGroup = (route.parent.parent.paramMap.get('groupId')) ? true : false;
|
||||||
|
return this.loansService.getLoansAccountTemplateResource(entityId, isGroup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,9 +67,10 @@ export class CreateLoansAccountComponent implements OnInit {
|
|||||||
this.loansService.getLoansCollateralTemplateResource(this.loansAccountProductTemplate.loanProductId).subscribe((response: any) => {
|
this.loansService.getLoansCollateralTemplateResource(this.loansAccountProductTemplate.loanProductId).subscribe((response: any) => {
|
||||||
this.collateralOptions = response.loanCollateralOptions;
|
this.collateralOptions = response.loanCollateralOptions;
|
||||||
});
|
});
|
||||||
const clientId = this.loansAccountTemplate.clientId;
|
const entityId = (this.loansAccountTemplate.clientId) ? this.loansAccountTemplate.clientId : this.loansAccountTemplate.group.id;
|
||||||
|
const isGroup = (this.loansAccountTemplate.clientId) ? false : true;
|
||||||
const productId = this.loansAccountProductTemplate.loanProductId;
|
const productId = this.loansAccountProductTemplate.loanProductId;
|
||||||
this.loansService.getLoansAccountTemplateResource(clientId, productId).subscribe((response: any) => {
|
this.loansService.getLoansAccountTemplateResource(entityId, isGroup, productId).subscribe((response: any) => {
|
||||||
this.multiDisburseLoan = response.multiDisburseLoan;
|
this.multiDisburseLoan = response.multiDisburseLoan;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -107,10 +108,8 @@ export class CreateLoansAccountComponent implements OnInit {
|
|||||||
submit() {
|
submit() {
|
||||||
const locale = this.settingsService.language.code;
|
const locale = this.settingsService.language.code;
|
||||||
const dateFormat = this.settingsService.dateFormat;
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
const loanType = 'individual';
|
|
||||||
const loansAccountData = {
|
const loansAccountData = {
|
||||||
...this.loansAccount,
|
...this.loansAccount,
|
||||||
clientId: this.loansAccountTemplate.clientId,
|
|
||||||
charges: this.loansAccount.charges.map((charge: any) => ({
|
charges: this.loansAccount.charges.map((charge: any) => ({
|
||||||
chargeId: charge.id,
|
chargeId: charge.id,
|
||||||
amount: charge.amount,
|
amount: charge.amount,
|
||||||
@@ -131,8 +130,14 @@ export class CreateLoansAccountComponent implements OnInit {
|
|||||||
expectedDisbursementDate: this.dateUtils.formatDate(this.loansAccount.expectedDisbursementDate, dateFormat),
|
expectedDisbursementDate: this.dateUtils.formatDate(this.loansAccount.expectedDisbursementDate, dateFormat),
|
||||||
dateFormat,
|
dateFormat,
|
||||||
locale,
|
locale,
|
||||||
loanType
|
|
||||||
};
|
};
|
||||||
|
if (this.loansAccountTemplate.clientId) {
|
||||||
|
loansAccountData.clientId = this.loansAccountTemplate.clientId;
|
||||||
|
loansAccountData.loanType = 'individual';
|
||||||
|
} else {
|
||||||
|
loansAccountData.groupId = this.loansAccountTemplate.group.id;
|
||||||
|
loansAccountData.loanType = 'group';
|
||||||
|
}
|
||||||
|
|
||||||
if (loansAccountData.syncRepaymentsWithMeeting) {
|
if (loansAccountData.syncRepaymentsWithMeeting) {
|
||||||
loansAccountData.calendarId = this.loansAccountProductTemplate.calendarOptions[0].id;
|
loansAccountData.calendarId = this.loansAccountProductTemplate.calendarOptions[0].id;
|
||||||
|
|||||||
+3
-2
@@ -88,9 +88,10 @@ export class LoansAccountDetailsStepComponent implements OnInit {
|
|||||||
* Fetches loans account product template on productId value changes
|
* Fetches loans account product template on productId value changes
|
||||||
*/
|
*/
|
||||||
buildDependencies() {
|
buildDependencies() {
|
||||||
const clientId = this.loansAccountTemplate.clientId;
|
const entityId = (this.loansAccountTemplate.clientId) ? this.loansAccountTemplate.clientId : this.loansAccountTemplate.group.id;
|
||||||
|
const isGroup = (this.loansAccountTemplate.clientId) ? false : true;
|
||||||
this.loansAccountDetailsForm.get('productId').valueChanges.subscribe((productId: string) => {
|
this.loansAccountDetailsForm.get('productId').valueChanges.subscribe((productId: string) => {
|
||||||
this.loansService.getLoansAccountTemplateResource(clientId, productId).subscribe((response: any) => {
|
this.loansService.getLoansAccountTemplateResource(entityId, isGroup, productId).subscribe((response: any) => {
|
||||||
this.loansAccountProductTemplate.emit(response);
|
this.loansAccountProductTemplate.emit(response);
|
||||||
this.loanOfficerOptions = response.loanOfficerOptions;
|
this.loanOfficerOptions = response.loanOfficerOptions;
|
||||||
this.loanPurposeOptions = response.loanPurposeOptions;
|
this.loanPurposeOptions = response.loanPurposeOptions;
|
||||||
|
|||||||
@@ -268,12 +268,14 @@ export class LoansService {
|
|||||||
* @param {any} clientId Client ID
|
* @param {any} clientId Client ID
|
||||||
* @param {any} productId Product ID
|
* @param {any} productId Product ID
|
||||||
*/
|
*/
|
||||||
getLoansAccountTemplateResource(clientId: any, productId?: any): Observable<any> {
|
getLoansAccountTemplateResource(entityId: any, isGroup: boolean, productId?: any): Observable<any> {
|
||||||
let httpParams = new HttpParams().set('activeOnly', 'true')
|
let httpParams = new HttpParams().set('activeOnly', 'true')
|
||||||
.set('clientId', clientId)
|
.set('staffInSelectedOfficeOnly', 'true');
|
||||||
.set('staffInSelectedOfficeOnly', 'true')
|
|
||||||
.set('templateType', 'individual');
|
|
||||||
httpParams = productId ? httpParams.set('productId', productId) : httpParams;
|
httpParams = productId ? httpParams.set('productId', productId) : httpParams;
|
||||||
|
httpParams = isGroup ? httpParams.set('groupId', entityId)
|
||||||
|
.set('templateType', 'group') :
|
||||||
|
httpParams.set('clientId', entityId)
|
||||||
|
.set('templateType', 'individual');
|
||||||
return this.http.get('/loans/template', { params: httpParams });
|
return this.http.get('/loans/template', { params: httpParams });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user