@@ -1,32 +0,0 @@
|
||||
/** Angular Imports */
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
/** Custom Services */
|
||||
import { GroupsService } from '../groups.service';
|
||||
|
||||
/**
|
||||
* Groups Client Members data resolver.
|
||||
*/
|
||||
@Injectable()
|
||||
export class GroupClientMembersResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {GroupsService} GroupsService Groups service.
|
||||
*/
|
||||
constructor(private groupsService: GroupsService) { }
|
||||
|
||||
/**
|
||||
* Returns the Group's Client Members data.
|
||||
* @param {ActivatedRouteSnapshot} route Route Snapshot.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const groupId = route.parent.paramMap.get('groupId');
|
||||
return this.groupsService.getGroupClientMembers(groupId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,12 +13,12 @@ import { GroupsComponent } from './groups.component';
|
||||
import { GroupsViewComponent } from './groups-view/groups-view.component';
|
||||
import { GeneralTabComponent } from './groups-view/general-tab/general-tab.component';
|
||||
import { NotesTabComponent } from './groups-view/notes-tab/notes-tab.component';
|
||||
import { CommitteeTabComponent } from './groups-view/committee-tab/committee-tab.component';
|
||||
|
||||
/** Custom Resolvers */
|
||||
import { GroupViewResolver } from './common-resolvers/group-view.resolver';
|
||||
import { GroupAccountsResolver } from './common-resolvers/group-account.resolver';
|
||||
import { GroupSummaryResolver } from './common-resolvers/group-summary.resolver';
|
||||
import { GroupClientMembersResolver } from './common-resolvers/group-client-members.resolver';
|
||||
import { GroupNotesResolver } from './common-resolvers/group-notes.resolver';
|
||||
|
||||
/** Groups Routes */
|
||||
@@ -47,7 +47,6 @@ const routes: Routes = [
|
||||
data: { title: extract('General'), breadcrumb: 'General', routeParamBreadcrumb: false },
|
||||
resolve: {
|
||||
groupAccountsData: GroupAccountsResolver,
|
||||
groupClientMembers: GroupClientMembersResolver,
|
||||
groupSummary: GroupSummaryResolver
|
||||
}
|
||||
},
|
||||
@@ -58,6 +57,11 @@ const routes: Routes = [
|
||||
resolve: {
|
||||
groupNotes: GroupNotesResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'committee',
|
||||
component: CommitteeTabComponent,
|
||||
data: { title: extract('Committee'), breadcrumb: 'Committee', routeParamBreadcrumb: false }
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -77,7 +81,6 @@ const routes: Routes = [
|
||||
providers: [GroupViewResolver,
|
||||
GroupAccountsResolver,
|
||||
GroupSummaryResolver,
|
||||
GroupClientMembersResolver,
|
||||
GroupNotesResolver]
|
||||
})
|
||||
export class GroupsRoutingModule { }
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<div class="tab-container mat-typography">
|
||||
|
||||
<div fxLayout="row" fxLayoutAlign="start" class="table-header">
|
||||
<div class="m-b-10">
|
||||
<h3>Client Members</h3>
|
||||
</div>
|
||||
<div class="action-button m-b-10" fxLayoutGap="25px" *ngIf="groupStatus !== 'Closed'">
|
||||
<button mat-raised-button class="f-right" color="primary"
|
||||
*mifosxHasPermission="'ASSIGNROLE_GROUP'">
|
||||
<i class="fa fa-plus"></i> Add</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table mat-table [dataSource]="groupRolesData"
|
||||
class="mat-elevation-z1">
|
||||
|
||||
<ng-container matColumnDef="Name">
|
||||
<th mat-header-cell *matHeaderCellDef> Name </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.clientName}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Role">
|
||||
<th mat-header-cell *matHeaderCellDef> Role </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.role.name}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Client Id">
|
||||
<th mat-header-cell *matHeaderCellDef> Client Id </th>
|
||||
<td mat-cell *matCellDef="let element"> {{element.clientId}} </td>
|
||||
</ng-container>
|
||||
|
||||
<ng-container matColumnDef="Actions">
|
||||
<th mat-header-cell *matHeaderCellDef> Actions </th>
|
||||
<td mat-cell *matCellDef="let element">
|
||||
<span *ngIf="groupStatus !== 'Closed'">
|
||||
<button class="account-action-button" mat-raised-button color="primary"
|
||||
*mifosxHasPermission="'UNASSIGNROLE_GROUP'">
|
||||
<i class="fa fa-ban" matTooltip="Unassign"></i>
|
||||
</button>
|
||||
</span>
|
||||
</td>
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="groupRolesColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: groupRolesColumns;"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,22 @@
|
||||
.tab-container {
|
||||
padding: 1%;
|
||||
margin: 1%;
|
||||
h3 {
|
||||
margin:1% auto;
|
||||
}
|
||||
.table-header {
|
||||
.action-button{
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
margin-bottom: 30px;
|
||||
.account-action-button{
|
||||
min-width: 26px;
|
||||
padding: 0 6px;
|
||||
margin: 4px;
|
||||
line-height: 25px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { CommitteeTabComponent } from './committee-tab.component';
|
||||
|
||||
describe('CommitteeTabComponent', () => {
|
||||
let component: CommitteeTabComponent;
|
||||
let fixture: ComponentFixture<CommitteeTabComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CommitteeTabComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CommitteeTabComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,33 @@
|
||||
/** Angular Imports */
|
||||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
/**
|
||||
* Groups Committee Tab Component
|
||||
*/
|
||||
@Component({
|
||||
selector: 'mifosx-committee-tab',
|
||||
templateUrl: './committee-tab.component.html',
|
||||
styleUrls: ['./committee-tab.component.scss']
|
||||
})
|
||||
export class CommitteeTabComponent {
|
||||
|
||||
/** Group Status */
|
||||
groupStatus: any;
|
||||
/** Group Roles Data */
|
||||
groupRolesData: any;
|
||||
/** Columns to be Displayed for client members table */
|
||||
groupRolesColumns: string[] = ['Name', 'Role', 'Client Id', 'Actions'];
|
||||
|
||||
/**
|
||||
* Fetches groups data from parent's `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
this.route.parent.data.subscribe((data: { groupViewData: any }) => {
|
||||
this.groupRolesData = data.groupViewData.groupRoles;
|
||||
this.groupStatus = data.groupViewData.status.value;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,7 +47,9 @@ export class GeneralTabComponent {
|
||||
this.savingAccounts = data.groupAccountsData.savingsAccounts;
|
||||
this.loanAccounts = data.groupAccountsData.loanAccounts;
|
||||
this.groupSummary = data.groupSummary[0];
|
||||
this.groupClientMembers = data.groupClientMembers;
|
||||
});
|
||||
this.route.parent.data.subscribe((data: { groupViewData: any }) => {
|
||||
this.groupClientMembers = data.groupViewData.clientMembers;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -100,10 +100,14 @@
|
||||
[active]="general.isActive">
|
||||
General
|
||||
</a>
|
||||
<a mat-tab-link [routerLink]="['./notes']" routerLinkActive #notes="routerLinkActive"
|
||||
<a mat-tab-link [routerLink]="['./notes']" *mifosxHasPermission="'READ_GROUPNOTE'" routerLinkActive #notes="routerLinkActive"
|
||||
[active]="notes.isActive">
|
||||
Notes
|
||||
</a>
|
||||
<a mat-tab-link [routerLink]="['./committee']" routerLinkActive #committee="routerLinkActive"
|
||||
[active]="committee.isActive">
|
||||
Committee
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<router-outlet></router-outlet>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<textarea formControlName="note" matInput placeholder="Write a note ...."></textarea>
|
||||
</mat-form-field>
|
||||
|
||||
<button mat-raised-button fxFlex color="primary" [disabled]="!noteForm.valid">
|
||||
<button mat-raised-button fxFlex color="primary" *mifosxHasPermission="'CREATE_GROUPNOTE'" [disabled]="!noteForm.valid">
|
||||
<fa-icon icon="plus"></fa-icon> Add
|
||||
</button>
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import { GroupsComponent } from './groups.component';
|
||||
import { GroupsViewComponent } from './groups-view/groups-view.component';
|
||||
import { GeneralTabComponent } from './groups-view/general-tab/general-tab.component';
|
||||
import { NotesTabComponent } from './groups-view/notes-tab/notes-tab.component';
|
||||
import { CommitteeTabComponent } from './groups-view/committee-tab/committee-tab.component';
|
||||
|
||||
/**
|
||||
* Groups Module
|
||||
@@ -30,7 +31,8 @@ import { NotesTabComponent } from './groups-view/notes-tab/notes-tab.component';
|
||||
GroupsComponent,
|
||||
GroupsViewComponent,
|
||||
GeneralTabComponent,
|
||||
NotesTabComponent
|
||||
NotesTabComponent,
|
||||
CommitteeTabComponent
|
||||
],
|
||||
providers: [DatePipe]
|
||||
})
|
||||
|
||||
@@ -71,16 +71,6 @@ export class GroupsService {
|
||||
return this.http.get(`/runreports/GroupSummaryCounts`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param groupId Group Id of group to get data for.
|
||||
* @returns {Observable<any>} Group Client Members data.
|
||||
*/
|
||||
getGroupClientMembers(groupId: string): Observable<any> {
|
||||
const httpParams = new HttpParams().set('associations', 'clientMembers');
|
||||
return this.http.get(`/groups/${groupId}`, { params: httpParams })
|
||||
.pipe(map((group: any) => group.clientMembers));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param groupId Group Id of group to get data for.
|
||||
* @returns {Observable<any>} Group Accounts data.
|
||||
|
||||
@@ -82,7 +82,8 @@ import {
|
||||
faCloudUploadAlt,
|
||||
faTimes,
|
||||
faStickyNote,
|
||||
faStop
|
||||
faStop,
|
||||
faBan
|
||||
} from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
/** Add icons to the library for convenient access in other components. */
|
||||
@@ -164,7 +165,8 @@ library.add(
|
||||
faCloudUploadAlt,
|
||||
faTimes,
|
||||
faStickyNote,
|
||||
faStop
|
||||
faStop,
|
||||
faBan
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user