Skip to content

Commit 4332384

Browse files
authored
Merge pull request #2586 from JaySoni1/WEB-256-replace-custom-api-of-groups-service-ts
WEB-256 replace custom api of groups.service.ts
2 parents 498b80d + 37997c5 commit 4332384

File tree

40 files changed

+388
-467
lines changed

40 files changed

+388
-467
lines changed

src/app/centers/centers-view/center-actions/manage-groups/manage-groups.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.co
88

99
/** Custom Services */
1010
import { CentersService } from 'app/centers/centers.service';
11-
import { GroupsService } from 'app/groups/groups.service';
11+
import { GroupsService } from '@fineract/client';
1212
import { MatDialog } from '@angular/material/dialog';
1313
import { MatAutocompleteTrigger, MatAutocomplete, MatOption } from '@angular/material/autocomplete';
1414
import { MatIconButton } from '@angular/material/button';
@@ -68,7 +68,12 @@ export class ManageGroupsComponent implements AfterViewInit {
6868
this.groupChoice.valueChanges.subscribe((value: string) => {
6969
if (value.length >= 2) {
7070
this.groupsService
71-
.getFilteredGroups('name', 'ASC', value, this.centerData.officeId, 'true')
71+
.retrieveAll24({
72+
orderBy: 'name',
73+
sortOrder: 'ASC',
74+
name: value,
75+
officeId: this.centerData.officeId
76+
})
7277
.subscribe((data: any) => {
7378
this.groupsData = data;
7479
});

src/app/centers/centers-view/centers-view.component.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
<mat-card-title-group class="header-title-group">
44
<div>
55
<div>
6-
<img mat-card-md-image class="profile-image" src="assets/images/center_placeholder.png" />
6+
<img
7+
mat-card-md-image
8+
class="profile-image"
9+
src="assets/images/center_placeholder.png"
10+
alt="Center placeholder image"
11+
/>
712
</div>
813
</div>
914

@@ -75,7 +80,7 @@ <h3 class="flex-95">
7580
<span *ngIf="!(centerViewData.status.value === 'Active')">
7681
<button mat-menu-item *mifosxHasPermission="'ACTIVATE_CENTER'" (click)="doAction('Activate')">
7782
<mat-icon matListIcon>
78-
<fa-icon icon="checkSign" size="sm"></fa-icon>
83+
<fa-icon icon="check" size="sm"></fa-icon>
7984
</mat-icon>
8085
<span>{{ 'labels.buttons.Activate' | translate }}</span>
8186
</button>

src/app/centers/create-center/create-center.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { Router, ActivatedRoute, RouterLink } from '@angular/router';
1111

1212
/** Custom Services */
13-
import { GroupsService } from 'app/groups/groups.service';
13+
import { GroupsService } from '@fineract/client';
1414
import { CentersService } from '../centers.service';
1515
import { SettingsService } from 'app/settings/settings.service';
1616
import { Dates } from 'app/core/utils/dates';
@@ -120,7 +120,7 @@ export class CreateCenterComponent implements OnInit {
120120
*/
121121
buildDependencies() {
122122
this.centerForm.get('officeId').valueChanges.subscribe((option: any) => {
123-
this.groupService.getGroupsByOfficeId(option).subscribe((data: any) => {
123+
this.groupService.retrieveAll24(option).subscribe((data: any) => {
124124
this.groupsData = data;
125125
if (!this.groupsData.length) {
126126
this.groupChoice.disable();

src/app/clients/clients-view/custom-dialogs/unassign-staff-dialog/unassign-staff-dialog.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
1515
* Unassign staff dialog component.
1616
*/
1717
@Component({
18-
selector: 'mifosx-unassign-staff-dialog',
18+
selector: 'mifosx-unassign-staff-dialog-client',
1919
templateUrl: './unassign-staff-dialog.component.html',
2020
styleUrls: ['./unassign-staff-dialog.component.scss'],
2121
imports: [

src/app/customApis.service.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,28 @@ export class RunReportsService {
121121
const httpParams = new HttpParams().set('R_groupId', centerId.toString()).set('genericResultSet', false.toString());
122122
return this.http.get('/runreports/GroupSummaryCounts', { params: httpParams });
123123
}
124+
125+
getGroupSummary(groupId: string): Observable<any> {
126+
const httpParams = new HttpParams().set('R_groupId', groupId).set('genericResultSet', 'false');
127+
return this.http.get(`/runreports/GroupSummaryCounts`, { params: httpParams });
128+
}
129+
}
130+
@Injectable({
131+
providedIn: 'root'
132+
})
133+
export class GroupsService {
134+
constructor(private http: HttpClient) {}
135+
136+
/**
137+
* @param {string} groupId Group Id
138+
* @param {string} command Command
139+
* @param {any} data Command payload
140+
* @returns {Observable<any>}
141+
*/
142+
executeGroupCommand(groupId: string, command: string, data: any): Observable<any> {
143+
const httpParams = new HttpParams().set('command', command);
144+
return this.http.post(`/groups/${groupId}`, data, { params: httpParams });
145+
}
124146
}
125147

126148
/**

src/app/groups/common-resolvers/glim-account-resolver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ActivatedRouteSnapshot } from '@angular/router';
66
import { Observable } from 'rxjs';
77

88
/** Custom Services */
9-
import { GroupsService } from '../groups.service';
9+
import { GroupsService } from '@fineract/client';
1010

1111
/**
1212
* GLIM Loans Accounts data resolver.
@@ -24,7 +24,7 @@ export class GLIMAccountsResolver {
2424
* @returns {Observable<any>}
2525
*/
2626
resolve(route: ActivatedRouteSnapshot): Observable<any> {
27-
const groupId = route.parent.paramMap.get('groupId');
28-
return this.groupsService.getGLIMAccountsData(groupId);
27+
const groupId = Number(route.parent.paramMap.get('groupId'));
28+
return this.groupsService.retrieveglimAccounts({ groupId: groupId });
2929
}
3030
}

src/app/groups/common-resolvers/group-account.resolver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ActivatedRouteSnapshot } from '@angular/router';
66
import { Observable } from 'rxjs';
77

88
/** Custom Services */
9-
import { GroupsService } from '../groups.service';
9+
import { GroupsService } from '@fineract/client';
1010

1111
/**
1212
* Group Accounts data resolver.
@@ -24,7 +24,7 @@ export class GroupAccountsResolver {
2424
* @returns {Observable<any>}
2525
*/
2626
resolve(route: ActivatedRouteSnapshot): Observable<any> {
27-
const groupId = route.parent.paramMap.get('groupId');
28-
return this.groupsService.getGroupAccountsData(groupId);
27+
const groupId = Number(route.parent.paramMap.get('groupId'));
28+
return this.groupsService.retrieveAccounts({ groupId });
2929
}
3030
}

src/app/groups/common-resolvers/group-actions.resolver.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,19 @@ import { ActivatedRouteSnapshot } from '@angular/router';
66
import { Observable } from 'rxjs';
77

88
/** Custom Services */
9-
import { GroupsService } from '../groups.service';
9+
import { GroupsService } from '@fineract/client';
1010

1111
/**
1212
* Group Actions data resolver.
1313
*/
1414
@Injectable()
1515
export class GroupActionsResolver {
1616
/**
17-
* @param {GroupsService} groupsService Groups service.
17+
* @param {GroupsService} groupsService,
1818
*/
19-
constructor(private groupsService: GroupsService) {}
19+
constructor(
20+
private groupsService: GroupsService,
21+
) {}
2022

2123
/**
2224
* Returns the group actions data.
@@ -25,22 +27,23 @@ export class GroupActionsResolver {
2527
*/
2628
resolve(route: ActivatedRouteSnapshot): Observable<any> {
2729
const actionName = route.paramMap.get('action');
28-
const groupId = route.paramMap.get('groupId') || route.parent.parent.paramMap.get('groupId');
30+
const groupIdStr = route.paramMap.get('groupId') || route.parent.parent.paramMap.get('groupId');
31+
const groupId = groupIdStr ? Number(groupIdStr) : undefined;
2932
switch (actionName) {
3033
case 'Attendance':
3134
case 'Manage Members':
3235
case 'Transfer Clients':
33-
return this.groupsService.getGroupData(groupId);
36+
return this.groupsService.retrieveOne15({ groupId });
3437
case 'Assign Staff':
35-
return this.groupsService.getGroupData(groupId, 'true');
38+
return this.groupsService.retrieveOne15({ groupId, staffInSelectedOfficeOnly: true });
3639
case 'Close':
37-
return this.groupsService.getGroupCommandTemplate('close');
40+
return this.groupsService.retrieveTemplate7({ command: 'close' });
3841
case 'Attach Meeting':
39-
return this.groupsService.getGroupCalendarTemplate(groupId);
42+
return this.groupsService.retrieveOne15({ groupId });
4043
case 'Edit Meeting':
4144
case 'Edit Meeting Schedule':
4245
const calendarId = route.queryParamMap.get('calendarId');
43-
return this.groupsService.getGroupCalendarAndTemplate(groupId, calendarId);
46+
return this.groupsService.retrieveOne15({ groupId });
4447
default:
4548
return undefined;
4649
}

src/app/groups/common-resolvers/group-data-and-template.resolver.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ActivatedRouteSnapshot } from '@angular/router';
66
import { Observable } from 'rxjs';
77

88
/** Custom Services */
9-
import { GroupsService } from '../groups.service';
9+
import { GroupsService } from '@fineract/client';
1010

1111
/**
1212
* Groups data and template resolver.
@@ -24,7 +24,7 @@ export class GroupDataAndTemplateResolver {
2424
* @returns {Observable<any>}
2525
*/
2626
resolve(route: ActivatedRouteSnapshot): Observable<any> {
27-
const groupId = route.paramMap.get('groupId');
28-
return this.groupsService.getGroupData(groupId, 'true');
27+
const groupId = Number(route.paramMap.get('groupId'));
28+
return this.groupsService.retrieveOne15({ groupId: groupId });
2929
}
3030
}

src/app/groups/common-resolvers/group-datatable.resolver.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ import { ActivatedRouteSnapshot } from '@angular/router';
66
import { Observable } from 'rxjs';
77

88
/** Custom Services */
9-
import { GroupsService } from '../groups.service';
9+
import { DataTablesService } from '@fineract/client';
1010

1111
/**
1212
* Group Datatable data resolver.
1313
*/
1414
@Injectable()
1515
export class GroupDatatableResolver {
1616
/**
17-
* @param {GroupsService} GroupsService Groups service.
17+
* @param {DataTablesService} DataTablesService Groups service.
1818
*/
19-
constructor(private groupsService: GroupsService) {}
19+
constructor(private dataTablesService: DataTablesService) {}
2020

2121
/**
2222
* Returns the Group's Datatable data.
@@ -25,6 +25,8 @@ export class GroupDatatableResolver {
2525
resolve(route: ActivatedRouteSnapshot): Observable<any> {
2626
const groupId = route.parent.parent.paramMap.get('groupId');
2727
const datatableName = route.paramMap.get('datatableName');
28-
return this.groupsService.getGroupDatatable(groupId, datatableName);
28+
return this.dataTablesService.getDatatables({
29+
apptable: 'm_group'
30+
});
2931
}
3032
}

0 commit comments

Comments
 (0)