@@ -231,7 +231,8 @@
|
|||||||
<i class="fa fa-undo"></i>
|
<i class="fa fa-undo"></i>
|
||||||
</button>
|
</button>
|
||||||
<button *ngIf="!element.status.submittedAndPendingApproval && !element.status.active"
|
<button *ngIf="!element.status.submittedAndPendingApproval && !element.status.active"
|
||||||
class="account-action-button" mat-raised-button color="primary">
|
class="account-action-button" mat-raised-button color="primary"
|
||||||
|
[routerLink]="['../','savingsaccounts', element.id, 'actions', 'Activate']">
|
||||||
<i class="fa fa-check-circle"></i>
|
<i class="fa fa-check-circle"></i>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<form [formGroup]="activateSavingsAccountForm" (ngSubmit)="submit()">
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex>
|
||||||
|
<mat-label>Activated On Date</mat-label>
|
||||||
|
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="activatedOnDatePicker" required formControlName="activatedOnDate">
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="activatedOnDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #activatedOnDatePicker></mat-datepicker>
|
||||||
|
<mat-error *ngIf="activateSavingsAccountForm.controls.activatedOnDate.hasError('required')">
|
||||||
|
Activated On Date is <strong>required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
</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]="!activateSavingsAccountForm.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 { ActivateSavingsAccountComponent } from './activate-savings-account.component';
|
||||||
|
|
||||||
|
describe('ActivateSavingsAccountComponent', () => {
|
||||||
|
let component: ActivateSavingsAccountComponent;
|
||||||
|
let fixture: ComponentFixture<ActivateSavingsAccountComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ActivateSavingsAccountComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ActivateSavingsAccountComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+82
@@ -0,0 +1,82 @@
|
|||||||
|
/** 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activate Savings Account Component
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-activate-savings-account',
|
||||||
|
templateUrl: './activate-savings-account.component.html',
|
||||||
|
styleUrls: ['./activate-savings-account.component.scss']
|
||||||
|
})
|
||||||
|
export class ActivateSavingsAccountComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Minimum date allowed. */
|
||||||
|
minDate = new Date(2000, 0, 1);
|
||||||
|
/** Maximum date allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
/** Activate Savings Account form. */
|
||||||
|
activateSavingsAccountForm: FormGroup;
|
||||||
|
/** Savings Account Id */
|
||||||
|
accountId: 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'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the activate savings form.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.createActivateSavingsAccountForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the activate savings account form.
|
||||||
|
*/
|
||||||
|
createActivateSavingsAccountForm() {
|
||||||
|
this.activateSavingsAccountForm = this.formBuilder.group({
|
||||||
|
'activatedOnDate': ['', Validators.required]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits the form and activates the saving account,
|
||||||
|
* 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 prevActivatedOnDate: Date = this.activateSavingsAccountForm.value.activatedOnDate;
|
||||||
|
this.activateSavingsAccountForm.patchValue({
|
||||||
|
activatedOnDate: this.datePipe.transform(prevActivatedOnDate, dateFormat),
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
...this.activateSavingsAccountForm.value,
|
||||||
|
dateFormat,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
this.savingsService.executeSavingsAccountCommand(this.accountId, 'activate', data).subscribe(() => {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<mifosx-approve-savings-account *ngIf="actions['Approve']"></mifosx-approve-savings-account>
|
<mifosx-approve-savings-account *ngIf="actions['Approve']"></mifosx-approve-savings-account>
|
||||||
<mifosx-reject-savings-account *ngIf="actions['Reject']"></mifosx-reject-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-withdraw-savings-account *ngIf="actions['Withdraw']"></mifosx-withdraw-savings-account>
|
||||||
|
<mifosx-activate-savings-account *ngIf="actions['Activate']"></mifosx-activate-savings-account>
|
||||||
|
|
||||||
@@ -19,10 +19,12 @@ export class SavingAccountActionsComponent {
|
|||||||
'Approve': boolean
|
'Approve': boolean
|
||||||
'Reject': boolean
|
'Reject': boolean
|
||||||
'Withdraw': boolean
|
'Withdraw': boolean
|
||||||
|
'Activate': boolean
|
||||||
} = {
|
} = {
|
||||||
'Approve': false,
|
'Approve': false,
|
||||||
'Reject': false,
|
'Reject': false,
|
||||||
'Withdraw': false
|
'Withdraw': false,
|
||||||
|
'Activate': false
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ export class SavingsAccountViewComponent implements OnInit {
|
|||||||
case 'Approve':
|
case 'Approve':
|
||||||
case 'Reject':
|
case 'Reject':
|
||||||
case 'Withdraw':
|
case 'Withdraw':
|
||||||
|
case 'Activate':
|
||||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||||
break;
|
break;
|
||||||
case 'Modify Application':
|
case 'Modify Application':
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import { EditSavingsAccountComponent } from './edit-savings-account/edit-savings
|
|||||||
import { ApproveSavingsAccountComponent } from './saving-account-actions/approve-savings-account/approve-savings-account.component';
|
import { ApproveSavingsAccountComponent } from './saving-account-actions/approve-savings-account/approve-savings-account.component';
|
||||||
import { RejectSavingsAccountComponent } from './saving-account-actions/reject-savings-account/reject-savings-account.component';
|
import { RejectSavingsAccountComponent } from './saving-account-actions/reject-savings-account/reject-savings-account.component';
|
||||||
import { WithdrawSavingsAccountComponent } from './saving-account-actions/withdraw-savings-account/withdraw-savings-account.component';
|
import { WithdrawSavingsAccountComponent } from './saving-account-actions/withdraw-savings-account/withdraw-savings-account.component';
|
||||||
|
import { ActivateSavingsAccountComponent } from './saving-account-actions/activate-savings-account/activate-savings-account.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Savings Module
|
* Savings Module
|
||||||
@@ -60,7 +61,8 @@ import { WithdrawSavingsAccountComponent } from './saving-account-actions/withdr
|
|||||||
EditSavingsAccountComponent,
|
EditSavingsAccountComponent,
|
||||||
ApproveSavingsAccountComponent,
|
ApproveSavingsAccountComponent,
|
||||||
RejectSavingsAccountComponent,
|
RejectSavingsAccountComponent,
|
||||||
WithdrawSavingsAccountComponent
|
WithdrawSavingsAccountComponent,
|
||||||
|
ActivateSavingsAccountComponent
|
||||||
],
|
],
|
||||||
providers: [DatePipe]
|
providers: [DatePipe]
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user