New input control for Transaction Amounts
This commit is contained in:
committed by
Jose Alberto Hernandez
parent
83f9a0e499
commit
9b51ec4694
@@ -34,6 +34,7 @@ export class SavingsAccountActionsResolver implements Resolve<Object> {
|
||||
return this.savingsService.getSavingsChargeTemplateResource(savingAccountId);
|
||||
case 'Withdrawal':
|
||||
case 'Deposit':
|
||||
case 'Hold Amount':
|
||||
return this.savingsService.getSavingsTransactionTemplateResource(savingAccountId);
|
||||
case 'Close':
|
||||
return forkJoin([
|
||||
|
||||
+4
-7
@@ -31,13 +31,10 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="transactionType.holdamount">
|
||||
<mat-label>{{'labels.inputs.Transaction Amount' | translate}}</mat-label>
|
||||
<input type="number" formControlName="transactionAmount" required matInput />
|
||||
<mat-error *ngIf="manageSavingsAccountForm.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" *ngIf="transactionType.holdamount"
|
||||
[inputFormControl]="manageSavingsAccountForm.controls.transactionAmount"
|
||||
[inputLabel]="'Transaction Amount'">
|
||||
</mifosx-input-amount>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
|
||||
+4
-1
@@ -1,9 +1,10 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Currency } from 'app/shared/models/general.model';
|
||||
import { SystemService } from 'app/system/system.service';
|
||||
|
||||
@Component({
|
||||
@@ -13,6 +14,7 @@ import { SystemService } from 'app/system/system.service';
|
||||
})
|
||||
export class ManageSavingsAccountComponent implements OnInit {
|
||||
|
||||
@Input() currency: Currency;
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
@@ -127,6 +129,7 @@ export class ManageSavingsAccountComponent implements OnInit {
|
||||
locale
|
||||
};
|
||||
command = 'holdAmount';
|
||||
payload['transactionAmount'] = payload['transactionAmount'] * 1;
|
||||
|
||||
this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, command, payload).subscribe((response: any) => {
|
||||
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
<mifosx-savings-account-unassign-staff *ngIf="actions['Unassign Staff']"></mifosx-savings-account-unassign-staff>
|
||||
<mifosx-withdraw-by-client-savings-account *ngIf="actions['Withdrawn by Client']"></mifosx-withdraw-by-client-savings-account>
|
||||
<mifosx-add-charge-savings-account *ngIf="actions['Add Charge']"></mifosx-add-charge-savings-account>
|
||||
<mifosx-savings-transactions [currencyCode]="currencyCode" *ngIf="actions['Withdrawal'] || actions['Deposit']"></mifosx-savings-transactions>
|
||||
<mifosx-savings-transactions *ngIf="actions['Withdrawal'] || actions['Deposit']"></mifosx-savings-transactions>
|
||||
<mifosx-close-savings-account *ngIf="actions['Close']"></mifosx-close-savings-account>
|
||||
<mifosx-apply-annual-fees-savings-account *ngIf="actions['Apply Annual Fees']"></mifosx-apply-annual-fees-savings-account>
|
||||
<mifosx-manage-savings-account *ngIf="actions['Hold Amount'] || actions['Block Account'] || actions['Block Deposit'] || actions['Block Withdrawal']"></mifosx-manage-savings-account>
|
||||
<mifosx-manage-savings-account [currency]="currency"
|
||||
*ngIf="actions['Hold Amount'] || actions['Block Account'] || actions['Block Deposit'] || actions['Block Withdrawal']">
|
||||
</mifosx-manage-savings-account>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/** Angular Imports */
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Currency } from 'app/shared/models/general.model';
|
||||
|
||||
/**
|
||||
* Savings account actions component.
|
||||
@@ -57,7 +58,7 @@ export class SavingAccountActionsComponent {
|
||||
'Unblock Withdrawal': false
|
||||
};
|
||||
|
||||
currencyCode: string;
|
||||
currency: Currency;
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
@@ -65,7 +66,7 @@ export class SavingAccountActionsComponent {
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
|
||||
if (data.savingsAccountActionData) {
|
||||
this.currencyCode = data.savingsAccountActionData.currency.code;
|
||||
this.currency = data.savingsAccountActionData.currency;
|
||||
}
|
||||
});
|
||||
const name = this.route.snapshot.params['name'];
|
||||
|
||||
+4
-9
@@ -20,15 +20,10 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field appearance="fill">
|
||||
<mat-label>{{'labels.inputs.Transaction Amount' | translate}}</mat-label>
|
||||
<span matTextSuffix class="m-l-10">{{ currencyCode }}</span>
|
||||
<span fxFlex="auto"></span>
|
||||
<input type="number" class="right-input" formControlName="transactionAmount" required matInput />
|
||||
<mat-error *ngIf="savingAccountTransactionForm.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]="savingAccountTransactionForm.controls.transactionAmount"
|
||||
[inputLabel]="'Transaction Amount'">
|
||||
</mifosx-input-amount>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>{{'labels.inputs.Payment Type' | translate}}</mat-label>
|
||||
|
||||
+7
-3
@@ -1,5 +1,5 @@
|
||||
/** Angular Imports */
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, UntypedFormControl } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
@@ -7,6 +7,7 @@ import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { SavingsService } from '../../savings.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { Dates } from 'app/core/utils/dates';
|
||||
import { Currency } from 'app/shared/models/general.model';
|
||||
|
||||
/**
|
||||
* Create savings account transactions component.
|
||||
@@ -18,8 +19,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
})
|
||||
export class SavingsAccountTransactionsComponent implements OnInit {
|
||||
|
||||
@Input() currencyCode: string;
|
||||
|
||||
/** Minimum Due Date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum Due Date allowed. */
|
||||
@@ -42,6 +41,7 @@ export class SavingsAccountTransactionsComponent implements OnInit {
|
||||
transactionCommand: string;
|
||||
/** saving account's Id */
|
||||
savingAccountId: string;
|
||||
currency: Currency | null = null;
|
||||
|
||||
/**
|
||||
* Retrieves the Saving Account transaction template data from `resolve`.
|
||||
@@ -60,6 +60,9 @@ export class SavingsAccountTransactionsComponent implements OnInit {
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
|
||||
this.paymentTypeOptions = data.savingsAccountActionData.paymentTypeOptions;
|
||||
if (data.savingsAccountActionData.currency) {
|
||||
this.currency = data.savingsAccountActionData.currency;
|
||||
}
|
||||
});
|
||||
this.transactionCommand = this.route.snapshot.params['name'].toLowerCase();
|
||||
this.transactionType[this.transactionCommand] = true;
|
||||
@@ -122,6 +125,7 @@ export class SavingsAccountTransactionsComponent implements OnInit {
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
data['transactionAmount'] = data['transactionAmount'] * 1;
|
||||
this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, this.transactionCommand, data).subscribe(res => {
|
||||
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
||||
});
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
<h1 mat-dialog-title>Release Amount</h1>
|
||||
<h1 mat-dialog-title>{{'labels.heading.Release Amount' | translate}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<p>Are you sure you want to release this amount ?</p>
|
||||
<p>{{'labels.text.Are you sure you want to release this amount' | translate}}</p>
|
||||
</div>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-dialog-close>Cancel</button>
|
||||
<button mat-raised-button color="warn" [mat-dialog-close]="{ confirm: true }">Confirm</button>
|
||||
<button mat-raised-button mat-dialog-close>{{'labels.buttons.Cancel' | translate}}</button>
|
||||
<button mat-raised-button color="warn" [mat-dialog-close]="{ confirm: true }">{{'labels.buttons.Confirm' | translate}}</button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
<h1 mat-dialog-title>Undo Transaction</h1>
|
||||
<h1 mat-dialog-title>{{'labels.heading.Undo Transaction' | translate}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<p>Are you sure you want to undo this transaction ?</p>
|
||||
<p>{{'labels.text.Are you sure you want to undo this transaction' | translate}}</p>
|
||||
</div>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-dialog-close>Cancel</button>
|
||||
<button mat-raised-button color="warn" [mat-dialog-close]="{ confirm: true }">Confirm</button>
|
||||
<button mat-raised-button mat-dialog-close>{{'labels.buttons.Cancel' | translate}}</button>
|
||||
<button mat-raised-button color="warn" [mat-dialog-close]="{ confirm: true }">{{'labels.buttons.Confirm' | translate}}</button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
+4
-7
@@ -17,13 +17,10 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Transaction Amount</mat-label>
|
||||
<input type="number" formControlName="transactionAmount" required matInput />
|
||||
<mat-error *ngIf="editTransactionForm.controls.transactionAmount.hasError('required')">
|
||||
Transaction Amount is <strong>required</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>Payment Type</mat-label>
|
||||
|
||||
+5
@@ -7,6 +7,7 @@ import { Dates } from 'app/core/utils/dates';
|
||||
/** Custom Services */
|
||||
import { SavingsService } from 'app/savings/savings.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 {
|
||||
savingAccountId: string;
|
||||
/** Transaction Template */
|
||||
transactionTemplateData: any;
|
||||
currency: Currency;
|
||||
|
||||
/**
|
||||
* Retrieves the Saving Account transaction template data from `resolve`.
|
||||
@@ -56,6 +58,9 @@ export class EditTransactionComponent implements OnInit {
|
||||
private settingsService: SettingsService) {
|
||||
this.route.data.subscribe((data: { savingsAccountTransactionTemplate: any }) => {
|
||||
this.transactionTemplateData = data.savingsAccountTransactionTemplate;
|
||||
if (data.savingsAccountTransactionTemplate.currency) {
|
||||
this.currency = data.savingsAccountTransactionTemplate.currency;
|
||||
}
|
||||
this.paymentTypeOptions = this.transactionTemplateData.paymentTypeOptions;
|
||||
});
|
||||
this.savingAccountId = this.route.snapshot.params['savingAccountId'];
|
||||
|
||||
Reference in New Issue
Block a user