@@ -10,3 +10,4 @@
|
||||
<mifosx-reject-client-transfer *ngIf="actions['Reject Transfer']"></mifosx-reject-client-transfer>
|
||||
<mifosx-accept-client-transfer *ngIf="actions['Accept Transfer']"></mifosx-accept-client-transfer>
|
||||
<mifosx-reactivate-client *ngIf="actions['Reactivate']"></mifosx-reactivate-client>
|
||||
<mifosx-undo-client-rejection *ngIf="actions['Undo Rejection']"></mifosx-undo-client-rejection>
|
||||
|
||||
@@ -25,6 +25,7 @@ export class ClientActionsComponent {
|
||||
'Accept Transfer': boolean
|
||||
'Reject Transfer': boolean
|
||||
'Reactivate': boolean
|
||||
'Undo Rejection': boolean
|
||||
} = {
|
||||
'Assign Staff': false,
|
||||
'Close': false,
|
||||
@@ -36,7 +37,8 @@ export class ClientActionsComponent {
|
||||
'Undo Transfer': false,
|
||||
'Accept Transfer': false,
|
||||
'Reject Transfer': false,
|
||||
'Reactivate': false
|
||||
'Reactivate': false,
|
||||
'Undo Rejection': false
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="undoClientRejectionForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Reopened On Date</mat-label>
|
||||
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="reopenedDatePicker" required formControlName="reopenedDate">
|
||||
<mat-datepicker-toggle matSuffix [for]="reopenedDatePicker"></mat-datepicker-toggle>
|
||||
<mat-datepicker #reopenedDatePicker></mat-datepicker>
|
||||
<mat-error *ngIf="undoClientRejectionForm.controls.reopenedDate.hasError('required')">
|
||||
Reopened 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]="!undoClientRejectionForm.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 { UndoClientRejectionComponent } from './undo-client-rejection.component';
|
||||
|
||||
describe('UndoClientRejectionComponent', () => {
|
||||
let component: UndoClientRejectionComponent;
|
||||
let fixture: ComponentFixture<UndoClientRejectionComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ UndoClientRejectionComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UndoClientRejectionComponent);
|
||||
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 { ClientsService } from 'app/clients/clients.service';
|
||||
|
||||
/**
|
||||
* Undo Client Rejection Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-undo-client-rejection',
|
||||
templateUrl: './undo-client-rejection.component.html',
|
||||
styleUrls: ['./undo-client-rejection.component.scss']
|
||||
})
|
||||
export class UndoClientRejectionComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
maxDate = new Date();
|
||||
/** Undo Client Rejection form. */
|
||||
undoClientRejectionForm: FormGroup;
|
||||
/** Client Id */
|
||||
clientId: any;
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {clientsService} clientsService Cliens Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {Router} router Router
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private clientsService: ClientsService,
|
||||
private datePipe: DatePipe,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.clientId = this.route.parent.snapshot.params['clientId'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the undo client rejection form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.createUndoClientRejectionForm();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the undo client rejection form.
|
||||
*/
|
||||
createUndoClientRejectionForm() {
|
||||
this.undoClientRejectionForm = this.formBuilder.group({
|
||||
'reopenedDate': ['', Validators.required]
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Submits the form and undo client rejection,
|
||||
* if successful redirects to the client.
|
||||
*/
|
||||
submit() {
|
||||
// TODO: Update once language and date settings are setup
|
||||
const locale = 'en';
|
||||
const dateFormat = 'dd MMMM yyyy';
|
||||
const prevReopenedDate: Date = this.undoClientRejectionForm.value.reopenedDate;
|
||||
this.undoClientRejectionForm.patchValue({
|
||||
reopenedDate: this.datePipe.transform(prevReopenedDate, dateFormat),
|
||||
});
|
||||
const data = {
|
||||
...this.undoClientRejectionForm.value,
|
||||
dateFormat,
|
||||
locale
|
||||
};
|
||||
this.clientsService.executeClientCommand(this.clientId, 'undoRejection', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,6 +54,7 @@
|
||||
<span *ngIf="clientViewData.status.value === 'Pending'"><button mat-menu-item (click)="doAction('Reject')">Reject</button></span>
|
||||
<span *ngIf="clientViewData.status.value === 'Pending'"><button mat-menu-item (click)="doAction('Delete')">Delete</button></span>
|
||||
<span *ngIf="clientViewData.status.value === 'Closed'"><button mat-menu-item (click)="doAction('Reactivate')">Reactivate</button></span>
|
||||
<span *ngIf="clientViewData.status.value === 'Rejected'"><button mat-menu-item (click)="doAction('Undo Rejection')">Undo Rejection</button></span>
|
||||
</mat-menu>
|
||||
</mat-card-actions>
|
||||
</mat-card-header>
|
||||
|
||||
@@ -67,6 +67,7 @@ export class ClientsViewComponent implements OnInit {
|
||||
case 'Accept Transfer':
|
||||
case 'Reject Transfer':
|
||||
case 'Reactivate':
|
||||
case 'Undo Rejection':
|
||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||
break;
|
||||
case 'Unassign Staff':
|
||||
|
||||
@@ -40,6 +40,7 @@ import { UndoClientTransferComponent } from './clients-view/client-actions/undo-
|
||||
import { RejectClientTransferComponent } from './clients-view/client-actions/reject-client-transfer/reject-client-transfer.component';
|
||||
import { AcceptClientTransferComponent } from './clients-view/client-actions/accept-client-transfer/accept-client-transfer.component';
|
||||
import { ReactivateClientComponent } from './clients-view/client-actions/reactivate-client/reactivate-client.component';
|
||||
import { UndoClientRejectionComponent } from './clients-view/client-actions/undo-client-rejection/undo-client-rejection.component';
|
||||
|
||||
|
||||
/**
|
||||
@@ -85,7 +86,8 @@ import { ReactivateClientComponent } from './clients-view/client-actions/reactiv
|
||||
UndoClientTransferComponent,
|
||||
RejectClientTransferComponent,
|
||||
AcceptClientTransferComponent,
|
||||
ReactivateClientComponent
|
||||
ReactivateClientComponent,
|
||||
UndoClientRejectionComponent
|
||||
],
|
||||
entryComponents: [
|
||||
UploadDocumentDialogComponent,
|
||||
|
||||
Reference in New Issue
Block a user