+2
-2
@@ -1,6 +1,6 @@
|
||||
<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-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>
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="rejectFixedDepositsAccountForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="column">
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>Rejected On Date</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="rejectedOnDatePicker" required formControlName="rejectedOnDate">
|
||||
<mat-datepicker-toggle matSuffix [for]="rejectedOnDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #rejectedOnDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="rejectFixedDepositsAccountForm.controls.rejectedOnDate.hasError('required')">
|
||||
Rejected 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="warn" [disabled]="!rejectFixedDepositsAccountForm.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 { RejectFixedDepositsAccountComponent } from './reject-fixed-deposits-account.component';
|
||||
|
||||
describe('RejectFixedDepositsAccountComponent', () => {
|
||||
let component: RejectFixedDepositsAccountComponent;
|
||||
let fixture: ComponentFixture<RejectFixedDepositsAccountComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ RejectFixedDepositsAccountComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RejectFixedDepositsAccountComponent);
|
||||
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';
|
||||
|
||||
/**
|
||||
* Reject Fixed Deposits Account Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-reject-fixed-deposits-account',
|
||||
templateUrl: './reject-fixed-deposits-account.component.html',
|
||||
styleUrls: ['./reject-fixed-deposits-account.component.scss']
|
||||
})
|
||||
export class RejectFixedDepositsAccountComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Reject Fixed Deposit Account form. */
|
||||
rejectFixedDepositsAccountForm: 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 reject fixed deposits form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createRejectFixedDepositsAccountForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the reject fixed deposits account form.
|
||||
*/
|
||||
createRejectFixedDepositsAccountForm() {
|
||||
this.rejectFixedDepositsAccountForm = this.formBuilder.group({
|
||||
'rejectedOnDate': ['', Validators.required],
|
||||
'note': ['']
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form and rejects 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 prevRejectedOnDate: Date = this.rejectFixedDepositsAccountForm.value.rejectedOnDate;
|
||||
this.rejectFixedDepositsAccountForm.patchValue({
|
||||
rejectedOnDate: this.datePipe.transform(prevRejectedOnDate, dateFormat),
|
||||
});
|
||||
const data = {
|
||||
...this.rejectFixedDepositsAccountForm.value,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.fixedDepositsService.executeFixedDepositsAccountCommand(this.accountId, 'reject', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import { MultiRowComponent } from './fixed-deposit-account-view/datatable-tabs/m
|
||||
import { SingleRowComponent } from './fixed-deposit-account-view/datatable-tabs/single-row/single-row.component';
|
||||
import { FixedDepositsAccountActionsComponent } from './fixed-deposits-account-actions/fixed-deposits-account-actions.component';
|
||||
import { ApproveFixedDepositsAccountComponent } from './fixed-deposits-account-actions/approve-fixed-deposits-account/approve-fixed-deposits-account.component';
|
||||
import { RejectFixedDepositsAccountComponent } from './fixed-deposits-account-actions/reject-fixed-deposits-account/reject-fixed-deposits-account.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@@ -31,7 +32,8 @@ import { ApproveFixedDepositsAccountComponent } from './fixed-deposits-account-a
|
||||
MultiRowComponent,
|
||||
SingleRowComponent,
|
||||
FixedDepositsAccountActionsComponent,
|
||||
ApproveFixedDepositsAccountComponent
|
||||
ApproveFixedDepositsAccountComponent,
|
||||
RejectFixedDepositsAccountComponent
|
||||
],
|
||||
imports: [
|
||||
SharedModule,
|
||||
|
||||
Reference in New Issue
Block a user