Fix display view to Loan disbursement to Savings Account (#1610)

Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
José Alberto Hernández
2022-12-29 17:10:58 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent 6431ede355
commit 85e3d99e9f
12 changed files with 58 additions and 68 deletions
@@ -79,7 +79,7 @@
<mat-label>Link savings</mat-label>
<mat-select formControlName="linkAccountId">
<mat-option *ngFor="let savingaccount of accountLinkingOptions" [value]="savingaccount.id">
{{ savingaccount.productName }}
({{ savingaccount.accountNo }}) {{ savingaccount.productName }}
</mat-option>
</mat-select>
</mat-form-field>
@@ -1,3 +0,0 @@
.container {
max-width: 37rem;
}
@@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DisburseLoanAccountComponent } from './disburse-loan-account.component';
describe('DisburseLoanAccountComponent', () => {
let component: DisburseLoanAccountComponent;
let fixture: ComponentFixture<DisburseLoanAccountComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DisburseLoanAccountComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DisburseLoanAccountComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -21,18 +21,15 @@
<mat-form-field>
<mat-label>Transaction amount</mat-label>
<input matInput required formControlName="transactionAmount">
<input matInput type="number" required formControlName="transactionAmount">
<mat-error *ngIf="disbursementForm.controls.transactionAmount.hasError('required')">
Transaction Amount is <strong>required</strong>
</mat-error>
</mat-form-field>
<mat-form-field *ngIf="dataObject.fixedEmiAmount !== null || dataObject.fixedEmiAmount !== undefined">
<mat-form-field *ngIf="dataObject.fixedEmiAmount">
<mat-label>Fixed EMI amount</mat-label>
<input matInput required formControlName="fixedEmiAmount">
<mat-error *ngIf="disbursementForm.controls.fixedEmiAmount.hasError('required')">
Fixed EMI Amount is <strong>required</strong>
</mat-error>
<input matInput type="number" formControlName="fixedEmiAmount">
</mat-form-field>
<mat-form-field>
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DisburseToSavingsAccountComponent } from './disburse-to-savings-account.component';
describe('DisburseToSavingsAccountComponent', () => {
let component: DisburseToSavingsAccountComponent;
let fixture: ComponentFixture<DisburseToSavingsAccountComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ DisburseToSavingsAccountComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(DisburseToSavingsAccountComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -1,22 +1,16 @@
/** Angular Imports. */
import { Component, OnInit, Input } from '@angular/core';
import { FormBuilder, Validators, FormGroup, FormControl } from '@angular/forms';
import { Component, Input, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
/** Custom Service. */
import { Dates } from 'app/core/utils/dates';
import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
/**
* Disburse To Savings component.
*/
@Component({
selector: 'mifosx-disburse-loan-account',
templateUrl: './disburse-loan-account.component.html',
styleUrls: ['./disburse-loan-account.component.scss']
selector: 'mifosx-disburse-to-savings-account',
templateUrl: './disburse-to-savings-account.component.html',
styleUrls: ['./disburse-to-savings-account.component.scss']
})
export class DisburseLoanAccountComponent implements OnInit {
export class DisburseToSavingsAccountComponent implements OnInit {
@Input() dataObject: any;
@@ -36,11 +30,12 @@ export class DisburseLoanAccountComponent implements OnInit {
* @param {SettingsService} settingsService Settings Service
*/
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private loanService: LoansService,
private settingsService: SettingsService) { }
private route: ActivatedRoute,
private router: Router,
private dateUtils: Dates,
private loanService: LoansService,
private settingsService: SettingsService) {
}
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
@@ -51,12 +46,13 @@ export class DisburseLoanAccountComponent implements OnInit {
* Set Disbursement Loan form.
*/
setDisbursementToSavingsForm() {
console.log(this.dataObject);
this.disbursementForm = this.formBuilder.group({
'actualDisbursementDate': [new Date(), Validators.required],
'transactionAmount': [this.dataObject.amount, Validators.required],
'note': ['', Validators.required]
'note': ['']
});
if (this.dataObject.fixedEmiAmount !== null || this.dataObject.fixedEmiAmount !== undefined) {
if (this.dataObject.fixedEmiAmount) {
this.disbursementForm.addControl('fixedEmiAmount', new FormControl(this.dataObject.fixedEmiAmount, [Validators.required]));
}
}
@@ -79,7 +75,7 @@ export class DisburseLoanAccountComponent implements OnInit {
};
const loanId = this.route.parent.snapshot.params['loanId'];
this.loanService.loanActionButtons(loanId, 'disbursetosavings', data).subscribe((response: any) => {
this.router.navigate(['../../general'], {relativeTo: this.route});
this.router.navigate(['../../general'], { relativeTo: this.route });
});
}
@@ -6,7 +6,6 @@ import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
@@ -15,7 +15,7 @@
<mifosx-recovery-repayment [dataObject]="actionButtonData" *ngIf="actions['Recovery Payment']"></mifosx-recovery-repayment>
<mifosx-view-guarantors [dataObject]="actionButtonData" *ngIf="actions['View Guarantors']"></mifosx-view-guarantors>
<mifosx-create-guarantor [dataObject]="actionButtonData" *ngIf="actions['Create Guarantor']"></mifosx-create-guarantor>
<mifosx-disburse-loan-account [dataObject]="actionButtonData" *ngIf="actions['Disburse To Savings']"></mifosx-disburse-loan-account>
<mifosx-disburse-to-savings-account [dataObject]="actionButtonData" *ngIf="actions['Disburse to Savings']"></mifosx-disburse-to-savings-account>
<mifosx-reject-loan *ngIf="actions['Reject']"></mifosx-reject-loan>
<mifosx-disburse [dataObject]="actionButtonData" *ngIf="actions['Disburse']"></mifosx-disburse>
<mifosx-withdrawn-by-client *ngIf="actions['Withdrawn by Client']"></mifosx-withdrawn-by-client>
@@ -1,6 +1,6 @@
/** Angular Imports. */
import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
/**
* Loan Account Actions component.
@@ -21,7 +21,7 @@ export class LoanAccountActionsComponent {
'Foreclosure': boolean,
'Prepay Loan': boolean,
'Reject': boolean,
'Disburse To Savings': boolean,
'Disburse to Savings': boolean,
'Make Repayment': boolean,
'Waive Interest': boolean,
'Close (as Rescheduled)': boolean,
@@ -50,7 +50,7 @@ export class LoanAccountActionsComponent {
'Foreclosure': false,
'Prepay Loan': false,
'Reject': false,
'Disburse To Savings': false,
'Disburse to Savings': false,
'Make Repayment': false,
'Waive Interest': false,
'Close (as Rescheduled)': false,
@@ -76,11 +76,9 @@ export class LoanAccountActionsComponent {
actionName: any;
/**
* @param router Router.
* @param route Activated Route.
*/
constructor(private router: Router,
private route: ActivatedRoute) {
constructor(private route: ActivatedRoute) {
this.route.data.subscribe(( data: { actionButtonData: any }) => {
this.actionButtonData = data.actionButtonData;
});
@@ -110,7 +110,7 @@ export class LoansViewComponent implements OnInit {
}
if (this.loanDetailsData.canDisburse) {
this.buttonConfig.addButton({
name: 'Disburse To Savings',
name: 'Disburse to Savings',
icon: 'piggy-bank',
taskPermissionName: 'DISBURSETOSAVINGS_LOAN'
});
+3 -3
View File
@@ -43,7 +43,6 @@ import { LoansAccountPreviewStepComponent } from './loans-account-stepper/loans-
import { RecoveryRepaymentComponent } from './loans-view/loan-account-actions/recovery-repayment/recovery-repayment.component';
import { ViewGuarantorsComponent } from './loans-view/loan-account-actions/view-guarantors/view-guarantors.component';
import { CreateGuarantorComponent } from './loans-view/loan-account-actions/create-guarantor/create-guarantor.component';
import { DisburseLoanAccountComponent } from './loans-view/loan-account-actions/disburse-loan-account/disburse-loan-account.component';
import { DisburseComponent } from './loans-view/loan-account-actions/disburse/disburse.component';
import { RejectLoanComponent } from './loans-view/loan-account-actions/reject-loan/reject-loan.component';
import { WithdrawnByClientComponent } from './loans-view/loan-account-actions/withdrawn-by-client/withdrawn-by-client.component';
@@ -74,6 +73,7 @@ import { LoanCreditBalanceRefundComponent } from './loans-view/loan-account-acti
import { LoanDelinquencyTagsTabComponent } from './loans-view/loan-delinquency-tags-tab/loan-delinquency-tags-tab.component';
import { LoansAccountScheduleStepComponent } from './loans-account-stepper/loans-account-schedule-step/loans-account-schedule-step.component';
import { EditRepaymentScheduleComponent } from './loans-view/loan-account-actions/edit-repayment-schedule/edit-repayment-schedule.component';
import { DisburseToSavingsAccountComponent } from './loans-view/loan-account-actions/disburse-to-savings-account/disburse-to-savings-account.component';
/**
* Loans Module
@@ -120,7 +120,6 @@ import { EditRepaymentScheduleComponent } from './loans-view/loan-account-action
ViewGuarantorsComponent,
CreateGuarantorComponent,
LoansAccountViewGuarantorDetailsDialogComponent,
DisburseLoanAccountComponent,
RejectLoanComponent,
DisburseComponent,
WithdrawnByClientComponent,
@@ -146,7 +145,8 @@ import { EditRepaymentScheduleComponent } from './loans-view/loan-account-action
GlimPreviewStepComponent,
LoanDelinquencyTagsTabComponent,
LoansAccountScheduleStepComponent,
EditRepaymentScheduleComponent
EditRepaymentScheduleComponent,
DisburseToSavingsAccountComponent
],
providers: [ ],
})