@@ -438,7 +438,8 @@
|
|||||||
<th mat-header-cell *matHeaderCellDef> Actions </th>
|
<th mat-header-cell *matHeaderCellDef> Actions </th>
|
||||||
<td mat-cell *matCellDef="let element">
|
<td mat-cell *matCellDef="let element">
|
||||||
<ng-container *ngIf="element.status.submittedAndPendingApproval">
|
<ng-container *ngIf="element.status.submittedAndPendingApproval">
|
||||||
<button class="account-action-button" mat-raised-button *mifosxHasPermission="'APPROVE_SAVINGSACCOUNT'" color="primary">
|
<button class="account-action-button" mat-raised-button *mifosxHasPermission="'APPROVE_SAVINGSACCOUNT'"
|
||||||
|
[routerLink]="['../','recurringdeposits', element.id, 'actions', 'Approve']" color="primary">
|
||||||
<i class="fa fa-check"></i>
|
<i class="fa fa-check"></i>
|
||||||
</button>
|
</button>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
@@ -446,12 +447,12 @@
|
|||||||
<button
|
<button
|
||||||
class="account-action-button" mat-raised-button color="primary" (click)="routeEdit($event)"
|
class="account-action-button" mat-raised-button color="primary" (click)="routeEdit($event)"
|
||||||
*mifosxHasPermission="'APPROVALUNDO_SAVINGSACCOUNT'"
|
*mifosxHasPermission="'APPROVALUNDO_SAVINGSACCOUNT'"
|
||||||
[routerLink]="['../','recurring-deposits-accounts', element.id, 'actions', 'Undo Approval']">
|
[routerLink]="['../','recurringdeposits', element.id, 'actions', 'Undo Approval']">
|
||||||
<i class="fa fa-undo"></i>
|
<i class="fa fa-undo"></i>
|
||||||
</button>
|
</button>
|
||||||
<button class="account-action-button" mat-raised-button color="primary" (click)="routeEdit($event)"
|
<button class="account-action-button" mat-raised-button color="primary" (click)="routeEdit($event)"
|
||||||
*mifosxHasPermission="'ACTIVATE_SAVINGSACCOUNT'"
|
*mifosxHasPermission="'ACTIVATE_SAVINGSACCOUNT'"
|
||||||
[routerLink]="['../','recurring-deposits-accounts', element.id, 'actions', 'Activate']">
|
[routerLink]="['../','recurringdeposits', element.id, 'actions', 'Activate']">
|
||||||
<i class="fa fa-check-circle"></i>
|
<i class="fa fa-check-circle"></i>
|
||||||
</button>
|
</button>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<form [formGroup]="approveRecurringDepositsAccountForm" (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="approveRecurringDepositsAccountForm.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]="!approveRecurringDepositsAccountForm">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 { ApproveRecurringDepositsAccountComponent } from './approve-recurring-deposits-account.component';
|
||||||
|
|
||||||
|
describe('ApproveRecurringDepositsAccountComponent', () => {
|
||||||
|
let component: ApproveRecurringDepositsAccountComponent;
|
||||||
|
let fixture: ComponentFixture<ApproveRecurringDepositsAccountComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ApproveRecurringDepositsAccountComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ApproveRecurringDepositsAccountComponent);
|
||||||
|
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 { RecurringDepositsService } from '../../recurring-deposits.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Approve Recurring Deposits Account Component
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-approve-recurring-deposits-account',
|
||||||
|
templateUrl: './approve-recurring-deposits-account.component.html',
|
||||||
|
styleUrls: ['./approve-recurring-deposits-account.component.scss']
|
||||||
|
})
|
||||||
|
export class ApproveRecurringDepositsAccountComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Minimum date allowed. */
|
||||||
|
minDate = new Date(2000, 0, 1);
|
||||||
|
/** Maximum date allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
/** Approve Recurring Deposits Account form. */
|
||||||
|
approveRecurringDepositsAccountForm: 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 approve recurring deposits form.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.createApproveRecurringDepositsAccountForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the approve recurring deposits account form.
|
||||||
|
*/
|
||||||
|
createApproveRecurringDepositsAccountForm() {
|
||||||
|
this.approveRecurringDepositsAccountForm = this.formBuilder.group({
|
||||||
|
'approvedOnDate': ['', Validators.required],
|
||||||
|
'note': ['']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits the form and approves 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 prevApprovedOnDate: Date = this.approveRecurringDepositsAccountForm.value.approvedOnDate;
|
||||||
|
this.approveRecurringDepositsAccountForm.patchValue({
|
||||||
|
approvedOnDate: this.datePipe.transform(prevApprovedOnDate, dateFormat),
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
...this.approveRecurringDepositsAccountForm.value,
|
||||||
|
dateFormat,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'approve', data).subscribe(() => {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+1
@@ -1,2 +1,3 @@
|
|||||||
<mifosx-activate-recurring-deposits-account *ngIf="actions['Activate']"></mifosx-activate-recurring-deposits-account>
|
<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-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>
|
||||||
|
|||||||
+3
-1
@@ -12,9 +12,11 @@ export class RecurringDepositsAccountActionsComponent {
|
|||||||
actions: {
|
actions: {
|
||||||
'Activate': boolean
|
'Activate': boolean
|
||||||
'Undo Approval': boolean
|
'Undo Approval': boolean
|
||||||
|
'Approve': boolean
|
||||||
} = {
|
} = {
|
||||||
'Activate': false,
|
'Activate': false,
|
||||||
'Undo Approval': false
|
'Undo Approval': false,
|
||||||
|
'Approve': false
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
@@ -78,6 +78,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
|
|||||||
doAction(name: string) {
|
doAction(name: string) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case 'Activate':
|
case 'Activate':
|
||||||
|
case 'Approve':
|
||||||
case 'Undo Approval':
|
case 'Undo Approval':
|
||||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import { RecurringDepositsAccountPreviewStepComponent } from './recurring-deposi
|
|||||||
import { RecurringDepositsAccountActionsComponent } from './recurring-deposits-account-actions/recurring-deposits-account-actions.component';
|
import { RecurringDepositsAccountActionsComponent } from './recurring-deposits-account-actions/recurring-deposits-account-actions.component';
|
||||||
import { ActivateRecurringDepositsAccountComponent } from './recurring-deposits-account-actions/activate-recurring-deposits-account/activate-recurring-deposits-account.component';
|
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 { 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';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RecurringDeposits Module
|
* RecurringDeposits Module
|
||||||
@@ -60,7 +61,8 @@ import { UndoApprovalRecurringDepositsAccountComponent } from './recurring-depos
|
|||||||
RecurringDepositsAccountPreviewStepComponent,
|
RecurringDepositsAccountPreviewStepComponent,
|
||||||
RecurringDepositsAccountActionsComponent,
|
RecurringDepositsAccountActionsComponent,
|
||||||
ActivateRecurringDepositsAccountComponent,
|
ActivateRecurringDepositsAccountComponent,
|
||||||
UndoApprovalRecurringDepositsAccountComponent
|
UndoApprovalRecurringDepositsAccountComponent,
|
||||||
|
ApproveRecurringDepositsAccountComponent
|
||||||
],
|
],
|
||||||
providers: [DatePipe]
|
providers: [DatePipe]
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user