+1
-1
@@ -93,9 +93,9 @@ export class FixedDepositAccountViewComponent implements OnInit {
|
||||
case 'Activate':
|
||||
case 'Close':
|
||||
case 'Undo Approval':
|
||||
case 'Post Interest As On':
|
||||
case 'Add Charge':
|
||||
case 'Withdraw By Client':
|
||||
case 'Premature Close':
|
||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||
break;
|
||||
case 'Modify Application':
|
||||
|
||||
+1
-2
@@ -2,7 +2,6 @@
|
||||
<mifosx-reject-fixed-deposits-account *ngIf="actions['Reject']"></mifosx-reject-fixed-deposits-account>
|
||||
<mifosx-activate-fixed-deposits-account *ngIf="actions['Activate']"></mifosx-activate-fixed-deposits-account>
|
||||
<mifosx-undo-approval-fixed-deposits-account *ngIf="actions['Undo Approval']"></mifosx-undo-approval-fixed-deposits-account>
|
||||
<!-- <mifosx-post-interest-as-on-fixed-deposits-account *ngIf="actions['Post Interest As On']"></mifosx-post-interest-as-on-fixed-deposits-account>
|
||||
<mifosx-withdraw-by-client-fixed-deposits-account *ngIf="actions['Withdraw By Client']"></mifosx-withdraw-by-client-fixed-deposits-account>
|
||||
<mifosx-add-charge-fixed-deposits-account *ngIf="actions['Add Charge']"></mifosx-add-charge-fixed-deposits-account>
|
||||
<!-- <mifosx-add-charge-fixed-deposits-account *ngIf="actions['Add Charge']"></mifosx-add-charge-fixed-deposits-account>
|
||||
<mifosx-close-fixed-deposits-account *ngIf="actions['Close']"></mifosx-close-fixed-deposits-account> -->
|
||||
|
||||
-2
@@ -19,7 +19,6 @@ export class FixedDepositsAccountActionsComponent {
|
||||
'Activate': boolean
|
||||
'Close': boolean
|
||||
'Undo Approval': boolean
|
||||
'Post Interest As On': boolean
|
||||
'Add Charge': boolean
|
||||
'Withdraw By Client': boolean
|
||||
} = {
|
||||
@@ -28,7 +27,6 @@ export class FixedDepositsAccountActionsComponent {
|
||||
'Activate': false,
|
||||
'Close': false,
|
||||
'Undo Approval': false,
|
||||
'Post Interest As On': false,
|
||||
'Add Charge': false,
|
||||
'Withdraw By Client': false
|
||||
};
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="withdrawFixedDepositsAccountForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="column">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Withdrawn On Date</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="withdrawnOnDatePicker" required formControlName="withdrawnOnDate">
|
||||
<mat-datepicker-toggle matSuffix [for]="withdrawnOnDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #withdrawnOnDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="withdrawFixedDepositsAccountForm.controls.withdrawnOnDate.hasError('required')">
|
||||
Withdrawn On Date is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<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]="['../../']">Cancel</button>
|
||||
<button mat-raised-button color="primary" [disabled]="!withdrawFixedDepositsAccountForm.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 { WithdrawByClientFixedDepositsAccountComponent } from './withdraw-by-client-fixed-deposits-account.component';
|
||||
|
||||
describe('WithdrawByClientFixedDepositsAccountComponent', () => {
|
||||
let component: WithdrawByClientFixedDepositsAccountComponent;
|
||||
let fixture: ComponentFixture<WithdrawByClientFixedDepositsAccountComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ WithdrawByClientFixedDepositsAccountComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(WithdrawByClientFixedDepositsAccountComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/** 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 { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service';
|
||||
|
||||
/**
|
||||
* Withdraw By Client Fixed Deposits Account Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-withdraw-by-client-fixed-deposits-account',
|
||||
templateUrl: './withdraw-by-client-fixed-deposits-account.component.html',
|
||||
styleUrls: ['./withdraw-by-client-fixed-deposits-account.component.scss']
|
||||
})
|
||||
export class WithdrawByClientFixedDepositsAccountComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Withdraw Fixed Deposits Account form. */
|
||||
withdrawFixedDepositsAccountForm: FormGroup;
|
||||
/** Fixed Deposits Account Id */
|
||||
accountId: any;
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {FixedDepositsService} fixedDepositsService Fixed Deposits Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private fixedDepositsService: FixedDepositsService,
|
||||
private datePipe: DatePipe,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.accountId = this.route.parent.snapshot.params['fixedDepositAccountId'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the withdraw fixed deposits form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createWithdrawFixedDepositsAccountForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the withdraw fixed deposits account form.
|
||||
*/
|
||||
createWithdrawFixedDepositsAccountForm() {
|
||||
this.withdrawFixedDepositsAccountForm = this.formBuilder.group({
|
||||
'withdrawnOnDate': ['', Validators.required],
|
||||
'note': ['']
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form and withdraws the fixed deposit account by client,
|
||||
* if successful redirects to the fixed deposit account.
|
||||
*/
|
||||
submit() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const locale = 'en';
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
const prevWithdrawnOnDate: Date = this.withdrawFixedDepositsAccountForm.value.withdrawnOnDate;
|
||||
this.withdrawFixedDepositsAccountForm.patchValue({
|
||||
withdrawnOnDate: this.datePipe.transform(prevWithdrawnOnDate, dateFormat),
|
||||
});
|
||||
const data = {
|
||||
...this.withdrawFixedDepositsAccountForm.value,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.fixedDepositsService.executeFixedDepositsAccountCommand(this.accountId, 'withdrawnByApplicant', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import { CalculateInterestDialogComponent } from './fixed-deposit-account-view/c
|
||||
import { ToggleWithholdTaxDialogComponent } from './fixed-deposit-account-view/custom-dialogs/toggle-withhold-tax-dialog/toggle-withhold-tax-dialog.component';
|
||||
import { ActivateFixedDepositsAccountComponent } from './fixed-deposits-account-actions/activate-fixed-deposits-account/activate-fixed-deposits-account.component';
|
||||
import { UndoApprovalFixedDepositsAccountComponent } from './fixed-deposits-account-actions/undo-approval-fixed-deposits-account/undo-approval-fixed-deposits-account.component';
|
||||
import { WithdrawByClientFixedDepositsAccountComponent } from './fixed-deposits-account-actions/withdraw-by-client-fixed-deposits-account/withdraw-by-client-fixed-deposits-account.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@@ -43,7 +44,8 @@ import { UndoApprovalFixedDepositsAccountComponent } from './fixed-deposits-acco
|
||||
CalculateInterestDialogComponent,
|
||||
ToggleWithholdTaxDialogComponent,
|
||||
ActivateFixedDepositsAccountComponent,
|
||||
UndoApprovalFixedDepositsAccountComponent
|
||||
UndoApprovalFixedDepositsAccountComponent,
|
||||
WithdrawByClientFixedDepositsAccountComponent
|
||||
],
|
||||
imports: [
|
||||
SharedModule,
|
||||
|
||||
Reference in New Issue
Block a user