Savings account status and substatus management (#1606)

Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
José Alberto Hernández
2022-12-26 23:38:53 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent d0dc2aabb2
commit e2fbfc9c2f
23 changed files with 215 additions and 125 deletions
@@ -22,8 +22,8 @@
<div fxFlexFill>
<span fxFlex="40%">From Account</span>
<span
fxFlex="60%">{{ accountTransferTemplateData.fromAccount.productName}}&nbsp;-&nbsp;#{{ accountTransferTemplateData.fromAccount.accountNo }}</span>
<span fxFlex="60%">{{ accountTransferTemplateData.fromAccount.productName}}&nbsp;-&nbsp;#{{
accountTransferTemplateData.fromAccount.accountNo }}</span>
</div>
<div fxFlexFill>
@@ -46,6 +46,17 @@
<div fxLayout="row wrap" fxLayoutGap="2%" fxLayout.lt-md="column">
<mat-form-field fxFlex="98%" (click)="transferDatePicker.open()">
<mat-label>Transaction Date</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="transferDatePicker" required
formControlName="transferDate">
<mat-datepicker-toggle matSuffix [for]="transferDatePicker"></mat-datepicker-toggle>
<mat-datepicker #transferDatePicker></mat-datepicker>
<mat-error *ngIf="makeAccountTransferForm.controls.transferDate.hasError('required')">
Transactions Date is <strong>required</strong>
</mat-error>
</mat-form-field>
<mat-form-field fxFlex="98%">
<mat-label>Office</mat-label>
<mat-select required formControlName="toOfficeId" (selectionChange)="changeEvent()">
@@ -104,20 +115,10 @@
</mat-error>
</mat-form-field>
<mat-form-field fxFlex="98%" (click)="transferDatePicker.open()">
<mat-label>Transaction Date</mat-label>
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="transferDatePicker" required
formControlName="transferDate">
<mat-datepicker-toggle matSuffix [for]="transferDatePicker"></mat-datepicker-toggle>
<mat-datepicker #transferDatePicker></mat-datepicker>
<mat-error *ngIf="makeAccountTransferForm.controls.transferDate.hasError('required')">
Transactions Date is <strong>required</strong>
</mat-error>
</mat-form-field>
<mat-form-field fxFlex="98%">
<mat-label>Description</mat-label>
<textarea matInput formControlName="transferDescription" cdkTextareaAutosize cdkAutosizeMinRows="2"></textarea>
<textarea matInput formControlName="transferDescription" cdkTextareaAutosize
cdkAutosizeMinRows="2"></textarea>
<mat-error *ngIf="makeAccountTransferForm.controls.transferDescription.hasError('required')">
Transfer Description is <strong>required</strong>
</mat-error>
@@ -132,8 +133,8 @@
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../../general']">Cancel</button>
<button mat-raised-button color="primary" [disabled]="!makeAccountTransferForm.valid" *mifosxHasPermission="'CREATE_ACCOUNTTRANSFER'"
(click)="submit()">Submit</button>
<button mat-raised-button color="primary" [disabled]="!makeAccountTransferForm.valid"
*mifosxHasPermission="'CREATE_ACCOUNTTRANSFER'" (click)="submit()">Submit</button>
</mat-card-actions>
</mat-card>
@@ -89,6 +89,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
* Creates and sets the create standing instructions form.
*/
ngOnInit() {
this.maxDate = this.settingsService.businessDate;
this.createMakeAccountTransferForm();
}
@@ -102,7 +103,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
'toAccountType': ['', Validators.required],
'toAccountId': ['', Validators.required],
'transferAmount': [this.accountTransferTemplateData.transferAmount, Validators.required],
'transferDate': ['', Validators.required],
'transferDate': [this.settingsService.businessDate, Validators.required],
'transferDescription': ['', Validators.required],
});
}
@@ -186,7 +187,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
fromOfficeId: this.accountTransferTemplateData.fromClient.officeId
};
this.accountTransfersService.createAccountTransfer(makeAccountTransferData).subscribe(() => {
this.router.navigate(['../../general'], { relativeTo: this.route });
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
@@ -12,7 +12,7 @@
<div fxFlexFill>
<span fxFlex="40%">Transaction Amount:</span>
<span fxFlex="60%">{{ viewAccountTransferData.transferAmount }}</span>
<span fxFlex="60%">{{ viewAccountTransferData.currency.displaySymbol }} {{ viewAccountTransferData.transferAmount | number }} ({{ viewAccountTransferData.currency.code }})</span>
</div>
<div fxFlexFill>
@@ -45,7 +45,7 @@
</div>
<div fxFlexFill>
<span fxFlex="40%">Account #:</span>
<span fxFlex="40%">Account No:</span>
<span fxFlex="60%">{{ viewAccountTransferData.fromAccount.accountNo }}</span>
</div>
@@ -60,7 +60,9 @@
<div fxFlexFill>
<span fxFlex="40%">Client:</span>
<span fxFlex="60%">{{ viewAccountTransferData.toClient.displayName }}</span>
<span fxFlex="60%"><a [href]="transferToClient(viewAccountTransferData.toClient)">
{{ viewAccountTransferData.toClient.displayName }}</a>
</span>
</div>
<div fxFlexFill>
@@ -69,14 +71,19 @@
</div>
<div fxFlexFill>
<span fxFlex="40%">Account #:</span>
<span fxFlex="60%">{{ viewAccountTransferData.toAccount.accountNo }}</span>
<span fxFlex="40%">Account No:</span>
<span fxFlex="60%"><a [href]="transferToAccount(viewAccountTransferData.toClient, viewAccountTransferData.toAccount)">
{{ viewAccountTransferData.toAccount.accountNo }}</a>
</span>
</div>
</div>
</mat-card-content>
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" color="primary" mat-raised-button (click)="goBack()">Back</button>
</mat-card-actions>
</mat-card>
</div>
@@ -1,5 +1,6 @@
/** Angular Imports */
import { Component, OnInit } from '@angular/core';
import { Location } from '@angular/common';
import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
@@ -13,11 +14,25 @@ export class ViewAccountTransferComponent {
/**
* Retrieves the view account transfer data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
* @param {Location} location Location.
*/
constructor(private route: ActivatedRoute) {
constructor(private route: ActivatedRoute,
private location: Location) {
this.route.data.subscribe((data: { viewAccountTransferData: any }) => {
this.viewAccountTransferData = data.viewAccountTransferData;
});
}
transferToClient(toClient: any): string {
return `/#/clients/${toClient.id}`;
}
transferToAccount(toClient: any, toAccount: any): string {
return `/#/clients/${toClient.id}/savings-accounts/${toAccount.id}`;
}
goBack(): void {
this.location.back();
}
}