New input control for Transaction Amounts

This commit is contained in:
Jose Alberto Hernandez
2024-06-09 22:38:28 -06:00
committed by Jose Alberto Hernandez
parent 83f9a0e499
commit 9b51ec4694
48 changed files with 318 additions and 122 deletions
@@ -19,13 +19,10 @@
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>{{"labels.inputs.Transaction Amount" | translate}}</mat-label>
<input matInput type="number" required formControlName="transactionAmount">
<mat-error *ngIf="disbursementForm.controls.transactionAmount.hasError('required')">
{{"labels.inputs.Transaction Amount" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mifosx-input-amount [currency]="currency" [isRequired]="true"
[inputFormControl]="disbursementForm.controls.transactionAmount"
[inputLabel]="'Transaction Amount'">
</mifosx-input-amount>
<mat-form-field *ngIf="dataObject.fixedEmiAmount">
<mat-label>{{"labels.inputs.Fixed EMI amount" | translate}}</mat-label>
@@ -4,6 +4,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { Dates } from 'app/core/utils/dates';
import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
import { Currency } from 'app/shared/models/general.model';
@Component({
selector: 'mifosx-disburse-to-savings-account',
@@ -20,6 +21,7 @@ export class DisburseToSavingsAccountComponent implements OnInit {
maxDate = new Date();
/** Disbursement Loan form. */
disbursementForm: UntypedFormGroup;
currency: Currency;
/**
* Get data from `Resolver`.
@@ -40,6 +42,9 @@ export class DisburseToSavingsAccountComponent implements OnInit {
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
this.setDisbursementToSavingsForm();
if (this.dataObject.currency) {
this.currency = this.dataObject.currency;
}
}
/**
@@ -73,6 +78,7 @@ export class DisburseToSavingsAccountComponent implements OnInit {
locale
};
const loanId = this.route.snapshot.params['loanId'];
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.loanActionButtons(loanId, 'disbursetosavings', data).subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
});
@@ -19,13 +19,10 @@
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>{{"labels.inputs.Transaction Amount" | translate}}</mat-label>
<input matInput required formControlName="transactionAmount">
<mat-error *ngIf="disbursementLoanForm.controls.transactionAmount.hasError('required')">
{{"labels.inputs.Transaction Amount" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mifosx-input-amount [currency]="currency" [isRequired]="true"
[inputFormControl]="disbursementLoanForm.controls.transactionAmount"
[inputLabel]="'Transaction Amount'">
</mifosx-input-amount>
<mat-form-field>
<mat-label>{{"labels.inputs.External Id" | translate}}</mat-label>
@@ -7,6 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
import { Currency } from 'app/shared/models/general.model';
/**
* Disburse Loan Option
@@ -31,6 +32,7 @@ export class DisburseComponent implements OnInit {
maxDate = new Date();
/** Disbursement Loan Form */
disbursementLoanForm: UntypedFormGroup;
currency: Currency;
/**
* @param {FormBuilder} formBuilder Form Builder.
@@ -57,6 +59,9 @@ export class DisburseComponent implements OnInit {
this.maxDate = this.settingsService.maxFutureDate;
this.createDisbursementLoanForm();
this.setDisbursementLoanDetails();
if (this.dataObject.currency) {
this.currency = this.dataObject.currency;
}
}
/**
@@ -114,6 +119,7 @@ export class DisburseComponent implements OnInit {
dateFormat,
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.loanActionButtons(this.loanId, 'disburse', data )
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
@@ -19,13 +19,10 @@
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>{{"labels.inputs.Transaction Amount" | translate}}</mat-label>
<input matInput required formControlName="transactionAmount">
<mat-error *ngIf="creditBalanceLoanForm.controls.transactionAmount.hasError('required')">
{{"labels.inputs.Transaction Amount" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mifosx-input-amount [currency]="currency" [isRequired]="true"
[inputFormControl]="creditBalanceLoanForm.controls.transactionAmount"
[inputLabel]="'Transaction Amount'">
</mifosx-input-amount>
<mat-form-field>
<mat-label>{{"labels.inputs.External Id" | translate}}</mat-label>
@@ -4,6 +4,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { Dates } from 'app/core/utils/dates';
import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
import { Currency } from 'app/shared/models/general.model';
@Component({
selector: 'mifosx-loan-credit-balance-refund',
@@ -21,6 +22,7 @@ export class LoanCreditBalanceRefundComponent implements OnInit {
maxDate = new Date();
/** Credit Balance Loan Form */
creditBalanceLoanForm: UntypedFormGroup;
currency: Currency;
/**
* @param {FormBuilder} formBuilder Form Builder.
@@ -46,6 +48,9 @@ export class LoanCreditBalanceRefundComponent implements OnInit {
this.maxDate = this.settingsService.businessDate;
this.createCreditBalanceLoanForm();
this.setCreditBalanceLoanDetails();
if (this.dataObject.currency) {
this.currency = this.dataObject.currency;
}
}
/**
@@ -81,6 +86,7 @@ export class LoanCreditBalanceRefundComponent implements OnInit {
locale
};
const command = this.dataObject.type.code.split('.')[1];
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.submitLoanActionButton(this.loanId, data, command)
.subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
@@ -53,15 +53,10 @@
</div>
</div>
<mat-form-field appearance="fill">
<mat-label>{{"labels.inputs.Transaction Amount" | translate}}</mat-label>
<span matTextSuffix class="m-l-10">{{ dataObject.currency.code }}</span>
<span fxFlex="auto"></span>
<input type="number" matInput required class="right-input" formControlName="transactionAmount">
<mat-error *ngIf="repaymentLoanForm.controls.transactionAmount.hasError('required')">
{{"labels.inputs.Transaction Amount" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mifosx-input-amount [currency]="currency" [isRequired]="true"
[inputFormControl]="repaymentLoanForm.controls.transactionAmount"
[inputLabel]="'Transaction Amount'">
</mifosx-input-amount>
<mat-form-field>
<mat-label>{{"labels.inputs.External Id" | translate}}</mat-label>
@@ -7,6 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
import { Currency } from 'app/shared/models/general.model';
/**
* Loan Make Repayment Component
@@ -31,6 +32,7 @@ export class MakeRepaymentComponent implements OnInit, OnDestroy {
maxDate = new Date();
/** Repayment Loan Form */
repaymentLoanForm: UntypedFormGroup;
currency: Currency | null = null;
/**
* @param {FormBuilder} formBuilder Form Builder.
@@ -56,6 +58,9 @@ export class MakeRepaymentComponent implements OnInit, OnDestroy {
this.maxDate = this.settingsService.businessDate;
this.createRepaymentLoanForm();
this.setRepaymentLoanDetails();
if (this.dataObject.currency) {
this.currency = this.dataObject.currency;
}
}
ngOnDestroy(): void {
@@ -117,6 +122,7 @@ export class MakeRepaymentComponent implements OnInit, OnDestroy {
locale
};
const command = this.dataObject.type.code.split('.')[1];
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.submitLoanActionButton(this.loanId, data, command)
.subscribe((response: any) => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
@@ -53,15 +53,10 @@
</div>
</div>
<mat-form-field appearance="fill">
<mat-label>{{"labels.inputs.Transaction Amount" | translate}}</mat-label>
<span matTextSuffix class="m-l-10">{{ prepayData.currency.code }}</span>
<span fxFlex="auto"></span>
<input type="number" matInput required class="right-input" formControlName="transactionAmount">
<mat-error *ngIf="prepayLoanForm.controls.transactionAmount.hasError('required')">
{{"labels.inputs.Transaction Amount" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mifosx-input-amount [currency]="currency" [isRequired]="true"
[inputFormControl]="prepayLoanForm.controls.transactionAmount"
[inputLabel]="'Transaction Amount'">
</mifosx-input-amount>
<mat-form-field>
<mat-label>{{"labels.inputs.External Id" | translate}}</mat-label>
@@ -7,6 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
import { Currency } from 'app/shared/models/general.model';
/**
@@ -38,6 +39,7 @@ export class PrepayLoanComponent implements OnInit, OnDestroy {
prepayLoanForm: UntypedFormGroup;
prepayData: any;
currency: Currency | null = null;
/**
* @param {FormBuilder} formBuilder Form Builder.
@@ -64,6 +66,9 @@ export class PrepayLoanComponent implements OnInit, OnDestroy {
this.createprepayLoanForm();
this.setPrepayLoanDetails();
this.prepayData = this.dataObject;
if (this.dataObject.currency) {
this.currency = this.dataObject.currency;
}
}
ngOnDestroy(): void {
@@ -139,6 +144,7 @@ export class PrepayLoanComponent implements OnInit, OnDestroy {
dateFormat,
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.submitLoanActionButton(this.loanId, data, 'repayment')
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
@@ -19,15 +19,10 @@
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>{{"labels.inputs.Transaction Amount" | translate}}</mat-label>
<span matTextSuffix class="m-l-10" *ngIf="dataObject.currency">{{ dataObject.currency.code }}</span>
<span fxFlex="auto"></span>
<input type="number" matInput required class="right-input" formControlName="transactionAmount">
<mat-error *ngIf="recoveryRepaymentLoanForm.controls.transactionAmount.hasError('required')">
{{"labels.inputs.Transaction Amount" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mifosx-input-amount [currency]="currency" [isRequired]="true"
[inputFormControl]="recoveryRepaymentLoanForm.controls.transactionAmount"
[inputLabel]="'Transaction Amount'">
</mifosx-input-amount>
<mat-form-field>
<mat-label>{{"labels.inputs.External Id" | translate}}</mat-label>
@@ -7,6 +7,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
import { Currency } from 'app/shared/models/general.model';
/**
* Loan Recovery Repayment Action
@@ -31,6 +32,7 @@ export class RecoveryRepaymentComponent implements OnInit {
maxDate = new Date();
/** Recovery Repayment Loan Form */
recoveryRepaymentLoanForm: UntypedFormGroup;
currency: Currency | null = null;
/**
* @param {FormBuilder} formBuilder Form Builder.
@@ -56,6 +58,9 @@ export class RecoveryRepaymentComponent implements OnInit {
this.maxDate = this.settingsService.businessDate;
this.createRecoveryRepaymentLoanForm();
this.setRecoveryRepaymentLoanDetails();
if (this.dataObject.currency) {
this.currency = this.dataObject.currency;
}
}
/**
@@ -114,6 +119,7 @@ export class RecoveryRepaymentComponent implements OnInit {
dateFormat,
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loanService.submitLoanActionButton(this.loanId, data, 'recoverypayment')
.subscribe((response: any) => {
this.router.navigate(['../../general'], { relativeTo: this.route });
@@ -19,13 +19,10 @@
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>{{"labels.inputs.Transaction Amount" | translate}}</mat-label>
<input matInput required formControlName="transactionAmount">
<mat-error *ngIf="loanInterestForm.controls.transactionAmount.hasError('required')">
{{"labels.inputs.Transaction Amount" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mifosx-input-amount [currency]="currency" [isRequired]="true"
[inputFormControl]="loanInterestForm.controls.transactionAmount"
[inputLabel]="'Transaction Amount'">
</mifosx-input-amount>
<mat-form-field>
<mat-label>{{"labels.inputs.Note" | translate}}</mat-label>
@@ -7,6 +7,7 @@ import { Router, ActivatedRoute } from '@angular/router';
import { LoansService } from 'app/loans/loans.service';
import { Dates } from 'app/core/utils/dates';
import { SettingsService } from 'app/settings/settings.service';
import { Currency } from 'app/shared/models/general.model';
/**
* Waive Interest component.
@@ -26,6 +27,7 @@ export class WaiveInterestComponent implements OnInit {
minDate = new Date(2000, 0, 1);
/** Maximum Date allowed. */
maxDate = new Date();
currency: Currency;
/**
* Get data from `Resolver`.
@@ -44,6 +46,9 @@ export class WaiveInterestComponent implements OnInit {
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
this.setLoanInterestForm();
if (this.dataObject.currency) {
this.currency = this.dataObject.currency;
}
}
/**
@@ -73,6 +78,7 @@ export class WaiveInterestComponent implements OnInit {
dateFormat,
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
const loanId = this.route.snapshot.params['loanId'];
this.loanService.submitLoanActionButton(loanId, data, 'waiveinterest').subscribe((response: any) => {
this.router.navigate(['../../general'], {relativeTo: this.route});
@@ -17,13 +17,10 @@
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>{{"labels.inputs.Transaction Amount" | translate}}</mat-label>
<input type="number" formControlName="transactionAmount" required matInput />
<mat-error *ngIf="editTransactionForm.controls.transactionAmount.hasError('required')">
{{"labels.inputs.Transaction Amount" | translate}} {{"labels.commons.is" | translate}} <strong> {{"labels.commons.required" | translate}} </strong>
</mat-error>
</mat-form-field>
<mifosx-input-amount [currency]="currency" [isRequired]="true"
[inputFormControl]="editTransactionForm.controls.transactionAmount"
[inputLabel]="'Transaction Amount'">
</mifosx-input-amount>
<mat-form-field>
<mat-label>{{"labels.inputs.External Id" | translate}}</mat-label>
@@ -7,6 +7,7 @@ import { Dates } from 'app/core/utils/dates';
/** Custom Services */
import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
import { Currency } from 'app/shared/models/general.model';
/**
* Edit Transaction component.
@@ -38,6 +39,7 @@ export class EditTransactionComponent implements OnInit {
loanAccountId: string;
/** Transaction Template */
transactionTemplateData: any;
currency: Currency;
/**
* Retrieves the Loan Account transaction template data from `resolve`.
@@ -56,6 +58,9 @@ export class EditTransactionComponent implements OnInit {
private settingsService: SettingsService) {
this.route.data.subscribe((data: { loansAccountTransactionTemplate: any }) => {
this.transactionTemplateData = data.loansAccountTransactionTemplate;
if (data.loansAccountTransactionTemplate.currency) {
this.currency = data.loansAccountTransactionTemplate.currency;
}
this.paymentTypeOptions = this.transactionTemplateData.paymentTypeOptions;
});
this.loanAccountId = this.route.snapshot.params['loanId'];
@@ -123,6 +128,7 @@ export class EditTransactionComponent implements OnInit {
dateFormat,
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loansService.executeLoansAccountTransactionsCommand(this.loanAccountId, 'modify', data, this.transactionTemplateData.id)
.subscribe((res: any) => {
this.router.navigate(['../'], { relativeTo: this.route });