+42
@@ -0,0 +1,42 @@
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="applyAnnualFeesForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="column">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Annual Fees Transaction Date</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="dueDatePicker" required formControlName="dueDate">
|
||||
<mat-datepicker-toggle matSuffix [for]="dueDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #dueDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="applyAnnualFeesForm.controls.dueDate.hasError('required')">
|
||||
Due Date is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Amount</mat-label>
|
||||
<input type="number" formControlName="amount" required matInput />
|
||||
<mat-error *ngIf="applyAnnualFeesForm.controls.amount.hasError('required')">
|
||||
Amount is <strong>required</strong>
|
||||
</mat-error>
|
||||
</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]="['../../']">Cancel</button>
|
||||
<button mat-raised-button color="primary" [disabled]="!applyAnnualFeesForm.valid">Confirm</button>
|
||||
</mat-card-actions>
|
||||
|
||||
</form>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ApplyAnnualFeesSavingsAccountComponent } from './apply-annual-fees-savings-account.component';
|
||||
|
||||
describe('ApplyAnnualFeesSavingsAccountComponent', () => {
|
||||
let component: ApplyAnnualFeesSavingsAccountComponent;
|
||||
let fixture: ComponentFixture<ApplyAnnualFeesSavingsAccountComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ApplyAnnualFeesSavingsAccountComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ApplyAnnualFeesSavingsAccountComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
/** 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 { SavingsService } from 'app/savings/savings.service';
|
||||
|
||||
/**
|
||||
* Apply Annual Fees Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-apply-annual-fees-savings-account',
|
||||
templateUrl: './apply-annual-fees-savings-account.component.html',
|
||||
styleUrls: ['./apply-annual-fees-savings-account.component.scss']
|
||||
})
|
||||
export class ApplyAnnualFeesSavingsAccountComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Apply annual fees form. */
|
||||
applyAnnualFeesForm: FormGroup;
|
||||
/** Savings Account Id */
|
||||
accountId: any;
|
||||
/** Annual Fees charge Id */
|
||||
chargeId: any;
|
||||
/** Savings Account Data */
|
||||
savingsAccountData: any;
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {SavingsService} savingsService Savings Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private savingsService: SavingsService,
|
||||
private datePipe: DatePipe,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.accountId = this.route.parent.snapshot.params['savingAccountId'];
|
||||
this.route.parent.data.subscribe((data: { savingsAccountData: any }) => {
|
||||
this.savingsAccountData = data.savingsAccountData;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the apply annual fees form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createApplyAnnualFeesForm();
|
||||
this.applyCharge();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the apply annual fees form.
|
||||
*/
|
||||
createApplyAnnualFeesForm() {
|
||||
this.applyAnnualFeesForm = this.formBuilder.group({
|
||||
'dueDate': ['', Validators.required],
|
||||
'amount': ['']
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Retireves apply annual fees charge for ID and amount.
|
||||
*/
|
||||
applyCharge() {
|
||||
const charges: any[] = this.savingsAccountData.charges;
|
||||
charges.forEach((charge: any) => {
|
||||
if (charge.name === 'Annual fee - INR') {
|
||||
this.chargeId = charge.id;
|
||||
this.applyAnnualFeesForm.get('amount').patchValue(charge.amount);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form and applies the annual fees,
|
||||
* if successful redirects to the saving account.
|
||||
*/
|
||||
submit() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const locale = 'en';
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
const prevApprovedOnDate: Date = this.applyAnnualFeesForm.value.dueDate;
|
||||
this.applyAnnualFeesForm.patchValue({
|
||||
dueDate: this.datePipe.transform(prevApprovedOnDate, dateFormat),
|
||||
});
|
||||
const data = {
|
||||
...this.applyAnnualFeesForm.value,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.savingsService.executeSavingsAccountChargesCommand(this.accountId, 'paycharge', data, this.chargeId).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,3 +9,4 @@
|
||||
<mifosx-add-charge-savings-account *ngIf="actions['Add Charge']"></mifosx-add-charge-savings-account>
|
||||
<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>
|
||||
|
||||
@@ -22,10 +22,11 @@ export class SavingAccountActionsComponent {
|
||||
'Close': boolean
|
||||
'Undo Approval': boolean
|
||||
'Post Interest As On': boolean
|
||||
'Assign Staff': boolean // savings account and template
|
||||
'Assign Staff': boolean
|
||||
'Add Charge': boolean
|
||||
'Unassign Staff': boolean
|
||||
'Withdraw By Client': boolean
|
||||
'Apply Annual Fees': boolean
|
||||
} = {
|
||||
'Approve': false,
|
||||
'Reject': false,
|
||||
@@ -38,7 +39,8 @@ export class SavingAccountActionsComponent {
|
||||
'Assign Staff': false,
|
||||
'Add Charge': false,
|
||||
'Unassign Staff': false,
|
||||
'Withdraw By Client': false
|
||||
'Withdraw By Client': false,
|
||||
'Apply Annual Fees': false
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -128,6 +128,7 @@ export class SavingsAccountViewComponent implements OnInit {
|
||||
case 'Add Charge':
|
||||
case 'Unassign Staff':
|
||||
case 'Withdraw By Client':
|
||||
case 'Apply Annual Fees':
|
||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||
break;
|
||||
case 'Withdraw':
|
||||
|
||||
+60
@@ -63,6 +63,66 @@
|
||||
{{ transactionData.amount }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Note
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ transactionData.note }}
|
||||
</div>
|
||||
|
||||
<ng-container *ngIf="transactionData.paymentDetailData">
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.paymentType" fxFlex="50%" class="mat-body-strong">
|
||||
Payment Type
|
||||
</div>
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.paymentType" fxFlex="50%">
|
||||
{{ transactionData.paymentDetailData.paymentType.name }}
|
||||
</div>
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.accountNumber" fxFlex="50%" class="mat-body-strong">
|
||||
Account No.
|
||||
</div>
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.accountNumber" fxFlex="50%">
|
||||
{{ transactionData.paymentDetailData.accountNumber }}
|
||||
</div>
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.checkNumber" fxFlex="50%" class="mat-body-strong">
|
||||
Cheque Number
|
||||
</div>
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.checkNumber" fxFlex="50%">
|
||||
{{ transactionData.paymentDetailData.checkNumber }}
|
||||
</div>
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.routingCode" fxFlex="50%" class="mat-body-strong">
|
||||
Routing Code
|
||||
</div>
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.routingCode" fxFlex="50%">
|
||||
{{ transactionData.paymentDetailData.routingCode }}
|
||||
</div>
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.receiptNumber" fxFlex="50%" class="mat-body-strong">
|
||||
Receipt No.
|
||||
</div>
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.receiptNumber" fxFlex="50%">
|
||||
{{ transactionData.paymentDetailData.receiptNumber }}
|
||||
</div>
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.bankNumber" fxFlex="50%" class="mat-body-strong">
|
||||
Bank No.
|
||||
</div>
|
||||
|
||||
<div *ngIf="transactionData.paymentDetailData.bankNumber" fxFlex="50%">
|
||||
{{ transactionData.paymentDetailData.bankNumber }}
|
||||
</div>
|
||||
|
||||
</ng-container>
|
||||
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
+1
@@ -12,6 +12,7 @@ import { UndoTransactionDialogComponent } from '../../custom-dialogs/undo-transa
|
||||
|
||||
/**
|
||||
* View Transaction Component.
|
||||
* TODO: Add support for account transfers.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-view-transaction',
|
||||
|
||||
@@ -45,6 +45,7 @@ import { ToggleWithholdTaxDialogComponent } from './savings-account-view/custom-
|
||||
import { ViewRecieptComponent } from './savings-account-view/transactions/view-reciept/view-reciept.component';
|
||||
import { ExportTransactionsComponent } from './savings-account-view/transactions-tab/export-transactions/export-transactions.component';
|
||||
import { EditTransactionComponent } from './savings-account-view/transactions/edit-transaction/edit-transaction.component';
|
||||
import { ApplyAnnualFeesSavingsAccountComponent } from './saving-account-actions/apply-annual-fees-savings-account/apply-annual-fees-savings-account.component';
|
||||
|
||||
|
||||
/**
|
||||
@@ -95,7 +96,8 @@ import { EditTransactionComponent } from './savings-account-view/transactions/ed
|
||||
ToggleWithholdTaxDialogComponent,
|
||||
ViewRecieptComponent,
|
||||
ExportTransactionsComponent,
|
||||
EditTransactionComponent
|
||||
EditTransactionComponent,
|
||||
ApplyAnnualFeesSavingsAccountComponent
|
||||
],
|
||||
entryComponents: [
|
||||
CalculateInterestDialogComponent,
|
||||
|
||||
Reference in New Issue
Block a user