@@ -19,6 +19,7 @@ import { NotesTabComponent } from './clients-view/notes-tab/notes-tab.component'
|
|||||||
import { DocumentsTabComponent } from './clients-view/documents-tab/documents-tab.component';
|
import { DocumentsTabComponent } from './clients-view/documents-tab/documents-tab.component';
|
||||||
import { DatatableTabComponent } from './clients-view/datatable-tab/datatable-tab.component';
|
import { DatatableTabComponent } from './clients-view/datatable-tab/datatable-tab.component';
|
||||||
import { AddressTabComponent } from './clients-view/address-tab/address-tab.component';
|
import { AddressTabComponent } from './clients-view/address-tab/address-tab.component';
|
||||||
|
import { ClientActionsComponent } from './clients-view/client-actions/client-actions.component';
|
||||||
|
|
||||||
/** Custom Resolvers */
|
/** Custom Resolvers */
|
||||||
import { ClientViewResolver } from './common-resolvers/client-view.resolver';
|
import { ClientViewResolver } from './common-resolvers/client-view.resolver';
|
||||||
@@ -39,6 +40,7 @@ import { ClientAddressFieldConfigurationResolver } from './common-resolvers/clie
|
|||||||
import { ClientAddressTemplateResolver } from './common-resolvers/client-address-template.resolver';
|
import { ClientAddressTemplateResolver } from './common-resolvers/client-address-template.resolver';
|
||||||
import { ChargesOverviewComponent } from './clients-view/charges-overview/charges-overview.component';
|
import { ChargesOverviewComponent } from './clients-view/charges-overview/charges-overview.component';
|
||||||
import { ClientChargeOverviewResolver } from './clients-view/charges-overview/charge-overview.resolver';
|
import { ClientChargeOverviewResolver } from './clients-view/charges-overview/charge-overview.resolver';
|
||||||
|
import { ClientActionsResolver } from './common-resolvers/client-actions.resolver';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
Route.withShell([{
|
Route.withShell([{
|
||||||
@@ -168,6 +170,14 @@ const routes: Routes = [
|
|||||||
path: ':clientId',
|
path: ':clientId',
|
||||||
data: { title: extract('Clients View'), routeParamBreadcrumb: 'clientId' },
|
data: { title: extract('Clients View'), routeParamBreadcrumb: 'clientId' },
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
path: 'actions/:name',
|
||||||
|
data: { title: extract('Client Actions'), routeParamBreadcrumb: 'name' },
|
||||||
|
component: ClientActionsComponent,
|
||||||
|
resolve: {
|
||||||
|
clientActionData: ClientActionsResolver
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'loans',
|
path: 'loans',
|
||||||
data: { title: extract('Loans'), breadcrumb: 'loans', routeParamBreadcrumb: false },
|
data: { title: extract('Loans'), breadcrumb: 'loans', routeParamBreadcrumb: false },
|
||||||
@@ -216,7 +226,8 @@ const routes: Routes = [
|
|||||||
ClientIdentifierTemplateResolver,
|
ClientIdentifierTemplateResolver,
|
||||||
ClientAddressFieldConfigurationResolver,
|
ClientAddressFieldConfigurationResolver,
|
||||||
ClientAddressTemplateResolver,
|
ClientAddressTemplateResolver,
|
||||||
ClientChargeOverviewResolver
|
ClientChargeOverviewResolver,
|
||||||
|
ClientActionsResolver
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ClientsRoutingModule { }
|
export class ClientsRoutingModule { }
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
<mifosx-client-assign-staff *ngIf="actions['Assign Staff']"></mifosx-client-assign-staff>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { ClientActionsComponent } from './client-actions.component';
|
||||||
|
|
||||||
|
describe('ClientActionsComponent', () => {
|
||||||
|
let component: ClientActionsComponent;
|
||||||
|
let fixture: ComponentFixture<ClientActionsComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ClientActionsComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ClientActionsComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client actions component.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-client-actions',
|
||||||
|
templateUrl: './client-actions.component.html',
|
||||||
|
styleUrls: ['./client-actions.component.scss']
|
||||||
|
})
|
||||||
|
export class ClientActionsComponent {
|
||||||
|
|
||||||
|
/** Flag object to store possible actions and render appropriate UI to the user */
|
||||||
|
actions: {
|
||||||
|
'Assign Staff': boolean
|
||||||
|
} = {
|
||||||
|
'Assign Staff': false,
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ActivatedRoute} route Activated Route
|
||||||
|
* @param {Router} router Router
|
||||||
|
*/
|
||||||
|
constructor(private route: ActivatedRoute,
|
||||||
|
private router: Router) {
|
||||||
|
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||||
|
const name = this.route.snapshot.params['name'];
|
||||||
|
this.actions[name] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+36
@@ -0,0 +1,36 @@
|
|||||||
|
<div class="container">
|
||||||
|
|
||||||
|
<mat-card>
|
||||||
|
|
||||||
|
<form [formGroup]="clientAssignStaffForm" (ngSubmit)="submit()">
|
||||||
|
|
||||||
|
<mat-card-content>
|
||||||
|
|
||||||
|
<div fxLayout="column">
|
||||||
|
|
||||||
|
<mat-form-field fxFlex="48%">
|
||||||
|
<mat-label>Staff</mat-label>
|
||||||
|
<mat-select formControlName="staffId">
|
||||||
|
<mat-option *ngFor="let staff of staffData" [value]="staff.id">
|
||||||
|
{{ staff.displayName }}
|
||||||
|
</mat-option>
|
||||||
|
</mat-select>
|
||||||
|
<mat-error *ngIf="clientAssignStaffForm.controls.staffId.hasError('required')">
|
||||||
|
Staff 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]="!clientAssignStaffForm.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 { ClientAssignStaffComponent } from './client-assign-staff.component';
|
||||||
|
|
||||||
|
describe('ClientAssignStaffComponent', () => {
|
||||||
|
let component: ClientAssignStaffComponent;
|
||||||
|
let fixture: ComponentFixture<ClientAssignStaffComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ ClientAssignStaffComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(ClientAssignStaffComponent);
|
||||||
|
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 Assign Staff Component
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-client-assign-staff',
|
||||||
|
templateUrl: './client-assign-staff.component.html',
|
||||||
|
styleUrls: ['./client-assign-staff.component.scss']
|
||||||
|
})
|
||||||
|
export class ClientAssignStaffComponent implements OnInit {
|
||||||
|
|
||||||
|
/** Client Assign Staff form. */
|
||||||
|
clientAssignStaffForm: FormGroup;
|
||||||
|
/** Field Officer Data */
|
||||||
|
staffData: 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 assign staff form.
|
||||||
|
*/
|
||||||
|
ngOnInit() {
|
||||||
|
this.staffData = this.clientData.staffOptions;
|
||||||
|
this.createClientAssignStaffForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the client assign staff form.
|
||||||
|
*/
|
||||||
|
createClientAssignStaffForm() {
|
||||||
|
this.clientAssignStaffForm = this.formBuilder.group({
|
||||||
|
'staffId': ['']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Submits the form and assigns staff for the client.
|
||||||
|
*/
|
||||||
|
submit() {
|
||||||
|
this.clientsService.executeClientCommand(this.clientData.id, 'assignStaff', this.clientAssignStaffForm.value)
|
||||||
|
.subscribe(() => {
|
||||||
|
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
<mat-card-subtitle>
|
<mat-card-subtitle>
|
||||||
<p>
|
<p>
|
||||||
Client #:{{clientViewData.accountNo}} | External
|
Client #:{{clientViewData.accountNo}} | External
|
||||||
Id: {{clientViewData.externalId}} | Staff:{{clientViewData.staffName}}<br />
|
Id: {{clientViewData.externalId}} | Staff:{{clientViewData.staffName || 'Unassigned'}}<br />
|
||||||
Activation Date :
|
Activation Date :
|
||||||
{{(clientViewData.activationDate)?(clientViewData.activationDate|date) :'Not Activated'}}<br />
|
{{(clientViewData.activationDate)?(clientViewData.activationDate|date) :'Not Activated'}}<br />
|
||||||
Member Of : <span *ngFor="let group of clientViewData.groups">
|
Member Of : <span *ngFor="let group of clientViewData.groups">
|
||||||
@@ -40,7 +40,8 @@
|
|||||||
<button mat-menu-item [routerLink]="['sharesaccounts', 'create-shares-account']">New Share Account</button>
|
<button mat-menu-item [routerLink]="['sharesaccounts', 'create-shares-account']">New Share Account</button>
|
||||||
<button mat-menu-item [routerLink]="['recurringdeposits', 'create-recurring-deposits-account']">New Recurring Deposit Account</button>
|
<button mat-menu-item [routerLink]="['recurringdeposits', 'create-recurring-deposits-account']">New Recurring Deposit Account</button>
|
||||||
<button mat-menu-item [routerLink]="['fixed-deposits-accounts', 'create-fixed-deposit-account']">New Fixed Deposits Account</button>
|
<button mat-menu-item [routerLink]="['fixed-deposits-accounts', 'create-fixed-deposit-account']">New Fixed Deposits Account</button>
|
||||||
<button mat-menu-item>Item 2</button>
|
<span *ngIf="!clientViewData.staffId"><button mat-menu-item (click)="doAction('Assign Staff')">Assign Staff</button></span>
|
||||||
|
<span *ngIf="clientViewData.staffId"><button mat-menu-item (click)="doAction('Unassign Staff')">Unassign Staff</button></span>
|
||||||
</mat-menu>
|
</mat-menu>
|
||||||
</mat-card-actions>
|
</mat-card-actions>
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
|
|||||||
@@ -1,24 +1,32 @@
|
|||||||
/** Angular Imports */
|
/** Angular Imports */
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { DomSanitizer } from '@angular/platform-browser';
|
import { DomSanitizer } from '@angular/platform-browser';
|
||||||
|
import { MatDialog } from '@angular/material';
|
||||||
|
|
||||||
|
/** Custom Dialogs */
|
||||||
|
import { UnassignStaffDialogComponent } from './custom-dialogs/unassign-staff-dialog/unassign-staff-dialog.component';
|
||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { ClientsService } from '../clients.service';
|
import { ClientsService } from '../clients.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-clients-view',
|
selector: 'mifosx-clients-view',
|
||||||
templateUrl: './clients-view.component.html',
|
templateUrl: './clients-view.component.html',
|
||||||
styleUrls: ['./clients-view.component.scss']
|
styleUrls: ['./clients-view.component.scss']
|
||||||
})
|
})
|
||||||
export class ClientsViewComponent implements OnInit {
|
export class ClientsViewComponent implements OnInit {
|
||||||
|
|
||||||
clientViewData: any;
|
clientViewData: any;
|
||||||
clientDatatables: any;
|
clientDatatables: any;
|
||||||
clientImage: any;
|
clientImage: any;
|
||||||
clientTemplateData: any;
|
clientTemplateData: any;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private clientsService: ClientsService,
|
private router: Router,
|
||||||
private _sanitizer: DomSanitizer) {
|
private clientsService: ClientsService,
|
||||||
|
private _sanitizer: DomSanitizer,
|
||||||
|
public dialog: MatDialog) {
|
||||||
this.route.data.subscribe((data: {
|
this.route.data.subscribe((data: {
|
||||||
clientViewData: any,
|
clientViewData: any,
|
||||||
clientTemplateData: any,
|
clientTemplateData: any,
|
||||||
@@ -35,4 +43,46 @@ export class ClientsViewComponent implements OnInit {
|
|||||||
this.clientImage = this._sanitizer.bypassSecurityTrustResourceUrl(base64Image);
|
this.clientImage = this._sanitizer.bypassSecurityTrustResourceUrl(base64Image);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs action button/option action.
|
||||||
|
* @param {string} name action name.
|
||||||
|
*/
|
||||||
|
doAction(name: string) {
|
||||||
|
switch (name) {
|
||||||
|
case 'Assign Staff':
|
||||||
|
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
|
||||||
|
break;
|
||||||
|
case 'Unassign Staff':
|
||||||
|
this.unassignStaff();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refetches data for the component
|
||||||
|
* TODO: Replace by a custom reload component instead of hard-coded back-routing.
|
||||||
|
*/
|
||||||
|
reload() {
|
||||||
|
const url: string = this.router.url;
|
||||||
|
this.router.navigateByUrl(`/clients`, {skipLocationChange: true})
|
||||||
|
.then(() => this.router.navigate([url]));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unassign's the group's staff.
|
||||||
|
*/
|
||||||
|
private unassignStaff() {
|
||||||
|
const unAssignStaffDialogRef = this.dialog.open(UnassignStaffDialogComponent);
|
||||||
|
unAssignStaffDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
||||||
|
if (response.confirm) {
|
||||||
|
this.clientsService.executeClientCommand(this.clientViewData.id, 'unassignStaff', { staffId: this.clientViewData.staffId })
|
||||||
|
.subscribe(() => {
|
||||||
|
this.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<h1 mat-dialog-title>Unassign Staff</h1>
|
||||||
|
<div mat-dialog-content>
|
||||||
|
<p>Are you sure you want to unassign staff for this client ?</p>
|
||||||
|
</div>
|
||||||
|
<mat-dialog-actions align="end">
|
||||||
|
<button mat-raised-button mat-dialog-close>Cancel</button>
|
||||||
|
<button mat-raised-button color="warn" [mat-dialog-close]="{ confirm: true }">Confirm</button>
|
||||||
|
</mat-dialog-actions>
|
||||||
+25
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { UnassignStaffDialogComponent } from './unassign-staff-dialog.component';
|
||||||
|
|
||||||
|
describe('UnassignStaffDialogComponent', () => {
|
||||||
|
let component: UnassignStaffDialogComponent;
|
||||||
|
let fixture: ComponentFixture<UnassignStaffDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ UnassignStaffDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(UnassignStaffDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component, Inject } from '@angular/core';
|
||||||
|
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unassign staff dialog component.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-unassign-staff-dialog',
|
||||||
|
templateUrl: './unassign-staff-dialog.component.html',
|
||||||
|
styleUrls: ['./unassign-staff-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class UnassignStaffDialogComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||||
|
*/
|
||||||
|
constructor(public dialogRef: MatDialogRef<UnassignStaffDialogComponent>) { }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ import { MatDialog } from '@angular/material';
|
|||||||
import { ClientsService } from '../../clients.service';
|
import { ClientsService } from '../../clients.service';
|
||||||
|
|
||||||
/** Custom Components */
|
/** Custom Components */
|
||||||
import { UploadDocumentDialogComponent } from '../upload-document-dialog/upload-document-dialog.component';
|
import { UploadDocumentDialogComponent } from '../custom-dialogs/upload-document-dialog/upload-document-dialog.component';
|
||||||
import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dialog.component';
|
import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dialog.component';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
|||||||
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
|
||||||
|
|
||||||
/** Custom Components */
|
/** Custom Components */
|
||||||
import { UploadDocumentDialogComponent } from '../upload-document-dialog/upload-document-dialog.component';
|
import { UploadDocumentDialogComponent } from '../custom-dialogs/upload-document-dialog/upload-document-dialog.component';
|
||||||
import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dialog.component';
|
import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dialog.component';
|
||||||
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component';
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dial
|
|||||||
|
|
||||||
/** Custom Services */
|
/** Custom Services */
|
||||||
import { ClientsService } from '../../clients.service';
|
import { ClientsService } from '../../clients.service';
|
||||||
import { EditNotesDialogComponent } from '../edit-notes-dialog/edit-notes-dialog.component';
|
import { EditNotesDialogComponent } from '../custom-dialogs/edit-notes-dialog/edit-notes-dialog.component';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'mifosx-notes-tab',
|
selector: 'mifosx-notes-tab',
|
||||||
|
|||||||
@@ -16,15 +16,18 @@ import { FamilyMembersTabComponent } from './clients-view/family-members-tab/fam
|
|||||||
import { AddFamilyMemberComponent } from './clients-view/family-members-tab/add-family-member/add-family-member.component';
|
import { AddFamilyMemberComponent } from './clients-view/family-members-tab/add-family-member/add-family-member.component';
|
||||||
import { EditFamilyMemberComponent } from './clients-view/family-members-tab/edit-family-member/edit-family-member.component';
|
import { EditFamilyMemberComponent } from './clients-view/family-members-tab/edit-family-member/edit-family-member.component';
|
||||||
import { IdentitiesTabComponent } from './clients-view/identities-tab/identities-tab.component';
|
import { IdentitiesTabComponent } from './clients-view/identities-tab/identities-tab.component';
|
||||||
import { UploadDocumentDialogComponent } from './clients-view/upload-document-dialog/upload-document-dialog.component';
|
import { UploadDocumentDialogComponent } from './clients-view/custom-dialogs/upload-document-dialog/upload-document-dialog.component';
|
||||||
import { NotesTabComponent } from './clients-view/notes-tab/notes-tab.component';
|
import { NotesTabComponent } from './clients-view/notes-tab/notes-tab.component';
|
||||||
import { EditNotesDialogComponent } from './clients-view/edit-notes-dialog/edit-notes-dialog.component';
|
import { EditNotesDialogComponent } from './clients-view/custom-dialogs/edit-notes-dialog/edit-notes-dialog.component';
|
||||||
import { DocumentsTabComponent } from './clients-view/documents-tab/documents-tab.component';
|
import { DocumentsTabComponent } from './clients-view/documents-tab/documents-tab.component';
|
||||||
import { DatatableTabComponent } from './clients-view/datatable-tab/datatable-tab.component';
|
import { DatatableTabComponent } from './clients-view/datatable-tab/datatable-tab.component';
|
||||||
import { MultiRowComponent } from './clients-view/datatable-tab/multi-row/multi-row.component';
|
import { MultiRowComponent } from './clients-view/datatable-tab/multi-row/multi-row.component';
|
||||||
import { SingleRowComponent } from './clients-view/datatable-tab/single-row/single-row.component';
|
import { SingleRowComponent } from './clients-view/datatable-tab/single-row/single-row.component';
|
||||||
import { AddressTabComponent } from './clients-view/address-tab/address-tab.component';
|
import { AddressTabComponent } from './clients-view/address-tab/address-tab.component';
|
||||||
import { ChargesOverviewComponent } from './clients-view/charges-overview/charges-overview.component';
|
import { ChargesOverviewComponent } from './clients-view/charges-overview/charges-overview.component';
|
||||||
|
import { ClientActionsComponent } from './clients-view/client-actions/client-actions.component';
|
||||||
|
import { ClientAssignStaffComponent } from './clients-view/client-actions/client-assign-staff/client-assign-staff.component';
|
||||||
|
import { UnassignStaffDialogComponent } from './clients-view/custom-dialogs/unassign-staff-dialog/unassign-staff-dialog.component';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,11 +58,15 @@ import { ChargesOverviewComponent } from './clients-view/charges-overview/charge
|
|||||||
MultiRowComponent,
|
MultiRowComponent,
|
||||||
SingleRowComponent,
|
SingleRowComponent,
|
||||||
AddressTabComponent,
|
AddressTabComponent,
|
||||||
ChargesOverviewComponent
|
ChargesOverviewComponent,
|
||||||
|
ClientActionsComponent,
|
||||||
|
ClientAssignStaffComponent,
|
||||||
|
UnassignStaffDialogComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
UploadDocumentDialogComponent,
|
UploadDocumentDialogComponent,
|
||||||
EditNotesDialogComponent
|
EditNotesDialogComponent,
|
||||||
|
UnassignStaffDialogComponent
|
||||||
],
|
],
|
||||||
providers: [DatePipe]
|
providers: [DatePipe]
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,13 @@ export class ClientsService {
|
|||||||
return this.http.get(`/clients/${clientId}`);
|
return this.http.get(`/clients/${clientId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getClientDataAndTemplate(clientId: string) {
|
||||||
|
const httpParams = new HttpParams()
|
||||||
|
.set('template', 'true')
|
||||||
|
.set('staffInSelectedOfficeOnly', 'true');
|
||||||
|
return this.http.get(`/clients/${clientId}`, { params: httpParams });
|
||||||
|
}
|
||||||
|
|
||||||
getClientDatatables() {
|
getClientDatatables() {
|
||||||
const httpParams = new HttpParams().set('apptable', 'm_client');
|
const httpParams = new HttpParams().set('apptable', 'm_client');
|
||||||
return this.http.get(`/datatables`, { params: httpParams });
|
return this.http.get(`/datatables`, { params: httpParams });
|
||||||
@@ -205,4 +212,10 @@ export class ClientsService {
|
|||||||
editClientAddress(clientId: string, addressTypeId: string, addressData: any) {
|
editClientAddress(clientId: string, addressTypeId: string, addressData: any) {
|
||||||
return this.http.put(`/client/${clientId}/addresses?type=${addressTypeId}`, addressData);
|
return this.http.put(`/client/${clientId}/addresses?type=${addressTypeId}`, addressData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
executeClientCommand(clientId: string, command: string, data: any): Observable<any> {
|
||||||
|
const httpParams = new HttpParams().set('command', command);
|
||||||
|
return this.http.post(`/clients/${clientId}`, data, { params: httpParams });
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
|
||||||
|
|
||||||
|
/** rxjs Imports */
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
/** Custom Services */
|
||||||
|
import { ClientsService } from '../clients.service';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client Actions data resolver.
|
||||||
|
*/
|
||||||
|
@Injectable()
|
||||||
|
export class ClientActionsResolver implements Resolve<Object> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {ClientsService} clientsService Clients service.
|
||||||
|
*/
|
||||||
|
constructor(private clientsService: ClientsService) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the clients actions data.
|
||||||
|
* @param {ActivatedRouteSnapshot} route Route Snapshot
|
||||||
|
* @returns {Observable<any>}
|
||||||
|
*/
|
||||||
|
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||||
|
const actionName = route.paramMap.get('name');
|
||||||
|
const clientId = route.paramMap.get('clientId') || route.parent.parent.paramMap.get('clientId');
|
||||||
|
switch (actionName) {
|
||||||
|
case 'Assign Staff':
|
||||||
|
return this.clientsService.getClientDataAndTemplate(clientId);
|
||||||
|
default:
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user