+2
-2
@@ -33,10 +33,10 @@ export class RecurringDepositsAccountActionsResolver implements Resolve<Object>
|
||||
switch (actionName) {
|
||||
case 'Add Charge':
|
||||
return this.savingsService.getSavingsChargeTemplateResource(recurringDepositAccountId);
|
||||
break;
|
||||
case 'Close':
|
||||
return this.recurringDepositsService.getRecurringDepositAccountActionResource(recurringDepositAccountId, 'close');
|
||||
break;
|
||||
case 'Deposit':
|
||||
return this.recurringDepositsService.getRecurringDepositAccountTransactionTemplateResource(recurringDepositAccountId, 'deposit');
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
<mat-datepicker-toggle matSuffix [for]="closedOnDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #closedOnDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="closeRecurringDepositForm.controls.closedOnDate.hasError('required')">
|
||||
Transaction Date <strong>is required</strong>
|
||||
Closed On <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="depositRecurringDepositForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="column">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Transaction Date</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="transactionDatePicker" required
|
||||
formControlName="transactionDate">
|
||||
<mat-datepicker-toggle matSuffix [for]="transactionDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #transactionDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="depositRecurringDepositForm.controls.transactionDate.hasError('required')">
|
||||
Transaction Date <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Transaction Amount</mat-label>
|
||||
<input matInput required formControlName="transactionAmount">
|
||||
<mat-error *ngIf="depositRecurringDepositForm.controls.transactionAmount.hasError('required')">
|
||||
Transaction Amount <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Payment Type Id</mat-label>
|
||||
<mat-select formControlName="paymentTypeId" required>
|
||||
<mat-option *ngFor="let paymentType of paymentTypes" [value]="paymentType.id">
|
||||
{{ paymentType.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="depositRecurringDepositForm.controls.paymentTypeId.hasError('required')">
|
||||
Payment Type <strong>is required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<div fxFlexFill>
|
||||
<span fxFlex="25%">Show Payment Details</span>
|
||||
<span fxFlex="75%" class="expandCollapsebutton" (click)="toggleDisplay()">
|
||||
<button mat-raised-button color="primary" *ngIf="showPaymentDetails">
|
||||
<i class="fa fa-minus"></i>
|
||||
</button>
|
||||
<button mat-raised-button color="primary" *ngIf="!showPaymentDetails">
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="showPaymentDetails">
|
||||
<mat-form-field>
|
||||
<mat-label> Account #</mat-label>
|
||||
<input matInput formControlName="accountNumber">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Cheque #</mat-label>
|
||||
<input matInput formControlName="chequeNumber">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Routing Code</mat-label>
|
||||
<input matInput formControlName="routingCode">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Reciept #</mat-label>
|
||||
<input matInput formControlName="receiptNumber">
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Bank #</mat-label>
|
||||
<input matInput formControlName="bankNumber">
|
||||
</mat-form-field>
|
||||
</ng-container>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Note</mat-label>
|
||||
<textarea matInput formControlName="note"></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
<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]="!depositRecurringDepositForm.valid">Submit</button>
|
||||
</mat-card-actions>
|
||||
|
||||
</form>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
}
|
||||
|
||||
.expandCollapsebutton {
|
||||
margin-top: -7px;
|
||||
margin-left: 2%;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DepositRecurringDepositsAccountComponent } from './deposit-recurring-deposits-account.component';
|
||||
|
||||
describe('DepositRecurringDepositsAccountComponent', () => {
|
||||
let component: DepositRecurringDepositsAccountComponent;
|
||||
let fixture: ComponentFixture<DepositRecurringDepositsAccountComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DepositRecurringDepositsAccountComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DepositRecurringDepositsAccountComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { RecurringDepositsService } from '../../recurring-deposits.service';
|
||||
|
||||
/**
|
||||
* Deposits Recurring Deposits Account Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-deposit-recurring-deposits-account',
|
||||
templateUrl: './deposit-recurring-deposits-account.component.html',
|
||||
styleUrls: ['./deposit-recurring-deposits-account.component.scss']
|
||||
})
|
||||
export class DepositRecurringDepositsAccountComponent implements OnInit {
|
||||
|
||||
/** Transactions Amount */
|
||||
transactionAmount: any;
|
||||
/** Outstanding Charge Amount */
|
||||
outstandingChargeAmount: any;
|
||||
/** Payment Types */
|
||||
paymentTypes: any;
|
||||
/** Account Id */
|
||||
accountId: string;
|
||||
/** Show payment details */
|
||||
showPaymentDetails = false;
|
||||
/** Minimum Date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum Date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Deposits Recurring Deposit Account form. */
|
||||
depositRecurringDepositForm: FormGroup;
|
||||
|
||||
/**
|
||||
* Retrieves action details transactions template data from `resolve`
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
*/
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe,
|
||||
private recurringDepositsService: RecurringDepositsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { recurringDepositsAccountActionData: any }) => {
|
||||
this.transactionAmount = data.recurringDepositsAccountActionData.amount;
|
||||
this.paymentTypes = data.recurringDepositsAccountActionData.paymentTypeOptions;
|
||||
if (data.recurringDepositsAccountActionData.outstandingChargeAmount && data.recurringDepositsAccountActionData.outstandingChargeAmount > 0) {
|
||||
this.outstandingChargeAmount = data.recurringDepositsAccountActionData.outstandingChargeAmount;
|
||||
this.transactionAmount = this.transactionAmount + this.outstandingChargeAmount;
|
||||
}
|
||||
});
|
||||
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.createdepositRecurringDepositForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the deposits form.
|
||||
*/
|
||||
createdepositRecurringDepositForm() {
|
||||
this.depositRecurringDepositForm = this.formBuilder.group({
|
||||
'transactionDate': [new Date(), Validators.required],
|
||||
'transactionAmount': [this.transactionAmount, Validators.required],
|
||||
'paymentTypeId': ['', Validators.required],
|
||||
'accountNumber': '',
|
||||
'chequeNumber': '',
|
||||
'routingCode': '',
|
||||
'receiptNumber': '',
|
||||
'bankNumber': '',
|
||||
'note': ''
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles the display of payment details
|
||||
*/
|
||||
toggleDisplay() {
|
||||
this.showPaymentDetails = !(this.showPaymentDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the deposits recurring deposit form
|
||||
*/
|
||||
submit() {
|
||||
const transactionDate = this.depositRecurringDepositForm.value.transactionDate;
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const locale = 'en';
|
||||
this.depositRecurringDepositForm.patchValue({
|
||||
transactionDate: this.datePipe.transform(transactionDate, dateFormat)
|
||||
});
|
||||
const data = {
|
||||
...this.depositRecurringDepositForm.value,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'deposit', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -6,3 +6,4 @@
|
||||
<mifosx-add-charge-recurring-deposits-account *ngIf="actions['Add Charge']"></mifosx-add-charge-recurring-deposits-account>
|
||||
<mifosx-premature-close-recurring-deposit-account *ngIf="actions['Premature Close']"></mifosx-premature-close-recurring-deposit-account>
|
||||
<mifosx-close-recurring-deposits-account *ngIf="actions['Close']"></mifosx-close-recurring-deposits-account>
|
||||
<mifosx-deposit-recurring-deposits-account *ngIf="actions['Deposit']"></mifosx-deposit-recurring-deposits-account>
|
||||
|
||||
+3
-1
@@ -18,6 +18,7 @@ export class RecurringDepositsAccountActionsComponent {
|
||||
'Add Charge': boolean
|
||||
'Premature Close': boolean
|
||||
'Close': boolean
|
||||
'Deposit': boolean
|
||||
} = {
|
||||
'Activate': false,
|
||||
'Undo Approval': false,
|
||||
@@ -26,7 +27,8 @@ export class RecurringDepositsAccountActionsComponent {
|
||||
'Withdraw By Client': false,
|
||||
'Add Charge': false,
|
||||
'Premature Close': false,
|
||||
'Close': false
|
||||
'Close': false,
|
||||
'Deposit': false
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+1
@@ -147,6 +147,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
||||
case 'Withdraw By Client':
|
||||
case 'Premature Close':
|
||||
case 'Close':
|
||||
case 'Deposit':
|
||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||
break;
|
||||
case 'Modify Application':
|
||||
|
||||
@@ -38,6 +38,7 @@ import { RecurringDepositConfirmationDialogComponent } from './recurring-deposit
|
||||
import { EditRecurringDepositAccountComponent } from './edit-recurring-deposit-account/edit-recurring-deposit-account.component';
|
||||
import { PrematureCloseRecurringDepositAccountComponent } from './recurring-deposits-account-actions/premature-close-recurring-deposit-account/premature-close-recurring-deposit-account.component';
|
||||
import { CloseRecurringDepositsAccountComponent } from './recurring-deposits-account-actions/close-recurring-deposits-account/close-recurring-deposits-account.component';
|
||||
import { DepositRecurringDepositsAccountComponent } from './recurring-deposits-account-actions/deposit-recurring-deposits-account/deposit-recurring-deposits-account.component';
|
||||
|
||||
|
||||
/**
|
||||
@@ -79,7 +80,8 @@ import { CloseRecurringDepositsAccountComponent } from './recurring-deposits-acc
|
||||
RecurringDepositConfirmationDialogComponent,
|
||||
EditRecurringDepositAccountComponent,
|
||||
PrematureCloseRecurringDepositAccountComponent,
|
||||
CloseRecurringDepositsAccountComponent
|
||||
CloseRecurringDepositsAccountComponent,
|
||||
DepositRecurringDepositsAccountComponent
|
||||
],
|
||||
entryComponents: [
|
||||
RecurringDepositConfirmationDialogComponent
|
||||
|
||||
@@ -112,4 +112,14 @@ export class RecurringDepositsService {
|
||||
const httpParams = new HttpParams().set('command', command);
|
||||
return this.http.get(`/recurringdepositaccounts/${accountId}/template`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the transaction template for the recurring deposits action
|
||||
* @param accountId Account Id
|
||||
* @param command Command
|
||||
*/
|
||||
getRecurringDepositAccountTransactionTemplateResource(accountId: any, command: string): Observable<any> {
|
||||
const httpParams = new HttpParams().set('command', command);
|
||||
return this.http.get(`/recurringdepositaccounts/${accountId}/transactions/template`, { params: httpParams });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user