+39
@@ -0,0 +1,39 @@
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="approveFixedDepositsAccountForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="column">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Approved On Date</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="approvedOnDatePicker" required formControlName="approvedOnDate">
|
||||
<mat-datepicker-toggle matSuffix [for]="approvedOnDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #approvedOnDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="approveFixedDepositsAccountForm.controls.approvedOnDate.hasError('required')">
|
||||
Approved 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="accent" [disabled]="!approveFixedDepositsAccountForm">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 { ApproveFixedDepositsAccountComponent } from './approve-fixed-deposits-account.component';
|
||||
|
||||
describe('ApproveFixedDepositsAccountComponent', () => {
|
||||
let component: ApproveFixedDepositsAccountComponent;
|
||||
let fixture: ComponentFixture<ApproveFixedDepositsAccountComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ApproveFixedDepositsAccountComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ApproveFixedDepositsAccountComponent);
|
||||
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';
|
||||
|
||||
/**
|
||||
* Approve Fixed Deposits Account Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-approve-fixed-deposits-account',
|
||||
templateUrl: './approve-fixed-deposits-account.component.html',
|
||||
styleUrls: ['./approve-fixed-deposits-account.component.scss']
|
||||
})
|
||||
export class ApproveFixedDepositsAccountComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Approve Fixed Deposits Account form. */
|
||||
approveFixedDepositsAccountForm: 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 approve fixed deposits form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createApproveFixedDepositsAccountForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the approve fixed deposits account form.
|
||||
*/
|
||||
createApproveFixedDepositsAccountForm() {
|
||||
this.approveFixedDepositsAccountForm = this.formBuilder.group({
|
||||
'approvedOnDate': ['', Validators.required],
|
||||
'note': ['']
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form and approves the fixed deposit account,
|
||||
* 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 prevApprovedOnDate: Date = this.approveFixedDepositsAccountForm.value.approvedOnDate;
|
||||
this.approveFixedDepositsAccountForm.patchValue({
|
||||
approvedOnDate: this.datePipe.transform(prevApprovedOnDate, dateFormat),
|
||||
});
|
||||
const data = {
|
||||
...this.approveFixedDepositsAccountForm.value,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.fixedDepositsService.executeFixedDepositsAccountCommand(this.accountId, 'approve', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<mifosx-approve-fixed-deposits-account *ngIf="actions['Approve']"></mifosx-approve-fixed-deposits-account>
|
||||
<!-- <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-close-fixed-deposits-account *ngIf="actions['Close']"></mifosx-close-fixed-deposits-account> -->
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FixedDepositsAccountActionsComponent } from './fixed-deposits-account-actions.component';
|
||||
|
||||
describe('FixedDepositsAccountActionsComponent', () => {
|
||||
let component: FixedDepositsAccountActionsComponent;
|
||||
let fixture: ComponentFixture<FixedDepositsAccountActionsComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FixedDepositsAccountActionsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FixedDepositsAccountActionsComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
/** Angular Imports */
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
/**
|
||||
* Fixed deposits account actions component.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-fixed-deposits-account-actions',
|
||||
templateUrl: './fixed-deposits-account-actions.component.html',
|
||||
styleUrls: ['./fixed-deposits-account-actions.component.scss']
|
||||
})
|
||||
export class FixedDepositsAccountActionsComponent {
|
||||
|
||||
/** Flag object to store possible actions and render appropriate UI to the user */
|
||||
actions: {
|
||||
'Approve': boolean
|
||||
'Reject': boolean
|
||||
'Withdrawal': boolean
|
||||
'Deposit': boolean
|
||||
'Activate': boolean
|
||||
'Close': boolean
|
||||
'Undo Approval': boolean
|
||||
'Post Interest As On': boolean
|
||||
'Assign Staff': boolean
|
||||
'Add Charge': boolean
|
||||
'Unassign Staff': boolean
|
||||
'Withdraw By Client': boolean
|
||||
} = {
|
||||
'Approve': false,
|
||||
'Reject': false,
|
||||
'Withdrawal': false,
|
||||
'Deposit': false,
|
||||
'Activate': false,
|
||||
'Close': false,
|
||||
'Undo Approval': false,
|
||||
'Post Interest As On': false,
|
||||
'Assign Staff': false,
|
||||
'Add Charge': false,
|
||||
'Unassign Staff': false,
|
||||
'Withdraw By Client': false
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
const name = this.route.snapshot.params['name'];
|
||||
this.actions[name] = true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user