+93
@@ -0,0 +1,93 @@
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="savingsChargeForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="column">
|
||||
<mat-form-field>
|
||||
<mat-label>Charge</mat-label>
|
||||
<mat-select required formControlName="chargeId">
|
||||
<mat-option *ngFor="let savingsCharge of savingsChargeOptions" [value]="savingsCharge.id">
|
||||
{{ savingsCharge.name + ' (' + savingsCharge.currency.name + ')' }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="savingsChargeForm.controls.chargeId.hasError('required')">
|
||||
Charge is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<div *ngIf="chargeDetails" fxLayout="column">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Amount</mat-label>
|
||||
<input type=number required matInput formControlName="amount" />
|
||||
<mat-error *ngIf="savingsChargeForm.controls.amount.hasError('required')">
|
||||
Amount is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Charge Calculation</mat-label>
|
||||
<mat-select formControlName="chargeCalculationType">
|
||||
<mat-option *ngFor="let chargeCalculation of chargeDetails.chargeCalculationTypeOptions"
|
||||
[value]="chargeCalculation.id">
|
||||
{{ chargeCalculation.value }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Charge time type</mat-label>
|
||||
<mat-select formControlName="chargeTimeType">
|
||||
<mat-option *ngFor="let chargeTime of chargeDetails.chargeTimeTypeOptions" [value]="chargeTime.id">
|
||||
{{ chargeTime.value }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="savingsChargeForm.contains('dueDate')">
|
||||
<mat-label>Due for collection on</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="savingsChargeForm.controls.dueDate.hasError('required')">
|
||||
Due for collection on is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="savingsChargeForm.contains('feeOnMonthDay')">
|
||||
<mat-label>Due On</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="feeOnMonthDayPicker" required
|
||||
formControlName="feeOnMonthDay">
|
||||
<mat-datepicker-toggle matSuffix [for]="feeOnMonthDayPicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #feeOnMonthDayPicker></mat-datepicker>
|
||||
<mat-error *ngIf="savingsChargeForm.controls.feeOnMonthDay.hasError('required')">
|
||||
Due Date is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="savingsChargeForm.contains('feeInterval')">
|
||||
<mat-label>Repeats Every</mat-label>
|
||||
<input matInput formControlName="feeInterval" />
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<mat-card-actions fxLayoutGap="5px" fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center">
|
||||
<button type="button" mat-raised-button [routerLink]="['../../']">Cancel</button>
|
||||
<button mat-raised-button color="primary" [disabled]="!savingsChargeForm.valid">Submit</button>
|
||||
</mat-card-actions>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</form>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
.container {
|
||||
width: 37rem;
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AddChargeSavingsAccountComponent } from './add-charge-savings-account.component';
|
||||
|
||||
describe('AddChargeSavingsAccountComponent', () => {
|
||||
let component: AddChargeSavingsAccountComponent;
|
||||
let fixture: ComponentFixture<AddChargeSavingsAccountComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AddChargeSavingsAccountComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AddChargeSavingsAccountComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+140
@@ -0,0 +1,140 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators, FormControl } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { SavingsService } from '../../savings.service';
|
||||
|
||||
/**
|
||||
* Add Savings Charge component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-add-charge-savings-account',
|
||||
templateUrl: './add-charge-savings-account.component.html',
|
||||
styleUrls: ['./add-charge-savings-account.component.scss']
|
||||
})
|
||||
export class AddChargeSavingsAccountComponent implements OnInit {
|
||||
|
||||
/** Minimum Due Date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum Due Date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Add Savings Charge form. */
|
||||
savingsChargeForm: FormGroup;
|
||||
/** savings charge options. */
|
||||
savingsChargeOptions: any;
|
||||
/** savings Id of the savings account. */
|
||||
savingAccountId: string;
|
||||
/** charge details */
|
||||
chargeDetails: any;
|
||||
|
||||
/**
|
||||
* Retrieves charge template data from `resolve`
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {SavingsService} savingsService Savings Service
|
||||
*/
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private datePipe: DatePipe,
|
||||
private savingsService: SavingsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
|
||||
this.savingsChargeOptions = data.savingsAccountActionData.chargeOptions;
|
||||
});
|
||||
this.savingAccountId = this.route.parent.snapshot.params['savingAccountId'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the Savings Charge form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createSavingsChargeForm();
|
||||
this.buildDependencies();
|
||||
}
|
||||
|
||||
buildDependencies() {
|
||||
this.savingsChargeForm.controls.chargeId.valueChanges.subscribe(chargeId => {
|
||||
this.savingsService.getChargeTemplate(chargeId).subscribe((data: any) => {
|
||||
this.chargeDetails = data;
|
||||
const chargeTimeType = data.chargeTimeType.id;
|
||||
if (data.chargeTimeType.value === 'Withdrawal Fee' || data.chargeTimeType.value === 'Saving No Activity Fee') {
|
||||
this.chargeDetails.dueDateNotRequired = true;
|
||||
}
|
||||
if (data.chargeTimeType.value === 'Annual Fee' || data.chargeTimeType.value === 'Monthly Fee') {
|
||||
this.chargeDetails.chargeTimeTypeAnnualOrMonth = true;
|
||||
}
|
||||
if (!this.chargeDetails.dueDateNotRequired && !this.chargeDetails.chargeTimeTypeAnnualOrMonth) {
|
||||
this.savingsChargeForm.addControl('dueDate', new FormControl('', Validators.required));
|
||||
} else {
|
||||
this.savingsChargeForm.removeControl('dueDate');
|
||||
}
|
||||
if (!this.chargeDetails.dueDateNotRequired && this.chargeDetails.chargeTimeTypeAnnualOrMonth) {
|
||||
this.savingsChargeForm.addControl('feeOnMonthDay', new FormControl('', Validators.required));
|
||||
} else {
|
||||
this.savingsChargeForm.removeControl('feeOnMonthDay');
|
||||
}
|
||||
if (chargeTimeType.value === 'Monthly Fee') {
|
||||
this.savingsChargeForm.addControl('feeInterval', new FormControl(data.feeInterval, Validators.required));
|
||||
} else {
|
||||
this.savingsChargeForm.removeControl('feeInterval');
|
||||
}
|
||||
this.savingsChargeForm.patchValue({
|
||||
'amount': data.amount,
|
||||
'chargeCalculationType': data.chargeCalculationType.id,
|
||||
'chargeTimeType': data.chargeTimeType.id
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the Savings Charge form.
|
||||
*/
|
||||
createSavingsChargeForm() {
|
||||
this.savingsChargeForm = this.formBuilder.group({
|
||||
'chargeId': ['', Validators.required],
|
||||
'amount': ['', Validators.required],
|
||||
'chargeCalculationType': [{ value: '', disabled: true }],
|
||||
'chargeTimeType': [{ value: '', disabled: true }]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits savings charge.
|
||||
*/
|
||||
submit() {
|
||||
const savingsCharge = this.savingsChargeForm.value;
|
||||
savingsCharge.locale = 'en';
|
||||
if (!savingsCharge.feeInterval) {
|
||||
savingsCharge.feeInterval = this.chargeDetails.feeInterval;
|
||||
}
|
||||
if (this.chargeDetails.dueDateNotRequired !== true) {
|
||||
if (this.chargeDetails.chargeTimeTypeAnnualOrMonth === true) {
|
||||
const monthDayFormat = 'MMMM-dd'; // TODO: Update once language and date settings are setup
|
||||
savingsCharge.monthDayFormat = monthDayFormat;
|
||||
if (savingsCharge.feeOnMonthDay) {
|
||||
const prevDate = this.savingsChargeForm.value.feeOnMonthDay;
|
||||
savingsCharge.feeOnMonthDay = this.datePipe.transform(prevDate, monthDayFormat);
|
||||
}
|
||||
} else {
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
savingsCharge.dateFormat = dateFormat;
|
||||
if (savingsCharge.dueDate) {
|
||||
const prevDate = this.savingsChargeForm.value.dueDate;
|
||||
savingsCharge.dueDate = this.datePipe.transform(prevDate, dateFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.savingsService.createSavingsCharge(this.savingAccountId, 'charges', savingsCharge).subscribe( () => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
<mifosx-approve-savings-account *ngIf="actions['Approve']"></mifosx-approve-savings-account>
|
||||
<mifosx-reject-savings-account *ngIf="actions['Reject']"></mifosx-reject-savings-account>
|
||||
<mifosx-withdraw-savings-account *ngIf="actions['Withdraw']"></mifosx-withdraw-savings-account>
|
||||
<mifosx-activate-savings-account *ngIf="actions['Activate']"></mifosx-activate-savings-account>
|
||||
<mifosx-undo-approval-savings-account *ngIf="actions['Undo Approval']"></mifosx-undo-approval-savings-account>
|
||||
<mifosx-post-interest-as-on-savings-account *ngIf="actions['Post Interest As On']"></mifosx-post-interest-as-on-savings-account>
|
||||
<mifosx-savings-account-assign-staff [savingsAccountData]="savingsAccountData" *ngIf="actions['Assign Staff']"></mifosx-savings-account-assign-staff>
|
||||
<mifosx-savings-account-assign-staff *ngIf="actions['Assign Staff']"></mifosx-savings-account-assign-staff>
|
||||
<mifosx-savings-account-unassign-staff *ngIf="actions['Unassign Staff']"></mifosx-savings-account-unassign-staff>
|
||||
<mifosx-withdraw-by-client-savings-account *ngIf="actions['Withdraw 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 *ngIf="actions['Withdrawal'] || actions['Deposit']"></mifosx-savings-transactions>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/** Angular Imports */
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { SavingsService } from '../savings.service';
|
||||
|
||||
/**
|
||||
* Savings account actions component.
|
||||
@@ -13,41 +12,39 @@ import { SavingsService } from '../savings.service';
|
||||
})
|
||||
export class SavingAccountActionsComponent {
|
||||
|
||||
/** Savings Account Data */
|
||||
savingsAccountData: any;
|
||||
/** Flag object to store possible actions and render appropriate UI to the user */
|
||||
actions: {
|
||||
'Approve': boolean
|
||||
'Reject': boolean
|
||||
'Withdraw': boolean
|
||||
'Withdrawal': boolean
|
||||
'Deposit': boolean
|
||||
'Activate': boolean
|
||||
'Undo Approval': boolean
|
||||
'Post Interest As On': boolean
|
||||
'Assign Staff': boolean
|
||||
'Assign Staff': boolean // savings account and template
|
||||
'Add Charge': boolean
|
||||
'Unassign Staff': boolean
|
||||
'Withdraw By Client': boolean
|
||||
} = {
|
||||
'Approve': false,
|
||||
'Reject': false,
|
||||
'Withdraw': false,
|
||||
'Withdrawal': false,
|
||||
'Deposit': false,
|
||||
'Activate': false,
|
||||
'Undo Approval': false,
|
||||
'Post Interest As On': false,
|
||||
'Assign Staff': false,
|
||||
'Unassign Staff': false
|
||||
'Add Charge': false,
|
||||
'Unassign Staff': false,
|
||||
'Withdraw By Client': false
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {SavingsService} savingsService Savings Service
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private savingsService: SavingsService) {
|
||||
constructor(private route: ActivatedRoute) {
|
||||
const name = this.route.snapshot.params['name'];
|
||||
const accountId = this.route.parent.snapshot.params['savingAccountId'];
|
||||
this.savingsService.getSavingsAccountAndTemplate(accountId, true).subscribe((response: any) => {
|
||||
this.savingsAccountData = response;
|
||||
this.actions[name] = true;
|
||||
});
|
||||
this.actions[name] = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-3
@@ -17,9 +17,6 @@ import { SavingsService } from 'app/savings/savings.service';
|
||||
})
|
||||
export class SavingsAccountAssignStaffComponent implements OnInit {
|
||||
|
||||
/** Savings Account Data */
|
||||
@Input() savingsAccountData: any;
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
@@ -30,6 +27,8 @@ export class SavingsAccountAssignStaffComponent implements OnInit {
|
||||
accountId: any;
|
||||
/** Field Officer Data */
|
||||
fieldOfficerData: any;
|
||||
/** Savings Account Data */
|
||||
savingsAccountData: any;
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
@@ -44,6 +43,9 @@ export class SavingsAccountAssignStaffComponent implements OnInit {
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.accountId = this.route.parent.snapshot.params['savingAccountId'];
|
||||
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
|
||||
this.savingsAccountData = data.savingsAccountActionData;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+71
-65
@@ -1,83 +1,89 @@
|
||||
<div class="container">
|
||||
<h2 mat-title *ngIf="transactionType.withdrawal">Withdraw Money From Saving Account</h2>
|
||||
<h2 mat-title *ngIf="transactionType.deposit">Deposit Money To Saving Account</h2>
|
||||
|
||||
<form [formGroup]="savingAccountTransactionForm" (ngSubmit)="submit()">
|
||||
<mat-card>
|
||||
|
||||
<mat-card-content fxLayout="column">
|
||||
<h2 mat-title *ngIf="transactionType.withdrawal">Withdraw Money From Saving Account</h2>
|
||||
<h2 mat-title *ngIf="transactionType.deposit">Deposit Money To Saving Account</h2>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Transaction Date</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="dueDatePicker"
|
||||
formControlName="transactionDate" required>
|
||||
<mat-datepicker-toggle matSuffix [for]="dueDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #dueDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="savingAccountTransactionForm.controls.transactionDate.hasError('required')">
|
||||
Transaction Date is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<form [formGroup]="savingAccountTransactionForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Transaction Amount</mat-label>
|
||||
<input type="number" formControlName="transactionAmount" required matInput />
|
||||
<mat-error *ngIf="savingAccountTransactionForm.controls.transactionAmount.hasError('required')">
|
||||
Transaction Amount is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-card-content fxLayout="column">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Payment Type</mat-label>
|
||||
<mat-select formControlName="paymentTypeId">
|
||||
<mat-option *ngFor="let paymentType of paymentTypeOptions" [value]="paymentType.id">
|
||||
{{ paymentType.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label>Transaction Date</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="dueDatePicker"
|
||||
formControlName="transactionDate" required>
|
||||
<mat-datepicker-toggle matSuffix [for]="dueDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #dueDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="savingAccountTransactionForm.controls.transactionDate.hasError('required')">
|
||||
Transaction Date is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<div fxLayoutGap="5px" fxLayout="row" fxLayout.xs="column">
|
||||
<mat-label fxFlexAlign="center">Show Payment Details</mat-label>
|
||||
<button type="button" mat-mini-fab color="primary" (click)="addPaymentDetails()">
|
||||
<fa-icon icon="plus-circle" size="lg"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
<mat-form-field>
|
||||
<mat-label>Transaction Amount</mat-label>
|
||||
<input type="number" formControlName="transactionAmount" required matInput />
|
||||
<mat-error *ngIf="savingAccountTransactionForm.controls.transactionAmount.hasError('required')">
|
||||
Transaction Amount is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Payment Type</mat-label>
|
||||
<mat-select formControlName="paymentTypeId">
|
||||
<mat-option *ngFor="let paymentType of paymentTypeOptions" [value]="paymentType.id">
|
||||
{{ paymentType.name }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="savingAccountTransactionForm.controls['accountNumber']">
|
||||
<mat-label>Account Number</mat-label>
|
||||
<input type="number" formControlName="accountNumber" matInput />
|
||||
</mat-form-field>
|
||||
<div fxLayoutGap="5px" fxLayout="row" fxLayout.xs="column">
|
||||
<mat-label fxFlexAlign="center">Show Payment Details</mat-label>
|
||||
<button type="button" mat-mini-fab color="primary" (click)="addPaymentDetails()">
|
||||
<fa-icon icon="plus-circle" size="lg"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<mat-form-field *ngIf="savingAccountTransactionForm.controls['checkNumber']">
|
||||
<mat-label>Cheque</mat-label>
|
||||
<input type="number" formControlName="checkNumber" matInput />
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="savingAccountTransactionForm.controls['accountNumber']">
|
||||
<mat-label>Account Number</mat-label>
|
||||
<input type="number" formControlName="accountNumber" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="savingAccountTransactionForm.controls['routingCode']">
|
||||
<mat-label>Routing Code</mat-label>
|
||||
<input formControlName="routingCode" matInput />
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="savingAccountTransactionForm.controls['checkNumber']">
|
||||
<mat-label>Cheque</mat-label>
|
||||
<input type="number" formControlName="checkNumber" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="savingAccountTransactionForm.controls['receiptNumber']">
|
||||
<mat-label>Receipt Number</mat-label>
|
||||
<input formControlName="receiptNumber" matInput />
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="savingAccountTransactionForm.controls['routingCode']">
|
||||
<mat-label>Routing Code</mat-label>
|
||||
<input formControlName="routingCode" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="savingAccountTransactionForm.controls['bankNumber']">
|
||||
<mat-label>Bank</mat-label>
|
||||
<input formControlName="bankNumber" matInput />
|
||||
</mat-form-field>
|
||||
<mat-form-field *ngIf="savingAccountTransactionForm.controls['receiptNumber']">
|
||||
<mat-label>Receipt Number</mat-label>
|
||||
<input formControlName="receiptNumber" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field *ngIf="savingAccountTransactionForm.controls['bankNumber']">
|
||||
<mat-label>Bank</mat-label>
|
||||
<input formControlName="bankNumber" matInput />
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Notes</mat-label>
|
||||
<textarea formControlName="note" matInput></textarea>
|
||||
</mat-form-field>
|
||||
<mat-form-field>
|
||||
<mat-label>Notes</mat-label>
|
||||
<textarea formControlName="note" matInput></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-card-actions fxLayoutGap="5px" fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center">
|
||||
<button type="button" mat-raised-button [routerLink]="['../']">Cancel</button>
|
||||
<button mat-raised-button color="primary" [disabled]="!savingAccountTransactionForm.valid">Submit</button>
|
||||
</mat-card-actions>
|
||||
<mat-card-actions fxLayoutGap="5px" fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center">
|
||||
<button type="button" mat-raised-button [routerLink]="['../../']">Cancel</button>
|
||||
<button mat-raised-button color="primary" [disabled]="!savingAccountTransactionForm.valid">Submit</button>
|
||||
</mat-card-actions>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</form>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</mat-card-content>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
.container{
|
||||
width: 70%;
|
||||
.container {
|
||||
width: 37rem;
|
||||
}
|
||||
|
||||
+7
-9
@@ -53,20 +53,18 @@ export class SavingsAccountTransactionsComponent implements OnInit {
|
||||
private router: Router,
|
||||
private datePipe: DatePipe,
|
||||
private savingsService: SavingsService) {
|
||||
this.route.data.subscribe((data: { savingAccountTransactionTemplate: any }) => {
|
||||
this.paymentTypeOptions = data.savingAccountTransactionTemplate.paymentTypeOptions;
|
||||
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
|
||||
this.paymentTypeOptions = data.savingsAccountActionData.paymentTypeOptions;
|
||||
});
|
||||
this.transactionCommand = this.route.snapshot.params['name'].toLowerCase();
|
||||
this.transactionType[this.transactionCommand] = true;
|
||||
this.savingAccountId = this.route.parent.snapshot.params['savingAccountId'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the Saving account transaction form when component loads.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.transactionType[params.type] = true;
|
||||
this.transactionCommand = params.type;
|
||||
});
|
||||
this.savingAccountId = this.route.snapshot.params['savingAccountId'];
|
||||
this.createSavingAccountTransactionForm();
|
||||
}
|
||||
|
||||
@@ -115,8 +113,8 @@ export class SavingsAccountTransactionsComponent implements OnInit {
|
||||
const transactionData = this.savingAccountTransactionForm.value;
|
||||
transactionData.locale = 'en';
|
||||
transactionData.dateFormat = dateFormat;
|
||||
this.savingsService.makeTransaction(this.transactionCommand, this.savingAccountId, transactionData).subscribe(res => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, this.transactionCommand, transactionData).subscribe(res => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { WithdrawByClientSavingsAccountComponent } from './withdraw-by-client-savings-account.component';
|
||||
|
||||
describe('WithdrawByClientSavingsAccountComponent', () => {
|
||||
let component: WithdrawByClientSavingsAccountComponent;
|
||||
let fixture: ComponentFixture<WithdrawByClientSavingsAccountComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ WithdrawByClientSavingsAccountComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(WithdrawByClientSavingsAccountComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+6
-6
@@ -8,14 +8,14 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
|
||||
/**
|
||||
* Withdraw Savings Account Component
|
||||
* Withdraw By Client Savings Account Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-withdraw-savings-account',
|
||||
templateUrl: './withdraw-savings-account.component.html',
|
||||
styleUrls: ['./withdraw-savings-account.component.scss']
|
||||
selector: 'mifosx-withdraw-by-client-savings-account',
|
||||
templateUrl: './withdraw-by-client-savings-account.component.html',
|
||||
styleUrls: ['./withdraw-by-client-savings-account.component.scss']
|
||||
})
|
||||
export class WithdrawSavingsAccountComponent implements OnInit {
|
||||
export class WithdrawByClientSavingsAccountComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
@@ -59,7 +59,7 @@ export class WithdrawSavingsAccountComponent implements OnInit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form and withdraws the saving account,
|
||||
* Submits the form and withdraws the saving account by client,
|
||||
* if successful redirects to the saving account.
|
||||
*/
|
||||
submit() {
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { WithdrawSavingsAccountComponent } from './withdraw-savings-account.component';
|
||||
|
||||
describe('WithdrawSavingsAccountComponent', () => {
|
||||
let component: WithdrawSavingsAccountComponent;
|
||||
let fixture: ComponentFixture<WithdrawSavingsAccountComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ WithdrawSavingsAccountComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(WithdrawSavingsAccountComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user