@@ -5,3 +5,4 @@
|
|||||||
<mifosx-activate-client *ngIf="actions['Activate']"></mifosx-activate-client>
|
<mifosx-activate-client *ngIf="actions['Activate']"></mifosx-activate-client>
|
||||||
<mifosx-withdraw-client *ngIf="actions['Withdraw']"></mifosx-withdraw-client>
|
<mifosx-withdraw-client *ngIf="actions['Withdraw']"></mifosx-withdraw-client>
|
||||||
<mifosx-update-client-savings-account *ngIf="actions['Update Default Savings']"></mifosx-update-client-savings-account>
|
<mifosx-update-client-savings-account *ngIf="actions['Update Default Savings']"></mifosx-update-client-savings-account>
|
||||||
|
<mifosx-transfer-client *ngIf="actions['Transfer Client']"></mifosx-transfer-client>
|
||||||
|
|||||||
@@ -20,13 +20,15 @@ export class ClientActionsComponent {
|
|||||||
'Survey': boolean
|
'Survey': boolean
|
||||||
'Withdraw': boolean
|
'Withdraw': boolean
|
||||||
'Update Default Savings': boolean
|
'Update Default Savings': boolean
|
||||||
|
'Transfer Client': boolean
|
||||||
} = {
|
} = {
|
||||||
'Assign Staff': false,
|
'Assign Staff': false,
|
||||||
'Close': false,
|
'Close': false,
|
||||||
'Reject': false,
|
'Reject': false,
|
||||||
'Survey': false,
|
'Survey': false,
|
||||||
'Withdraw': false,
|
'Withdraw': false,
|
||||||
'Update Default Savings': false
|
'Update Default Savings': false,
|
||||||
|
'Transfer Client': false
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+51
@@ -0,0 +1,51 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<form [formGroup]="transferClientForm" (ngSubmit)="submit()">
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<div fxLayout="column">
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Office</mat-label>
|
||||||
|
<mat-select required formControlName="destinationOfficeId">
|
||||||
|
<mat-option *ngFor="let office of officeData" [value]="office.id">
|
||||||
|
{{ office.name }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="transferClientForm.controls.destinationOfficeId.hasError('required')">
|
||||||
|
Office is <strong>required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<mat-form-field>
|
||||||
|
<mat-label>Transfer Date</mat-label>
|
||||||
|
<input matInput [min]="minDate" [max]="maxDate" [matDatepicker]="transferDatePicker" required formControlName="transferDate">
|
||||||
|
<mat-datepicker-toggle matSuffix [for]="transferDatePicker"></mat-datepicker-toggle>
|
||||||
|
<mat-datepicker #transferDatePicker></mat-datepicker>
|
||||||
|
<mat-error *ngIf="transferClientForm.controls.transferDate.hasError('required')">
|
||||||
|
Transfer 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="primary" [disabled]="!transferClientForm.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 { TransferClientComponent } from './transfer-client.component';
|
||||||
|
|
||||||
|
describe('TransferClientComponent', () => {
|
||||||
|
let component: TransferClientComponent;
|
||||||
|
let fixture: ComponentFixture<TransferClientComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ TransferClientComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(TransferClientComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+85
@@ -0,0 +1,85 @@
|
|||||||
|
/** 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';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Transfer Client Component
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-transfer-client',
|
||||||
|
templateUrl: './transfer-client.component.html',
|
||||||
|
styleUrls: ['./transfer-client.component.scss']
|
||||||
|
})
|
||||||
|
export class TransferClientComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Minimum date allowed. */
|
||||||
|
minDate = new Date(2000, 0, 1);
|
||||||
|
/** Maximum date allowed. */
|
||||||
|
maxDate = new Date();
|
||||||
|
/** Transfer Client form. */
|
||||||
|
transferClientForm: FormGroup;
|
||||||
|
/** Client Data */
|
||||||
|
officeData: any;
|
||||||
|
/** Client 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.route.data.subscribe((data: { clientActionData: any }) => {
|
||||||
|
this.officeData = data.clientActionData;
|
||||||
|
});
|
||||||
|
this.clientId = this.route.parent.snapshot.params['clientId'];
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.createTransferClientForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the transfer client form.
|
||||||
|
*/
|
||||||
|
createTransferClientForm() {
|
||||||
|
this.transferClientForm = this.formBuilder.group({
|
||||||
|
'destinationOfficeId': ['', Validators.required],
|
||||||
|
'transferDate': ['', Validators.required],
|
||||||
|
'note': ['']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits the form and transfers the client.
|
||||||
|
*/
|
||||||
|
submit() {
|
||||||
|
// TODO: Update once language and date settings are setup
|
||||||
|
const locale = 'en';
|
||||||
|
const dateFormat = 'dd MMMM yyyy';
|
||||||
|
const prevClosedDate: Date = this.transferClientForm.value.transferDate;
|
||||||
|
this.transferClientForm.patchValue({
|
||||||
|
transferDate: this.datePipe.transform(prevClosedDate, dateFormat),
|
||||||
|
});
|
||||||
|
const data = {
|
||||||
|
...this.transferClientForm.value,
|
||||||
|
dateFormat,
|
||||||
|
locale
|
||||||
|
};
|
||||||
|
this.clientsService.executeClientCommand(this.clientId, 'proposeTransfer', data).subscribe(() => {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -45,6 +45,7 @@
|
|||||||
<button mat-menu-item (click)="doAction('Close')">Close</button>
|
<button mat-menu-item (click)="doAction('Close')">Close</button>
|
||||||
<button mat-menu-item (click)="doAction('Survey')"> Survey</button>
|
<button mat-menu-item (click)="doAction('Survey')"> Survey</button>
|
||||||
<button mat-menu-item (click)="doAction('Update Default Savings')"> Update Default Savings </button>
|
<button mat-menu-item (click)="doAction('Update Default Savings')"> Update Default Savings </button>
|
||||||
|
<button mat-menu-item (click)="doAction('Transfer Client')"> Transfer Client </button>
|
||||||
<span *ngIf="clientViewData.status.value === 'Pending'"><button mat-menu-item (click)="doAction('Activate')">Activate</button></span>
|
<span *ngIf="clientViewData.status.value === 'Pending'"><button mat-menu-item (click)="doAction('Activate')">Activate</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('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>
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export class ClientsViewComponent implements OnInit {
|
|||||||
case 'Activate':
|
case 'Activate':
|
||||||
case 'Withdraw':
|
case 'Withdraw':
|
||||||
case 'Update Default Savings':
|
case 'Update Default Savings':
|
||||||
|
case 'Transfer Client':
|
||||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||||
break;
|
break;
|
||||||
case 'Unassign Staff':
|
case 'Unassign Staff':
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import { ActivateClientComponent } from './clients-view/client-actions/activate-
|
|||||||
import { WithdrawClientComponent } from './clients-view/client-actions/withdraw-client/withdraw-client.component';
|
import { WithdrawClientComponent } from './clients-view/client-actions/withdraw-client/withdraw-client.component';
|
||||||
import { TakeSurveyComponent } from './clients-view/client-actions/view-survey/take-survey/take-survey.component';
|
import { TakeSurveyComponent } from './clients-view/client-actions/view-survey/take-survey/take-survey.component';
|
||||||
import { UpdateClientSavingsAccountComponent } from './clients-view/client-actions/update-client-savings-account/update-client-savings-account.component';
|
import { UpdateClientSavingsAccountComponent } from './clients-view/client-actions/update-client-savings-account/update-client-savings-account.component';
|
||||||
|
import { TransferClientComponent } from './clients-view/client-actions/transfer-client/transfer-client.component';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,7 +76,8 @@ import { UpdateClientSavingsAccountComponent } from './clients-view/client-actio
|
|||||||
ActivateClientComponent,
|
ActivateClientComponent,
|
||||||
WithdrawClientComponent,
|
WithdrawClientComponent,
|
||||||
TakeSurveyComponent,
|
TakeSurveyComponent,
|
||||||
UpdateClientSavingsAccountComponent
|
UpdateClientSavingsAccountComponent,
|
||||||
|
TransferClientComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
UploadDocumentDialogComponent,
|
UploadDocumentDialogComponent,
|
||||||
|
|||||||
@@ -220,6 +220,13 @@ export class ClientsService {
|
|||||||
return this.http.get(`/clients/template`, { params: httpParams });
|
return this.http.get(`/clients/template`, { params: httpParams });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns {Observable<any>} Offices data
|
||||||
|
*/
|
||||||
|
getOffices(): Observable<any> {
|
||||||
|
return this.http.get('/offices');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the list of survey data of the particular Client
|
* returns the list of survey data of the particular Client
|
||||||
* @param clientId
|
* @param clientId
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ export class ClientActionsResolver implements Resolve<Object> {
|
|||||||
return this.clientsService.getClientCommandTemplate('reject');
|
return this.clientsService.getClientCommandTemplate('reject');
|
||||||
case 'Withdraw':
|
case 'Withdraw':
|
||||||
return this.clientsService.getClientCommandTemplate('withdraw');
|
return this.clientsService.getClientCommandTemplate('withdraw');
|
||||||
|
case 'Transfer Client':
|
||||||
|
return this.clientsService.getOffices();
|
||||||
default:
|
default:
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user