+1
@@ -1,3 +1,4 @@
|
||||
<mifosx-activate-recurring-deposits-account *ngIf="actions['Activate']"></mifosx-activate-recurring-deposits-account>
|
||||
<mifosx-undo-approval-recurring-deposits-account *ngIf="actions['Undo Approval']"></mifosx-undo-approval-recurring-deposits-account>
|
||||
<mifosx-approve-recurring-deposits-account *ngIf="actions['Approve']"></mifosx-approve-recurring-deposits-account>
|
||||
<mifosx-reject-recurring-deposits-account *ngIf="actions['Reject']"></mifosx-reject-recurring-deposits-account>
|
||||
+3
-1
@@ -13,10 +13,12 @@ export class RecurringDepositsAccountActionsComponent {
|
||||
'Activate': boolean
|
||||
'Undo Approval': boolean
|
||||
'Approve': boolean
|
||||
'Reject': boolean
|
||||
} = {
|
||||
'Activate': false,
|
||||
'Undo Approval': false,
|
||||
'Approve': false
|
||||
'Approve': false,
|
||||
'Reject': false
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="rejectRecurringDepositsAccountForm" (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="rejectRecurringDepositsAccountForm.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="accent" [disabled]="!rejectRecurringDepositsAccountForm">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 { RejectRecurringDepositsAccountComponent } from './reject-recurring-deposits-account.component';
|
||||
|
||||
describe('RejectRecurringDepositsAccountComponent', () => {
|
||||
let component: RejectRecurringDepositsAccountComponent;
|
||||
let fixture: ComponentFixture<RejectRecurringDepositsAccountComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ RejectRecurringDepositsAccountComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RejectRecurringDepositsAccountComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
/** 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 { RecurringDepositsService } from '../../recurring-deposits.service';
|
||||
|
||||
|
||||
/**
|
||||
* Reject Recurring Deposits Account Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-reject-recurring-deposits-account',
|
||||
templateUrl: './reject-recurring-deposits-account.component.html',
|
||||
styleUrls: ['./reject-recurring-deposits-account.component.scss']
|
||||
})
|
||||
export class RejectRecurringDepositsAccountComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Reject Recurring Deposits Account form. */
|
||||
rejectRecurringDepositsAccountForm: FormGroup;
|
||||
/** Recurring Deposits Account Id */
|
||||
accountId: any;
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {RecurringDepositsService} recurringDepositsService Recurring Deposits Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private recurringDepositsService: RecurringDepositsService,
|
||||
private datePipe: DatePipe,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the reject recurring deposits form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createRejectRecurringDepositsAccountForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the reject recurring deposits account form.
|
||||
*/
|
||||
createRejectRecurringDepositsAccountForm() {
|
||||
this.rejectRecurringDepositsAccountForm = this.formBuilder.group({
|
||||
'rejectedOnDate': ['', Validators.required],
|
||||
'note': ['']
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form and rejects the recurring deposit account,
|
||||
* if successful redirects to the recurring deposit account.
|
||||
*/
|
||||
submit() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const locale = 'en';
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
const prevRejectedOnDate: Date = this.rejectRecurringDepositsAccountForm.value.rejectedOnDate;
|
||||
this.rejectRecurringDepositsAccountForm.patchValue({
|
||||
rejectedOnDate: this.datePipe.transform(prevRejectedOnDate, dateFormat),
|
||||
});
|
||||
const data = {
|
||||
...this.rejectRecurringDepositsAccountForm.value,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'reject', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+1
@@ -79,6 +79,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
||||
switch (name) {
|
||||
case 'Activate':
|
||||
case 'Approve':
|
||||
case 'Reject':
|
||||
case 'Undo Approval':
|
||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||
break;
|
||||
|
||||
@@ -29,6 +29,7 @@ import { RecurringDepositsAccountActionsComponent } from './recurring-deposits-a
|
||||
import { ActivateRecurringDepositsAccountComponent } from './recurring-deposits-account-actions/activate-recurring-deposits-account/activate-recurring-deposits-account.component';
|
||||
import { UndoApprovalRecurringDepositsAccountComponent } from './recurring-deposits-account-actions/undo-approval-recurring-deposits-account/undo-approval-recurring-deposits-account.component';
|
||||
import { ApproveRecurringDepositsAccountComponent } from './recurring-deposits-account-actions/approve-recurring-deposits-account/approve-recurring-deposits-account.component';
|
||||
import { RejectRecurringDepositsAccountComponent } from './recurring-deposits-account-actions/reject-recurring-deposits-account/reject-recurring-deposits-account.component';
|
||||
|
||||
/**
|
||||
* RecurringDeposits Module
|
||||
@@ -62,7 +63,8 @@ import { ApproveRecurringDepositsAccountComponent } from './recurring-deposits-a
|
||||
RecurringDepositsAccountActionsComponent,
|
||||
ActivateRecurringDepositsAccountComponent,
|
||||
UndoApprovalRecurringDepositsAccountComponent,
|
||||
ApproveRecurringDepositsAccountComponent
|
||||
ApproveRecurringDepositsAccountComponent,
|
||||
RejectRecurringDepositsAccountComponent
|
||||
],
|
||||
providers: [DatePipe]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user