+2
-2
@@ -65,9 +65,9 @@ export class ActivateClientComponent implements OnInit {
|
|||||||
// TODO: Update once language and date settings are setup
|
// TODO: Update once language and date settings are setup
|
||||||
const locale = 'en';
|
const locale = 'en';
|
||||||
const dateFormat = 'dd MMMM yyyy';
|
const dateFormat = 'dd MMMM yyyy';
|
||||||
const prevactivationDate: Date = this.activateClientForm.value.activationDate;
|
const prevActivationDate: Date = this.activateClientForm.value.activationDate;
|
||||||
this.activateClientForm.patchValue({
|
this.activateClientForm.patchValue({
|
||||||
activationDate: this.datePipe.transform(prevactivationDate, dateFormat),
|
activationDate: this.datePipe.transform(prevActivationDate, dateFormat),
|
||||||
});
|
});
|
||||||
const data = {
|
const data = {
|
||||||
...this.activateClientForm.value,
|
...this.activateClientForm.value,
|
||||||
|
|||||||
@@ -9,3 +9,4 @@
|
|||||||
<mifosx-undo-client-transfer *ngIf="actions['Undo Transfer']"></mifosx-undo-client-transfer>
|
<mifosx-undo-client-transfer *ngIf="actions['Undo Transfer']"></mifosx-undo-client-transfer>
|
||||||
<mifosx-reject-client-transfer *ngIf="actions['Reject Transfer']"></mifosx-reject-client-transfer>
|
<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-accept-client-transfer *ngIf="actions['Accept Transfer']"></mifosx-accept-client-transfer>
|
||||||
|
<mifosx-reactivate-client *ngIf="actions['Reactivate']"></mifosx-reactivate-client>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export class ClientActionsComponent {
|
|||||||
'Undo Transfer': boolean
|
'Undo Transfer': boolean
|
||||||
'Accept Transfer': boolean
|
'Accept Transfer': boolean
|
||||||
'Reject Transfer': boolean
|
'Reject Transfer': boolean
|
||||||
|
'Reactivate': boolean
|
||||||
} = {
|
} = {
|
||||||
'Assign Staff': false,
|
'Assign Staff': false,
|
||||||
'Close': false,
|
'Close': false,
|
||||||
@@ -34,7 +35,8 @@ export class ClientActionsComponent {
|
|||||||
'Transfer Client': false,
|
'Transfer Client': false,
|
||||||
'Undo Transfer': false,
|
'Undo Transfer': false,
|
||||||
'Accept Transfer': false,
|
'Accept Transfer': false,
|
||||||
'Reject Transfer': false
|
'Reject Transfer': false,
|
||||||
|
'Reactivate': false
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
<mat-label>Closure Reason</mat-label>
|
<mat-label>Closure Reason</mat-label>
|
||||||
<mat-select formControlName="closureReasonId">
|
<mat-select formControlName="closureReasonId">
|
||||||
<mat-option *ngFor="let reason of closureData" [value]="reason.id">
|
<mat-option *ngFor="let reason of closureData" [value]="reason.id">
|
||||||
{{ reason.description }}
|
{{ reason.name }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="closeClientForm.controls.closureReasonId.hasError('required')">
|
<mat-error *ngIf="closeClientForm.controls.closureReasonId.hasError('required')">
|
||||||
|
|||||||
+30
@@ -0,0 +1,30 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<form [formGroup]="reactivateClientForm" (ngSubmit)="submit()">
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<mat-form-field fxFlex>
|
||||||
|
<mat-label>Re Activation On Date</mat-label>
|
||||||
|
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="reactivationDatePicker" required formControlName="reactivationDate">
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="reactivationDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #reactivationDatePicker></mat-datepicker>
|
||||||
|
<mat-error *ngIf="reactivateClientForm.controls.reactivationDate.hasError('required')">
|
||||||
|
Reactivation 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]="!reactivateClientForm.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 { ReactivateClientComponent } from './reactivate-client.component';
|
||||||
|
|
||||||
|
describe('ReactivateClientComponent', () => {
|
||||||
|
let component: ReactivateClientComponent;
|
||||||
|
let fixture: ComponentFixture<ReactivateClientComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ReactivateClientComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ReactivateClientComponent);
|
||||||
|
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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reactivate Client Component
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-reactivate-client',
|
||||||
|
templateUrl: './reactivate-client.component.html',
|
||||||
|
styleUrls: ['./reactivate-client.component.scss']
|
||||||
|
})
|
||||||
|
export class ReactivateClientComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Minimum date allowed. */
|
||||||
|
minDate = new Date(2000, 0, 1);
|
||||||
|
/** Maximum date allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
/** Reactivate client form. */
|
||||||
|
reactivateClientForm: FormGroup;
|
||||||
|
/** Client Account Id */
|
||||||
|
clientId: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {FormBuilder} formBuilder Form Builder
|
||||||
|
* @param {clientsService} clientsService Clients 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 reactivate client form.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.createReactivateClientForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the reactivate client form.
|
||||||
|
*/
|
||||||
|
createReactivateClientForm() {
|
||||||
|
this.reactivateClientForm = this.formBuilder.group({
|
||||||
|
'reactivationDate': ['', Validators.required]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits the form and reactivates the client,
|
||||||
|
* 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 prevReactivationDate: Date = this.reactivateClientForm.value.reactivationDate;
|
||||||
|
this.reactivateClientForm.patchValue({
|
||||||
|
reactivationDate: this.datePipe.transform(prevReactivationDate, dateFormat),
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
...this.reactivateClientForm.value,
|
||||||
|
dateFormat,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
this.clientsService.executeClientCommand(this.clientId, 'reactivate', data).subscribe(() => {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
<mat-label>Rejection Reason</mat-label>
|
<mat-label>Rejection Reason</mat-label>
|
||||||
<mat-select formControlName="rejectionReasonId">
|
<mat-select formControlName="rejectionReasonId">
|
||||||
<mat-option *ngFor="let reason of rejectionData" [value]="reason.id">
|
<mat-option *ngFor="let reason of rejectionData" [value]="reason.id">
|
||||||
{{ reason.description }}
|
{{ reason.name }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="rejectClientForm.controls.rejectionReasonId.hasError('required')">
|
<mat-error *ngIf="rejectClientForm.controls.rejectionReasonId.hasError('required')">
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@
|
|||||||
<mat-label>Withdrawal Reason</mat-label>
|
<mat-label>Withdrawal Reason</mat-label>
|
||||||
<mat-select formControlName="withdrawalReasonId">
|
<mat-select formControlName="withdrawalReasonId">
|
||||||
<mat-option *ngFor="let reason of withdrawalData" [value]="reason.id">
|
<mat-option *ngFor="let reason of withdrawalData" [value]="reason.id">
|
||||||
{{ reason.description }}
|
{{ reason.name }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
<mat-error *ngIf="withdrawClientForm.controls.withdrawalReasonId.hasError('required')">
|
<mat-error *ngIf="withdrawClientForm.controls.withdrawalReasonId.hasError('required')">
|
||||||
|
|||||||
@@ -53,6 +53,7 @@
|
|||||||
<span *ngIf="clientViewData.status.value === 'Pending'"><button mat-menu-item (click)="doAction('Withdraw')">Withdraw</button></span>
|
<span *ngIf="clientViewData.status.value === 'Pending'"><button mat-menu-item (click)="doAction('Withdraw')">Withdraw</button></span>
|
||||||
<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('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 === '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>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ export class ClientsViewComponent implements OnInit {
|
|||||||
case 'Undo Transfer':
|
case 'Undo Transfer':
|
||||||
case 'Accept Transfer':
|
case 'Accept Transfer':
|
||||||
case 'Reject Transfer':
|
case 'Reject Transfer':
|
||||||
|
case 'Reactivate':
|
||||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||||
break;
|
break;
|
||||||
case 'Unassign Staff':
|
case 'Unassign Staff':
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import { TransferClientComponent } from './clients-view/client-actions/transfer-
|
|||||||
import { UndoClientTransferComponent } from './clients-view/client-actions/undo-client-transfer/undo-client-transfer.component';
|
import { UndoClientTransferComponent } from './clients-view/client-actions/undo-client-transfer/undo-client-transfer.component';
|
||||||
import { RejectClientTransferComponent } from './clients-view/client-actions/reject-client-transfer/reject-client-transfer.component';
|
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 { 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';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -83,7 +84,8 @@ import { AcceptClientTransferComponent } from './clients-view/client-actions/acc
|
|||||||
TransferClientComponent,
|
TransferClientComponent,
|
||||||
UndoClientTransferComponent,
|
UndoClientTransferComponent,
|
||||||
RejectClientTransferComponent,
|
RejectClientTransferComponent,
|
||||||
AcceptClientTransferComponent
|
AcceptClientTransferComponent,
|
||||||
|
ReactivateClientComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
UploadDocumentDialogComponent,
|
UploadDocumentDialogComponent,
|
||||||
|
|||||||
Reference in New Issue
Block a user