@@ -4,3 +4,4 @@
|
|||||||
<mifosx-reject-client *ngIf="actions['Reject']"></mifosx-reject-client>
|
<mifosx-reject-client *ngIf="actions['Reject']"></mifosx-reject-client>
|
||||||
<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>
|
||||||
|
|||||||
@@ -19,12 +19,14 @@ export class ClientActionsComponent {
|
|||||||
'Reject': boolean
|
'Reject': boolean
|
||||||
'Survey': boolean
|
'Survey': boolean
|
||||||
'Withdraw': boolean
|
'Withdraw': boolean
|
||||||
|
'Update Default Savings': 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
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<form [formGroup]="clientSavingsAccountForm" (ngSubmit)="submit()">
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<div fxLayout="column">
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>Default Savings Account</mat-label>
|
||||||
|
<mat-select formControlName="savingsAccountId">
|
||||||
|
<mat-option *ngFor="let account of savingsAccounts" [value]="account.id">
|
||||||
|
{{ account.accountNo }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="clientSavingsAccountForm.controls.savingsAccountId.hasError('required')">
|
||||||
|
Account is <strong>required</strong>
|
||||||
|
</mat-error>
|
||||||
|
</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]="!clientSavingsAccountForm.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 { UpdateClientSavingsAccountComponent } from './update-client-savings-account.component';
|
||||||
|
|
||||||
|
describe('UpdateClientSavingsAccountComponent', () => {
|
||||||
|
let component: UpdateClientSavingsAccountComponent;
|
||||||
|
let fixture: ComponentFixture<UpdateClientSavingsAccountComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ UpdateClientSavingsAccountComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(UpdateClientSavingsAccountComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+69
@@ -0,0 +1,69 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { FormGroup, FormBuilder } from '@angular/forms';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { ClientsService } from 'app/clients/clients.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clients Update Savings Account Component
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-update-client-savings-account',
|
||||||
|
templateUrl: './update-client-savings-account.component.html',
|
||||||
|
styleUrls: ['./update-client-savings-account.component.scss']
|
||||||
|
})
|
||||||
|
export class UpdateClientSavingsAccountComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Client Update Savings Account form. */
|
||||||
|
clientSavingsAccountForm: FormGroup;
|
||||||
|
/** Savings Accounts Officer Data */
|
||||||
|
savingsAccounts: any;
|
||||||
|
/** Client Data */
|
||||||
|
clientData: any;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches Client Action Data from `resolve`
|
||||||
|
* @param {FormBuilder} formBuilder Form Builder
|
||||||
|
* @param {SavingsService} savingsService Savings Service
|
||||||
|
* @param {ActivatedRoute} route Activated Route
|
||||||
|
* @param {Router} router Router
|
||||||
|
*/
|
||||||
|
constructor(private formBuilder: FormBuilder,
|
||||||
|
private clientsService: ClientsService,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private router: Router) {
|
||||||
|
this.route.data.subscribe((data: { clientActionData: any }) => {
|
||||||
|
this.clientData = data.clientActionData;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the client update savings account form.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.savingsAccounts = this.clientData.savingAccountOptions;
|
||||||
|
this.createClientSavingsAccountForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the client update savings account form.
|
||||||
|
*/
|
||||||
|
createClientSavingsAccountForm() {
|
||||||
|
this.clientSavingsAccountForm = this.formBuilder.group({
|
||||||
|
'savingsAccountId': [this.clientData.savingsAccountId]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits the form and update savings account for the client.
|
||||||
|
*/
|
||||||
|
submit() {
|
||||||
|
this.clientsService.executeClientCommand(this.clientData.id, 'updateSavingsAccount', this.clientSavingsAccountForm.value)
|
||||||
|
.subscribe(() => {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
<span *ngIf="clientViewData.staffId"><button mat-menu-item (click)="doAction('Unassign Staff')">Unassign Staff</button></span>
|
<span *ngIf="clientViewData.staffId"><button mat-menu-item (click)="doAction('Unassign Staff')">Unassign Staff</button></span>
|
||||||
<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>
|
||||||
<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>
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ export class ClientsViewComponent implements OnInit {
|
|||||||
case 'Reject':
|
case 'Reject':
|
||||||
case 'Activate':
|
case 'Activate':
|
||||||
case 'Withdraw':
|
case 'Withdraw':
|
||||||
|
case 'Update Default Savings':
|
||||||
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||||
break;
|
break;
|
||||||
case 'Unassign Staff':
|
case 'Unassign Staff':
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import { RejectClientComponent } from './clients-view/client-actions/reject-clie
|
|||||||
import { ActivateClientComponent } from './clients-view/client-actions/activate-client/activate-client.component';
|
import { ActivateClientComponent } from './clients-view/client-actions/activate-client/activate-client.component';
|
||||||
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';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,7 +74,8 @@ import { TakeSurveyComponent } from './clients-view/client-actions/view-survey/t
|
|||||||
RejectClientComponent,
|
RejectClientComponent,
|
||||||
ActivateClientComponent,
|
ActivateClientComponent,
|
||||||
WithdrawClientComponent,
|
WithdrawClientComponent,
|
||||||
TakeSurveyComponent
|
TakeSurveyComponent,
|
||||||
|
UpdateClientSavingsAccountComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
UploadDocumentDialogComponent,
|
UploadDocumentDialogComponent,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export class ClientActionsResolver implements Resolve<Object> {
|
|||||||
const clientId = route.paramMap.get('clientId') || route.parent.parent.paramMap.get('clientId');
|
const clientId = route.paramMap.get('clientId') || route.parent.parent.paramMap.get('clientId');
|
||||||
switch (actionName) {
|
switch (actionName) {
|
||||||
case 'Assign Staff':
|
case 'Assign Staff':
|
||||||
|
case 'Update Default Savings':
|
||||||
return this.clientsService.getClientDataAndTemplate(clientId);
|
return this.clientsService.getClientDataAndTemplate(clientId);
|
||||||
case 'Survey':
|
case 'Survey':
|
||||||
return this.clientsService.getSurveys(clientId);
|
return this.clientsService.getSurveys(clientId);
|
||||||
|
|||||||
Reference in New Issue
Block a user