Loan Product creation with Global Configurations (#1777)

Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
José Alberto Hernández
2023-07-05 04:59:20 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent 709b171917
commit 7913707324
10 changed files with 38 additions and 21 deletions
@@ -55,12 +55,12 @@
<ng-container matColumnDef="fromDate"> <ng-container matColumnDef="fromDate">
<th mat-header-cell *matHeaderCellDef mat-sort-header> From Date </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> From Date </th>
<td mat-cell *matCellDef="let floatingRate"> {{ floatingRate.fromDate | dateFormat : 'dd MMMM yyyy' }} </td> <td mat-cell *matCellDef="let floatingRate"> {{ floatingRate.fromDate | dateFormat }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="interestRate"> <ng-container matColumnDef="interestRate">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Interest Rate </th> <th mat-header-cell *matHeaderCellDef mat-sort-header> Interest Rate </th>
<td mat-cell *matCellDef="let floatingRate"> {{ floatingRate.interestRate }} </td> <td mat-cell *matCellDef="let floatingRate"> {{ floatingRate.interestRate | number }} </td>
</ng-container> </ng-container>
<ng-container matColumnDef="isDifferential"> <ng-container matColumnDef="isDifferential">
@@ -1,5 +1,5 @@
/** Angular Imports */ /** Angular Imports */
import { Component, OnInit, QueryList, ViewChild, ViewChildren } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
/** Custom Components */ /** Custom Components */
@@ -42,16 +42,22 @@ export class CreateLoanProductComponent implements OnInit {
private productsService: ProductsService, private productsService: ProductsService,
private settingsService: SettingsService, private settingsService: SettingsService,
private router: Router) { private router: Router) {
this.route.data.subscribe((data: { loanProductsTemplate: any }) => { this.route.data.subscribe((data: { loanProductsTemplate: any, configurations: any }) => {
this.loanProductsTemplate = data.loanProductsTemplate; this.loanProductsTemplate = data.loanProductsTemplate;
const assetAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAccountOptions || []; const assetAccountData = this.loanProductsTemplate.accountingMappingOptions.assetAccountOptions || [];
const liabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.liabilityAccountOptions || []; const liabilityAccountData = this.loanProductsTemplate.accountingMappingOptions.liabilityAccountOptions || [];
this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions = assetAccountData.concat(liabilityAccountData); this.loanProductsTemplate.accountingMappingOptions.assetAndLiabilityAccountOptions = assetAccountData.concat(liabilityAccountData);
data.configurations.globalConfiguration.forEach((config: any) => {
if (config.name === 'days-before-repayment-is-due') {
this.loanProductsTemplate['dueDaysForRepaymentEvent'] = config.value;
} else if (config.name === 'days-after-repayment-is-overdue') {
this.loanProductsTemplate['overDueDaysForRepaymentEvent'] = config.value;
}
});
}); });
} }
ngOnInit() { ngOnInit() { }
}
get loanProductDetailsForm() { get loanProductDetailsForm() {
return this.loanProductDetailsStep.loanProductDetailsForm; return this.loanProductDetailsStep.loanProductDetailsForm;
@@ -421,12 +421,12 @@
<mat-form-field fxFlex="48%"> <mat-form-field fxFlex="48%">
<mat-label>Due days for repayment event</mat-label> <mat-label>Due days for repayment event</mat-label>
<input type="number" matInput matTooltip="Specific days when repayment due notification should be sent." formControlName="dueDaysForRepaymentEvent" [min]="0"> <input type="number" matInput matTooltip="Specific days before when repayment due notification should be sent." formControlName="dueDaysForRepaymentEvent" [min]="0">
</mat-form-field> </mat-form-field>
<mat-form-field fxFlex="48%"> <mat-form-field fxFlex="48%">
<mat-label>OverDue days for repayment event</mat-label> <mat-label>OverDue days for repayment event</mat-label>
<input type="number" matInput matTooltip="Specific days when repayment Overdue notification should be sent." formControlName="overDueDaysForRepaymentEvent" [min]="0"> <input type="number" matInput matTooltip="Specific days when after the repayment Overdue notification should be sent." formControlName="overDueDaysForRepaymentEvent" [min]="0">
</mat-form-field> </mat-form-field>
</div> </div>
@@ -87,8 +87,8 @@ export class LoanProductSettingsStepComponent implements OnInit {
'maxTrancheCount': this.loanProductsTemplate.maxTrancheCount, 'maxTrancheCount': this.loanProductsTemplate.maxTrancheCount,
'outstandingLoanBalance': this.loanProductsTemplate.outstandingLoanBalance, 'outstandingLoanBalance': this.loanProductsTemplate.outstandingLoanBalance,
'dueDaysForRepaymentEvent': this.loanProductsTemplate.dueDaysForRepaymentEvent, 'dueDaysForRepaymentEvent': this.loanProductsTemplate.dueDaysForRepaymentEvent,
'overDueDaysForRepaymentEvent': this.loanProductsTemplate.overDueDaysForRepaymentEvent, 'overDueDaysForRepaymentEvent': this.loanProductsTemplate.overDueDaysForRepaymentEvent
}); });
if (this.loanProductsTemplate.delinquencyBucket) { if (this.loanProductsTemplate.delinquencyBucket) {
this.loanProductSettingsForm.patchValue({ this.loanProductSettingsForm.patchValue({
+3 -1
View File
@@ -128,6 +128,7 @@ import { ShareProductGeneralTabComponent } from './share-products/view-share-pro
import { ShareProductDatatableTabComponent } from './share-products/view-share-product/share-product-datatable-tab/share-product-datatable-tab.component'; import { ShareProductDatatableTabComponent } from './share-products/view-share-product/share-product-datatable-tab/share-product-datatable-tab.component';
import { ShareProductDatatablesResolver } from './share-products/share-product-datatables.resolver'; import { ShareProductDatatablesResolver } from './share-products/share-product-datatables.resolver';
import { ShareProductDatatableResolver } from './share-products/share-product-datatable.resolver'; import { ShareProductDatatableResolver } from './share-products/share-product-datatable.resolver';
import { GlobalConfigurationsResolver } from 'app/system/configurations/global-configurations-tab/global-configurations.resolver';
/** Products Routes */ /** Products Routes */
const routes: Routes = [ const routes: Routes = [
@@ -156,7 +157,8 @@ const routes: Routes = [
component: CreateLoanProductComponent, component: CreateLoanProductComponent,
data: { title: extract('Create Loan Product'), breadcrumb: 'Create' }, data: { title: extract('Create Loan Product'), breadcrumb: 'Create' },
resolve: { resolve: {
loanProductsTemplate: LoanProductsTemplateResolver loanProductsTemplate: LoanProductsTemplateResolver,
configurations: GlobalConfigurationsResolver
} }
}, },
{ {
@@ -74,10 +74,12 @@
{{ transactionData.note }} {{ transactionData.note }}
</div> </div>
<mat-divider *ngIf="transactionData.paymentDetailData" [inset]="true"></mat-divider>
<ng-container *ngIf="transactionData.paymentDetailData"> <ng-container *ngIf="transactionData.paymentDetailData">
<div *ngIf="transactionData.paymentDetailData.paymentType" fxFlex="50%" class="mat-body-strong"> <div *ngIf="transactionData.paymentDetailData.paymentType" fxFlex="50%" class="mat-body-strong">
Payment Type {{ 'Payment Type' | translate }}
</div> </div>
<div *ngIf="transactionData.paymentDetailData.paymentType" fxFlex="50%"> <div *ngIf="transactionData.paymentDetailData.paymentType" fxFlex="50%">
@@ -85,7 +87,7 @@
</div> </div>
<div *ngIf="transactionData.paymentDetailData.accountNumber" fxFlex="50%" class="mat-body-strong"> <div *ngIf="transactionData.paymentDetailData.accountNumber" fxFlex="50%" class="mat-body-strong">
Account No. {{ 'Account No.' | translate }}
</div> </div>
<div *ngIf="transactionData.paymentDetailData.accountNumber" fxFlex="50%"> <div *ngIf="transactionData.paymentDetailData.accountNumber" fxFlex="50%">
@@ -93,7 +95,7 @@
</div> </div>
<div *ngIf="transactionData.paymentDetailData.checkNumber" fxFlex="50%" class="mat-body-strong"> <div *ngIf="transactionData.paymentDetailData.checkNumber" fxFlex="50%" class="mat-body-strong">
Cheque Number {{ 'Cheque Number' | translate }}
</div> </div>
<div *ngIf="transactionData.paymentDetailData.checkNumber" fxFlex="50%"> <div *ngIf="transactionData.paymentDetailData.checkNumber" fxFlex="50%">
@@ -101,7 +103,7 @@
</div> </div>
<div *ngIf="transactionData.paymentDetailData.routingCode" fxFlex="50%" class="mat-body-strong"> <div *ngIf="transactionData.paymentDetailData.routingCode" fxFlex="50%" class="mat-body-strong">
Routing Code {{ 'Routing Code' | translate }}
</div> </div>
<div *ngIf="transactionData.paymentDetailData.routingCode" fxFlex="50%"> <div *ngIf="transactionData.paymentDetailData.routingCode" fxFlex="50%">
@@ -109,7 +111,7 @@
</div> </div>
<div *ngIf="transactionData.paymentDetailData.receiptNumber" fxFlex="50%" class="mat-body-strong"> <div *ngIf="transactionData.paymentDetailData.receiptNumber" fxFlex="50%" class="mat-body-strong">
Receipt No. {{ 'Receipt No.' | translate }}
</div> </div>
<div *ngIf="transactionData.paymentDetailData.receiptNumber" fxFlex="50%"> <div *ngIf="transactionData.paymentDetailData.receiptNumber" fxFlex="50%">
@@ -117,7 +119,7 @@
</div> </div>
<div *ngIf="transactionData.paymentDetailData.bankNumber" fxFlex="50%" class="mat-body-strong"> <div *ngIf="transactionData.paymentDetailData.bankNumber" fxFlex="50%" class="mat-body-strong">
Bank No. {{ 'Bank No.' | translate }}
</div> </div>
<div *ngIf="transactionData.paymentDetailData.bankNumber" fxFlex="50%"> <div *ngIf="transactionData.paymentDetailData.bankNumber" fxFlex="50%">
@@ -60,7 +60,7 @@ export class SearchPageComponent {
this.router.navigate(['clients', entity.parentId, 'shares-accounts', entity.entityId]); this.router.navigate(['clients', entity.parentId, 'shares-accounts', entity.entityId]);
break; break;
case 'SAVING': case 'SAVING':
this.router.navigate(['clients', entity.parentId, 'savings-accounts', entity.entityId, 'general']); this.router.navigate(['clients', entity.parentId, 'savings-accounts', entity.entityId, 'transactions']);
break; break;
case 'LOAN': case 'LOAN':
this.router.navigate(['clients', entity.parentId, 'loans-accounts', entity.entityId, 'general']); this.router.navigate(['clients', entity.parentId, 'loans-accounts', entity.entityId, 'general']);
@@ -1,5 +1,6 @@
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
import { Clipboard } from '@angular/cdk/clipboard'; import { Clipboard } from '@angular/cdk/clipboard';
import { AlertService } from 'app/core/alert/alert.service';
@Component({ @Component({
selector: 'mifosx-external-identifier', selector: 'mifosx-external-identifier',
@@ -15,7 +16,8 @@ export class ExternalIdentifierComponent implements OnInit {
displayL = false; displayL = false;
displayR = true; displayR = true;
constructor(private clipboard: Clipboard) { } constructor(private clipboard: Clipboard,
private alertService: AlertService) { }
ngOnInit(): void { ngOnInit(): void {
this.displayL = (this.display === 'left'); this.displayL = (this.display === 'left');
@@ -31,6 +33,7 @@ export class ExternalIdentifierComponent implements OnInit {
copyValue(): void { copyValue(): void {
this.clipboard.copy(this.externalId); this.clipboard.copy(this.externalId);
this.alertService.alert({ type: 'Clipboard', message: 'Copied: ' + this.externalId });
} }
mouseEnter() { mouseEnter() {
@@ -54,7 +54,9 @@ export class GlobalConfigurationsTabComponent implements OnInit, AfterViewInit {
private router: Router, private router: Router,
private configurationWizardService: ConfigurationWizardService, private configurationWizardService: ConfigurationWizardService,
private popoverService: PopoverService) { private popoverService: PopoverService) {
this.configurationData = this.systemService.getConfigurations(); this.route.data.subscribe((data: { configurations: any }) => {
this.configurationData = data.configurations;
});
} }
/** /**
+3 -1
View File
@@ -475,7 +475,9 @@ const routes: Routes = [
{ {
path: '', path: '',
component: ConfigurationsComponent, component: ConfigurationsComponent,
resolve: {} resolve: {
configurations: GlobalConfigurationsResolver
}
}, },
{ {
path: ':id/edit', path: ':id/edit',