WEB-419: Fix layout of Interbank Transfer page (#2786)
This commit is contained in:
+147
-30
@@ -5,6 +5,7 @@
|
|||||||
<div class="left triangle"></div>
|
<div class="left triangle"></div>
|
||||||
<div class="right triangle"></div>
|
<div class="right triangle"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<mat-card *ngIf="!isLoading" class="transfer-card">
|
<mat-card *ngIf="!isLoading" class="transfer-card">
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<!-- Source Account Details Section -->
|
<!-- Source Account Details Section -->
|
||||||
@@ -53,7 +54,7 @@
|
|||||||
<mat-label>{{ 'labels.inputs.Phone Number' | translate }}</mat-label>
|
<mat-label>{{ 'labels.inputs.Phone Number' | translate }}</mat-label>
|
||||||
<input
|
<input
|
||||||
matInput
|
matInput
|
||||||
[disabled]="interbankTransferForm"
|
[readonly]="interbankTransferForm"
|
||||||
type="tel"
|
type="tel"
|
||||||
#input
|
#input
|
||||||
[(ngModel)]="phoneAccount"
|
[(ngModel)]="phoneAccount"
|
||||||
@@ -66,28 +67,27 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--interbank -->
|
||||||
<mat-card-actions *ngIf="!interbankTransferForm" class="action-buttons">
|
<mat-card-actions *ngIf="!interbankTransferForm" class="action-buttons">
|
||||||
<button type="button" mat-raised-button [routerLink]="['../..']" class="cancel-button">
|
<ng-container *mifosxHasPermission="'CREATE_ACCOUNTTRANSFER'">
|
||||||
{{ 'labels.buttons.Cancel' | translate }}
|
<button
|
||||||
</button>
|
mat-raised-button
|
||||||
<button
|
color="primary"
|
||||||
mat-raised-button
|
[disabled]="phoneAccount.length !== 10"
|
||||||
color="primary"
|
(click)="searchAccountByNumber()"
|
||||||
[disabled]="phoneAccount.length !== 10"
|
id="search-button"
|
||||||
(click)="searchAccountByNumber()"
|
class="primary-button"
|
||||||
*mifosxHasPermission="'CREATE_ACCOUNTTRANSFER'"
|
>
|
||||||
id="search-button"
|
{{ 'labels.buttons.Search' | translate }}
|
||||||
class="primary-button"
|
</button>
|
||||||
>
|
</ng-container>
|
||||||
{{ 'labels.buttons.Search' | translate }}
|
|
||||||
</button>
|
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<mat-divider *ngIf="!interbank"></mat-divider>
|
<mat-divider *ngIf="!interbank"></mat-divider>
|
||||||
|
|
||||||
<!-- Transfer Form Section -->
|
<!-- Transfer Form Section (Normal) -->
|
||||||
<form *ngIf="!interbank" [formGroup]="makeAccountTransferForm" class="transfer-form" (ngSubmit)="submit()">
|
<form *ngIf="!interbank && makeAccountTransferForm" [formGroup]="makeAccountTransferForm" class="transfer-form">
|
||||||
<h3 class="section-title transfer-heading">{{ 'labels.heading.Transfer Details' | translate }}</h3>
|
<h3 class="section-title transfer-heading">{{ 'labels.heading.Transfer Details' | translate }}</h3>
|
||||||
|
|
||||||
<div class="form-grid">
|
<div class="form-grid">
|
||||||
@@ -180,6 +180,8 @@
|
|||||||
formControlName="transferAmount"
|
formControlName="transferAmount"
|
||||||
placeholder="Enter amount"
|
placeholder="Enter amount"
|
||||||
title="Transfer amount"
|
title="Transfer amount"
|
||||||
|
min="0.01"
|
||||||
|
step="0.01"
|
||||||
/>
|
/>
|
||||||
<mat-error *ngIf="makeAccountTransferForm.controls.transferAmount.hasError('required')">
|
<mat-error *ngIf="makeAccountTransferForm.controls.transferAmount.hasError('required')">
|
||||||
{{ 'labels.inputs.Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
{{ 'labels.inputs.Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
@@ -207,20 +209,135 @@
|
|||||||
</mat-error>
|
</mat-error>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
<mat-card-actions class="layout-row layout-xs-column layout-align-center gap-5px">
|
|
||||||
<button type="button" mat-raised-button [routerLink]="['../../transactions']">
|
|
||||||
{{ 'labels.buttons.Cancel' | translate }}
|
|
||||||
</button>
|
|
||||||
<button mat-raised-button color="primary" [disabled]="!makeAccountTransferForm.valid">
|
|
||||||
{{ 'labels.buttons.Submit' | translate }}
|
|
||||||
</button>
|
|
||||||
</mat-card-actions>
|
|
||||||
</form>
|
</form>
|
||||||
<mifosx-make-account-interbank-transfers
|
|
||||||
*ngIf="interbank && interbankTransferForm"
|
<!-- Interbank Transfer Form Section -->
|
||||||
[makeAccountTransferForm]="makeAccountTransferForm"
|
<form
|
||||||
[balance]="balance"
|
*ngIf="interbank && interbankTransferForm && makeAccountTransferForm"
|
||||||
></mifosx-make-account-interbank-transfers>
|
[formGroup]="makeAccountTransferForm"
|
||||||
|
class="transfer-form"
|
||||||
|
>
|
||||||
|
<h3 class="section-title transfer-heading">{{ 'labels.heading.Transfer Details' | translate }}</h3>
|
||||||
|
|
||||||
|
<div class="form-grid">
|
||||||
|
<mat-form-field class="form-field" (click)="transferDatePicker.open()">
|
||||||
|
<mat-label>{{ 'labels.inputs.Transaction Date' | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
[min]="minDate"
|
||||||
|
[max]="maxDate"
|
||||||
|
[matDatepicker]="transferDatePicker"
|
||||||
|
required
|
||||||
|
formControlName="transferDate"
|
||||||
|
placeholder="Select date"
|
||||||
|
title="Transaction Date"
|
||||||
|
/>
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="transferDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #transferDatePicker></mat-datepicker>
|
||||||
|
<mat-error *ngIf="makeAccountTransferForm.controls.transferDate.hasError('required')">
|
||||||
|
{{ 'labels.inputs.Transaction Date' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="form-field">
|
||||||
|
<mat-label>{{ 'labels.inputs.Bank' | translate }}</mat-label>
|
||||||
|
<input matInput formControlName="toBank" [readonly]="true" placeholder="Bank" title="Bank" />
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="form-field">
|
||||||
|
<mat-label>{{ 'labels.inputs.Client' | translate }}</mat-label>
|
||||||
|
<input matInput formControlName="toClientId" [readonly]="true" placeholder="Client" title="Client" />
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="form-field">
|
||||||
|
<mat-label>{{ 'labels.inputs.Account Type' | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
matInput
|
||||||
|
formControlName="toAccountType"
|
||||||
|
[readonly]="true"
|
||||||
|
placeholder="Account Type"
|
||||||
|
title="Account Type"
|
||||||
|
/>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="form-field">
|
||||||
|
<mat-label>{{ 'labels.inputs.Account' | translate }}</mat-label>
|
||||||
|
<input matInput formControlName="toAccountId" [readonly]="true" placeholder="Account" title="Account" />
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="form-field">
|
||||||
|
<mat-label>{{ 'labels.inputs.Amount' | translate }}</mat-label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
matInput
|
||||||
|
required
|
||||||
|
formControlName="transferAmount"
|
||||||
|
placeholder="Enter amount"
|
||||||
|
title="Transfer amount"
|
||||||
|
min="0.01"
|
||||||
|
step="0.01"
|
||||||
|
/>
|
||||||
|
<mat-error *ngIf="makeAccountTransferForm.controls.transferAmount.hasError('required')">
|
||||||
|
{{ 'labels.inputs.Amount' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
|
</mat-error>
|
||||||
|
<mat-error *ngIf="makeAccountTransferForm.controls.transferAmount.hasError('min')">
|
||||||
|
{{ 'labels.inputs.Amount' | translate }} {{ 'labels.commons.mustBeAtLeast' | translate }} 0.01
|
||||||
|
</mat-error>
|
||||||
|
<mat-error *ngIf="makeAccountTransferForm.get('transferAmount')?.hasError('amountExceedsBalance')">
|
||||||
|
<fa-icon icon="exclamation-triangle" size="md"></fa-icon>
|
||||||
|
{{ 'errors.validation.msg.savingsproduct.insufficient.balance' | translate: { balance } }}
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field class="form-field description-field">
|
||||||
|
<mat-label>{{ 'labels.inputs.Description' | translate }}</mat-label>
|
||||||
|
<textarea
|
||||||
|
matInput
|
||||||
|
formControlName="transferDescription"
|
||||||
|
cdkTextareaAutosize
|
||||||
|
cdkAutosizeMinRows="2"
|
||||||
|
placeholder="Enter transfer description"
|
||||||
|
title="Transfer description"
|
||||||
|
></textarea>
|
||||||
|
<mat-error *ngIf="makeAccountTransferForm.controls.transferDescription.hasError('required')">
|
||||||
|
{{ 'labels.inputs.Transfer Description' | translate }} {{ 'labels.commons.is' | translate }}
|
||||||
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
</mat-card-content>
|
</mat-card-content>
|
||||||
|
|
||||||
|
<mat-card-actions *ngIf="!isLoading && makeAccountTransferForm" class="action-buttons">
|
||||||
|
<button type="button" mat-raised-button [routerLink]="['../..']" class="cancel-button">
|
||||||
|
{{ 'labels.buttons.Cancel' | translate }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<ng-container *mifosxHasPermission="'CREATE_ACCOUNTTRANSFER'">
|
||||||
|
<button
|
||||||
|
*ngIf="interbank && interbankTransferForm"
|
||||||
|
mat-raised-button
|
||||||
|
color="primary"
|
||||||
|
[disabled]="!makeAccountTransferForm.valid"
|
||||||
|
(click)="submit()"
|
||||||
|
class="primary-button"
|
||||||
|
>
|
||||||
|
{{ 'labels.buttons.Submit' | translate }}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
*ngIf="!interbank"
|
||||||
|
mat-raised-button
|
||||||
|
color="primary"
|
||||||
|
[disabled]="!makeAccountTransferForm.valid"
|
||||||
|
(click)="submit()"
|
||||||
|
class="primary-button"
|
||||||
|
>
|
||||||
|
{{ 'labels.buttons.Submit' | translate }}
|
||||||
|
</button>
|
||||||
|
</ng-container>
|
||||||
|
</mat-card-actions>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+53
-44
@@ -4,11 +4,7 @@
|
|||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
#search-button {
|
// Card styling
|
||||||
background-color: #1074b9;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.transfer-card {
|
.transfer-card {
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
box-shadow: 0 2px 10px rgb(0 0 0 / 8%);
|
box-shadow: 0 2px 10px rgb(0 0 0 / 8%);
|
||||||
@@ -26,7 +22,8 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #333;
|
color: #333;
|
||||||
margin: 0 0 1rem;
|
margin: 0 0 1rem;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0.5rem;
|
||||||
|
border-bottom: 1px solid rgb(0 0 0 / 12%);
|
||||||
|
|
||||||
&.transfer-heading {
|
&.transfer-heading {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@@ -49,9 +46,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
background-color: rgb(0 0 0 / 2%);
|
background-color: rgb(0 0 0 / 2%);
|
||||||
box-shadow: 0 0.5px 1px rgb(0 0 0 / 10%);
|
border-radius: 4px;
|
||||||
border: 1px solid var(--border-color, #ddd);
|
|
||||||
border-radius: 8px;
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: rgb(0 0 0 / 4%);
|
background-color: rgb(0 0 0 / 4%);
|
||||||
@@ -90,29 +85,55 @@ mat-divider {
|
|||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
|
||||||
@media (width >= 768px) {
|
@media (width >= 768px) {
|
||||||
grid-template-columns: repeat(2, 50%);
|
grid-template-columns: repeat(2, 1fr); /* stylelint-disable-line unit-allowed-list */
|
||||||
|
gap: 1.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-row {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
|
||||||
.form-field {
|
.form-field {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
margin-bottom: 0.5rem;
|
||||||
|
|
||||||
|
&:nth-child(odd) {
|
||||||
|
@media (width >= 768px) {
|
||||||
|
margin-right: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:nth-child(even) {
|
||||||
|
@media (width >= 768px) {
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.description-field {
|
&.description-field {
|
||||||
grid-column: 1 / -1;
|
grid-column: 1 / -1;
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
min-height: 80px;
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-form-field {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
// Button styling
|
// Button styling
|
||||||
.action-buttons {
|
.action-buttons {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: flex-end;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
padding: 1rem 1.5rem;
|
padding: 1rem 1.5rem;
|
||||||
margin-top: 0;
|
margin-top: 1rem;
|
||||||
|
|
||||||
@media (width <= 576px) {
|
@media (width <= 576px) {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@@ -120,7 +141,6 @@ mat-divider {
|
|||||||
|
|
||||||
@media (width <= 576px) {
|
@media (width <= 576px) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 300px;
|
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,16 +206,12 @@ mat-divider {
|
|||||||
// Dark theme
|
// Dark theme
|
||||||
// Lower specificity selectors first
|
// Lower specificity selectors first
|
||||||
.dark-theme {
|
.dark-theme {
|
||||||
.info-row {
|
|
||||||
color: #fff !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-label {
|
.info-label {
|
||||||
color: rgb(255 255 255 / 70%) !important;
|
color: rgb(255 255 255 / 70%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-value {
|
.info-value {
|
||||||
color: rgb(255 255 255 / 87%) !important;
|
color: rgb(255 255 255 / 87%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
@@ -233,18 +249,6 @@ mat-divider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Higher specificity selectors
|
// Higher specificity selectors
|
||||||
:host-context(.dark-theme) .info-row {
|
|
||||||
color: #fff !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
:host-context(.dark-theme) .info-label {
|
|
||||||
color: rgb(255 255 255 / 70%) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
:host-context(.dark-theme) .info-value {
|
|
||||||
color: rgb(255 255 255 / 87%) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
:host-context(.dark-theme) .transfer-heading {
|
:host-context(.dark-theme) .transfer-heading {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@@ -266,18 +270,6 @@ mat-divider {
|
|||||||
// Medium specificity selectors
|
// Medium specificity selectors
|
||||||
body.dark-theme {
|
body.dark-theme {
|
||||||
.container {
|
.container {
|
||||||
.info-row {
|
|
||||||
color: #fff !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-label {
|
|
||||||
color: rgb(255 255 255 / 70%) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-value {
|
|
||||||
color: rgb(255 255 255 / 87%) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
@@ -320,3 +312,20 @@ body.dark-theme {
|
|||||||
::ng-deep mat-form-field.error-warn.mat-form-field-invalid .mat-error {
|
::ng-deep mat-form-field.error-warn.mat-form-field-invalid .mat-error {
|
||||||
color: #0009 !important;
|
color: #0009 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-form-field-flex {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.transfer-form .form-field {
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.readonly-field {
|
||||||
|
background-color: rgb(0 0 0 / 2%);
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep .mat-input-element {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|||||||
+101
-24
@@ -1,14 +1,12 @@
|
|||||||
/** Angular Imports */
|
/** Angular Imports */
|
||||||
import { Component, OnInit, AfterViewInit, ViewChild, ElementRef } from '@angular/core';
|
import { Component, OnInit, AfterViewInit } from '@angular/core';
|
||||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import {
|
import {
|
||||||
AbstractControl,
|
AbstractControl,
|
||||||
FormGroup,
|
|
||||||
UntypedFormBuilder,
|
UntypedFormBuilder,
|
||||||
UntypedFormGroup,
|
UntypedFormGroup,
|
||||||
ValidationErrors,
|
ValidationErrors,
|
||||||
Validators,
|
Validators,
|
||||||
ReactiveFormsModule,
|
|
||||||
FormsModule
|
FormsModule
|
||||||
} from '@angular/forms';
|
} from '@angular/forms';
|
||||||
|
|
||||||
@@ -21,11 +19,10 @@ import { Dates } from 'app/core/utils/dates';
|
|||||||
/** Environment Configuration */
|
/** Environment Configuration */
|
||||||
import { environment } from '../../../environments/environment';
|
import { environment } from '../../../environments/environment';
|
||||||
import { MatDivider } from '@angular/material/divider';
|
import { MatDivider } from '@angular/material/divider';
|
||||||
import { MatFormField, MatLabel, MatHint, MatSuffix, MatError } from '@angular/material/form-field';
|
import { MatFormField, MatLabel, MatHint, MatError } from '@angular/material/form-field';
|
||||||
import { MatOption, MatAutocompleteTrigger, MatAutocomplete } from '@angular/material/autocomplete';
|
import { MatAutocompleteTrigger, MatAutocomplete } from '@angular/material/autocomplete';
|
||||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||||
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
|
||||||
import { MakeAccountInterbankTransfersComponent } from '../make-account-interbank-transfers/make-account-interbank-transfers.component';
|
|
||||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,8 +40,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
|||||||
MatAutocompleteTrigger,
|
MatAutocompleteTrigger,
|
||||||
MatAutocomplete,
|
MatAutocomplete,
|
||||||
FaIconComponent,
|
FaIconComponent,
|
||||||
CdkTextareaAutosize,
|
CdkTextareaAutosize
|
||||||
MakeAccountInterbankTransfersComponent
|
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
||||||
@@ -56,7 +52,6 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
maxDate = new Date(2100, 0, 1);
|
maxDate = new Date(2100, 0, 1);
|
||||||
/** Edit Standing Instructions form. */
|
/** Edit Standing Instructions form. */
|
||||||
makeAccountTransferForm: UntypedFormGroup;
|
makeAccountTransferForm: UntypedFormGroup;
|
||||||
//makeAccountInterbankTransferForm: FormGroup;
|
|
||||||
/** To Office Type Data */
|
/** To Office Type Data */
|
||||||
toOfficeTypeData: any;
|
toOfficeTypeData: any;
|
||||||
/** To Client Type Data */
|
/** To Client Type Data */
|
||||||
@@ -77,6 +72,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
interbank: boolean = false;
|
interbank: boolean = false;
|
||||||
/** Reference of phoneAccount search */
|
/** Reference of phoneAccount search */
|
||||||
phoneAccount = '';
|
phoneAccount = '';
|
||||||
|
/** Interbank transfer form flag */
|
||||||
interbankTransferForm: boolean = false;
|
interbankTransferForm: boolean = false;
|
||||||
balance: number = 0;
|
balance: number = 0;
|
||||||
isLoading: boolean = false;
|
isLoading: boolean = false;
|
||||||
@@ -106,6 +102,8 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
this.setOptions();
|
this.setOptions();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Sets the value from the URL */
|
||||||
/** Sets the value from the URL */
|
/** Sets the value from the URL */
|
||||||
setParams() {
|
setParams() {
|
||||||
this.accountType = this.route.snapshot.queryParams['accountType'];
|
this.accountType = this.route.snapshot.queryParams['accountType'];
|
||||||
@@ -119,7 +117,13 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
this.accountTypeId = '2';
|
this.accountTypeId = '2';
|
||||||
this.id = this.route.snapshot.queryParams['savingsId'];
|
this.id = this.route.snapshot.queryParams['savingsId'];
|
||||||
this.interbank = this.route.snapshot.queryParams['interbank'] === 'true';
|
this.interbank = this.route.snapshot.queryParams['interbank'] === 'true';
|
||||||
this.balance = this.router.getCurrentNavigation().extras.state.balance;
|
const navigationBalance = this.router.getCurrentNavigation()?.extras?.state?.balance;
|
||||||
|
const templateBalance =
|
||||||
|
this.accountTransferTemplateData?.fromAccount?.availableBalance ??
|
||||||
|
this.accountTransferTemplateData?.fromAccount?.summary?.accountBalance ??
|
||||||
|
this.accountTransferTemplateData?.fromAccount?.balance ??
|
||||||
|
0;
|
||||||
|
this.balance = typeof navigationBalance === 'number' ? navigationBalance : templateBalance;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
this.accountTypeId = '0';
|
this.accountTypeId = '0';
|
||||||
@@ -133,9 +137,50 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
this.maxDate = this.settingsService.businessDate;
|
this.maxDate = this.settingsService.businessDate;
|
||||||
if (!this.interbank) {
|
if (!this.interbank) {
|
||||||
this.createMakeAccountTransferForm();
|
this.createMakeAccountTransferForm();
|
||||||
|
} else {
|
||||||
|
this.createEmptyInterbankForm();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Crea un formulario vacío para interbank mientras se carga
|
||||||
|
*/
|
||||||
|
createEmptyInterbankForm() {
|
||||||
|
this.makeAccountTransferForm = this.formBuilder.group({
|
||||||
|
toBank: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
toClientId: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
toAccountType: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
toAccountId: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
transferAmount: [
|
||||||
|
0,
|
||||||
|
[
|
||||||
|
Validators.required,
|
||||||
|
Validators.min(0.01),
|
||||||
|
this.amountExceedsBalanceValidator.bind(this)]
|
||||||
|
],
|
||||||
|
transferDate: [
|
||||||
|
this.settingsService.businessDate,
|
||||||
|
Validators.required
|
||||||
|
],
|
||||||
|
transferDescription: [
|
||||||
|
'',
|
||||||
|
Validators.required
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the standing instruction form.
|
* Creates the standing instruction form.
|
||||||
*/
|
*/
|
||||||
@@ -176,25 +221,34 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createMakeAccountInterbankTransferForm(account: any) {
|
createMakeAccountInterbankTransferForm(account: any) {
|
||||||
/* --> */ this.makeAccountTransferForm = this.formBuilder.group({
|
if (!account) {
|
||||||
|
console.error('Account data is undefined');
|
||||||
|
this.isLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultAmount =
|
||||||
|
this.accountTransferTemplateData?.transferAmount > 0 ? this.accountTransferTemplateData.transferAmount : 1;
|
||||||
|
|
||||||
|
this.makeAccountTransferForm = this.formBuilder.group({
|
||||||
toBank: [
|
toBank: [
|
||||||
{ value: account.sourceFspId, disabled: true },
|
account.destinationFspId || '',
|
||||||
Validators.required
|
Validators.required
|
||||||
],
|
],
|
||||||
toClientId: [
|
toClientId: [
|
||||||
{ value: account.firsName + ' ' + account.lastName, disabled: true },
|
(account.firstName || account.firsName || '') + ' ' + (account.lastName || ''),
|
||||||
Validators.required
|
Validators.required
|
||||||
],
|
],
|
||||||
toAccountType: [
|
toAccountType: [
|
||||||
{ value: 'Saving Account', disabled: true },
|
'Saving Account',
|
||||||
Validators.required
|
Validators.required
|
||||||
],
|
],
|
||||||
toAccountId: [
|
toAccountId: [
|
||||||
{ value: account.partyId, disabled: true },
|
account.partyId || '',
|
||||||
Validators.required
|
Validators.required
|
||||||
],
|
],
|
||||||
transferAmount: [
|
transferAmount: [
|
||||||
this.accountTransferTemplateData.transferAmount,
|
defaultAmount,
|
||||||
[
|
[
|
||||||
Validators.required,
|
Validators.required,
|
||||||
Validators.min(0.01),
|
Validators.min(0.01),
|
||||||
@@ -205,7 +259,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
Validators.required
|
Validators.required
|
||||||
],
|
],
|
||||||
transferDescription: [
|
transferDescription: [
|
||||||
'',
|
'Transferencia interbancaria',
|
||||||
Validators.required
|
Validators.required
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -243,7 +297,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
delete dataObj.transferAmount;
|
delete dataObj.transferAmount;
|
||||||
delete dataObj.transferDate;
|
delete dataObj.transferDate;
|
||||||
delete dataObj.transferDescription;
|
delete dataObj.transferDescription;
|
||||||
if (dataObj.toClientId) {
|
if (dataObj.toClientId && typeof dataObj.toClientId === 'object') {
|
||||||
dataObj.toClientId = dataObj.toClientId.id;
|
dataObj.toClientId = dataObj.toClientId.id;
|
||||||
}
|
}
|
||||||
const propNames = Object.getOwnPropertyNames(dataObj);
|
const propNames = Object.getOwnPropertyNames(dataObj);
|
||||||
@@ -260,9 +314,9 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
* Subscribes to Clients search filter:
|
* Subscribes to Clients search filter:
|
||||||
*/
|
*/
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
if (!this.interbank) {
|
if (!this.interbank && this.makeAccountTransferForm) {
|
||||||
this.makeAccountTransferForm.controls.toClientId.valueChanges.subscribe((value: string) => {
|
this.makeAccountTransferForm.controls.toClientId.valueChanges.subscribe((value: any) => {
|
||||||
if (value.length >= 2) {
|
if (typeof value === 'string' && value.length >= 2) {
|
||||||
this.clientsService.getFilteredClients('displayName', 'ASC', true, value).subscribe((data: any) => {
|
this.clientsService.getFilteredClients('displayName', 'ASC', true, value).subscribe((data: any) => {
|
||||||
this.clientsData = data.pageItems;
|
this.clientsData = data.pageItems;
|
||||||
});
|
});
|
||||||
@@ -292,17 +346,26 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
const dateFormat = this.settingsService.dateFormat;
|
const dateFormat = this.settingsService.dateFormat;
|
||||||
const locale = this.settingsService.language.code;
|
const locale = this.settingsService.language.code;
|
||||||
|
|
||||||
|
let toClientIdValue: any;
|
||||||
|
if (typeof this.makeAccountTransferForm.controls.toClientId.value === 'object') {
|
||||||
|
toClientIdValue = this.makeAccountTransferForm.controls.toClientId.value.id;
|
||||||
|
} else {
|
||||||
|
toClientIdValue = this.makeAccountTransferForm.controls.toClientId.value;
|
||||||
|
}
|
||||||
|
|
||||||
const makeAccountTransferData = {
|
const makeAccountTransferData = {
|
||||||
...this.makeAccountTransferForm.value,
|
...this.makeAccountTransferForm.value,
|
||||||
transferDate: this.dateUtils.formatDate(this.makeAccountTransferForm.value.transferDate, dateFormat),
|
transferDate: this.dateUtils.formatDate(this.makeAccountTransferForm.value.transferDate, dateFormat),
|
||||||
dateFormat,
|
dateFormat,
|
||||||
locale,
|
locale,
|
||||||
toClientId: this.makeAccountTransferForm.controls.toClientId.value.id,
|
toClientId: toClientIdValue,
|
||||||
fromAccountId: this.id,
|
fromAccountId: this.id,
|
||||||
fromAccountType: this.accountTypeId,
|
fromAccountType: this.accountTypeId,
|
||||||
fromClientId: this.accountTransferTemplateData.fromClient.id,
|
fromClientId: this.accountTransferTemplateData.fromClient.id,
|
||||||
fromOfficeId: this.accountTransferTemplateData.fromClient.officeId
|
fromOfficeId: this.accountTransferTemplateData.fromClient.officeId
|
||||||
};
|
};
|
||||||
|
|
||||||
this.accountTransfersService.createAccountTransfer(makeAccountTransferData).subscribe(() => {
|
this.accountTransfersService.createAccountTransfer(makeAccountTransferData).subscribe(() => {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
this.router.navigate(['../../transactions'], { relativeTo: this.route });
|
||||||
@@ -311,12 +374,19 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
|
|
||||||
makeInterbankTransfer() {
|
makeInterbankTransfer() {
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
|
|
||||||
|
if (!this.makeAccountTransferForm.valid) {
|
||||||
|
console.error('Interbank form is not valid');
|
||||||
|
this.isLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const payload = {
|
const payload = {
|
||||||
homeTransactionId: crypto.randomUUID(),
|
homeTransactionId: crypto.randomUUID(),
|
||||||
from: {
|
from: {
|
||||||
fspId: environment.fineractPlatformTenantId,
|
fspId: environment.fineractPlatformTenantId,
|
||||||
idType: 'MSISDN',
|
idType: 'MSISDN',
|
||||||
idValue: this.accountTransferTemplateData.fromAccount.externalId.trim()
|
idValue: this.accountTransferTemplateData.fromAccount.externalId?.trim() || ''
|
||||||
},
|
},
|
||||||
to: {
|
to: {
|
||||||
fspId: this.makeAccountTransferForm.controls.toBank.value,
|
fspId: this.makeAccountTransferForm.controls.toBank.value,
|
||||||
@@ -336,6 +406,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
},
|
},
|
||||||
note: this.makeAccountTransferForm.controls.transferDescription.value
|
note: this.makeAccountTransferForm.controls.transferDescription.value
|
||||||
};
|
};
|
||||||
|
|
||||||
this.accountTransfersService.sendInterbankTransfer(JSON.stringify(payload)).subscribe(
|
this.accountTransfersService.sendInterbankTransfer(JSON.stringify(payload)).subscribe(
|
||||||
(trnsfr) => {
|
(trnsfr) => {
|
||||||
if (trnsfr.systemMessage) {
|
if (trnsfr.systemMessage) {
|
||||||
@@ -344,12 +415,17 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
console.error('Interbank transfer error:', error);
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
searchAccountByNumber() {
|
searchAccountByNumber() {
|
||||||
|
if (!this.phoneAccount || this.phoneAccount.length !== 10) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.isLoading = true;
|
this.isLoading = true;
|
||||||
this.accountTransfersService
|
this.accountTransfersService
|
||||||
.getAccountByNumber(this.phoneAccount, this.accountTransferTemplateData.currency.code)
|
.getAccountByNumber(this.phoneAccount, this.accountTransferTemplateData.currency.code)
|
||||||
@@ -359,6 +435,7 @@ export class MakeAccountTransfersComponent implements OnInit, AfterViewInit {
|
|||||||
this.createMakeAccountInterbankTransferForm(acc);
|
this.createMakeAccountInterbankTransferForm(acc);
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
|
console.error('searching account error:', error);
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user