Skip to content

WEB-256 replace custom api of groups.service.ts #2586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: openapi-integration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.co

/** Custom Services */
import { CentersService } from 'app/centers/centers.service';
import { GroupsService } from 'app/groups/groups.service';
import { GroupsService } from '@fineract/client';
import { MatDialog } from '@angular/material/dialog';
import { MatAutocompleteTrigger, MatAutocomplete, MatOption } from '@angular/material/autocomplete';
import { MatIconButton } from '@angular/material/button';
Expand Down Expand Up @@ -68,7 +68,12 @@ export class ManageGroupsComponent implements AfterViewInit {
this.groupChoice.valueChanges.subscribe((value: string) => {
if (value.length >= 2) {
this.groupsService
.getFilteredGroups('name', 'ASC', value, this.centerData.officeId, 'true')
.retrieveAll24({
orderBy: 'name',
sortOrder: 'ASC',
name: value,
officeId: this.centerData.officeId
})
.subscribe((data: any) => {
this.groupsData = data;
});
Expand Down
4 changes: 2 additions & 2 deletions src/app/centers/create-center/create-center.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { Router, ActivatedRoute, RouterLink } from '@angular/router';

/** Custom Services */
import { GroupsService } from 'app/groups/groups.service';
import { GroupsService } from '@fineract/client';
import { CentersService } from '../centers.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
Expand Down Expand Up @@ -120,7 +120,7 @@ export class CreateCenterComponent implements OnInit {
*/
buildDependencies() {
this.centerForm.get('officeId').valueChanges.subscribe((option: any) => {
this.groupService.getGroupsByOfficeId(option).subscribe((data: any) => {
this.groupService.retrieveAll24(option).subscribe((data: any) => {
this.groupsData = data;
if (!this.groupsData.length) {
this.groupChoice.disable();
Expand Down
6 changes: 3 additions & 3 deletions src/app/groups/common-resolvers/glim-account-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { GroupsService } from '@fineract/client';

/**
* GLIM Loans Accounts data resolver.
Expand All @@ -24,7 +24,7 @@ export class GLIMAccountsResolver {
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const groupId = route.parent.paramMap.get('groupId');
return this.groupsService.getGLIMAccountsData(groupId);
const groupId = Number(route.parent.paramMap.get('groupId'));
return this.groupsService.retrieveglimAccounts({ groupId: groupId });
}
}
6 changes: 3 additions & 3 deletions src/app/groups/common-resolvers/group-account.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { GroupsService } from '@fineract/client';

/**
* Group Accounts data resolver.
Expand All @@ -24,7 +24,7 @@ export class GroupAccountsResolver {
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const groupId = route.parent.paramMap.get('groupId');
return this.groupsService.getGroupAccountsData(groupId);
const groupId = Number(route.parent.paramMap.get('groupId'));
return this.groupsService.retrieveAccounts({ groupId });
}
}
26 changes: 18 additions & 8 deletions src/app/groups/common-resolvers/group-actions.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,23 @@ import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { GroupsService, CalendarService, LoanProductsService } from '@fineract/client';

/**
* Group Actions data resolver.
*/
@Injectable()
export class GroupActionsResolver {
/**
* @param {GroupsService} groupsService Groups service.
* @param {GroupsService} groupsService,
* @param {CalendarService} CalendarService,
* @param {LoanProductsService} LoanProductsService
*/
constructor(private groupsService: GroupsService) {}
constructor(
private groupsService: GroupsService,
private calendarService: CalendarService,
private loanProductsService: LoanProductsService
) {}

/**
* Returns the group actions data.
Expand All @@ -30,17 +36,21 @@ export class GroupActionsResolver {
case 'Attendance':
case 'Manage Members':
case 'Transfer Clients':
return this.groupsService.getGroupData(groupId);
return this.groupsService.delete11({ groupId: Number(groupId) });
case 'Assign Staff':
return this.groupsService.getGroupData(groupId, 'true');
return this.loanProductsService.retrieveTemplate11({});
case 'Close':
return this.groupsService.getGroupCommandTemplate('close');
return this.groupsService.retrieveTemplate7({ command: 'close' });
case 'Attach Meeting':
return this.groupsService.getGroupCalendarTemplate(groupId);
return this.calendarService.retrieveNewCalendarDetails({ entityId: Number(groupId), entityType: '2' });
case 'Edit Meeting':
case 'Edit Meeting Schedule':
const calendarId = route.queryParamMap.get('calendarId');
return this.groupsService.getGroupCalendarAndTemplate(groupId, calendarId);
return this.calendarService.retrieveCalendar({
entityId: Number(groupId),
calendarId: Number(calendarId),
entityType: '2'
});
default:
return undefined;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { GroupsService } from '@fineract/client';

/**
* Groups data and template resolver.
Expand All @@ -24,7 +24,7 @@ export class GroupDataAndTemplateResolver {
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const groupId = route.paramMap.get('groupId');
return this.groupsService.getGroupData(groupId, 'true');
const groupId = Number(route.paramMap.get('groupId'));
return this.groupsService.delete11({ groupId: groupId });
}
}
10 changes: 6 additions & 4 deletions src/app/groups/common-resolvers/group-datatable.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { DataTablesService } from '@fineract/client';

/**
* Group Datatable data resolver.
*/
@Injectable()
export class GroupDatatableResolver {
/**
* @param {GroupsService} GroupsService Groups service.
* @param {DataTablesService} DataTablesService Groups service.
*/
constructor(private groupsService: GroupsService) {}
constructor(private dataTablesService: DataTablesService) {}

/**
* Returns the Group's Datatable data.
Expand All @@ -25,6 +25,8 @@ export class GroupDatatableResolver {
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const groupId = route.parent.parent.paramMap.get('groupId');
const datatableName = route.paramMap.get('datatableName');
return this.groupsService.getGroupDatatable(groupId, datatableName);
return this.dataTablesService.getDatatables({
apptable: 'm_group'
});
}
}
8 changes: 4 additions & 4 deletions src/app/groups/common-resolvers/group-datatables.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { DataTablesService } from '@fineract/client';

/**
* Group Datatables data resolver.
*/
@Injectable()
export class GroupDatatablesResolver {
/**
* @param {GroupsService} GroupsService Groups service.
* @param {DataTablesService} DataTablesService Groups service.
*/
constructor(private groupsService: GroupsService) {}
constructor(private dataTablesService: DataTablesService) {}

/**
* Returns the Group's Datatables data.
* @returns {Observable<any>}
*/
resolve(): Observable<any> {
return this.groupsService.getGroupDatatables();
return this.dataTablesService.getDatatables();
}
}
6 changes: 3 additions & 3 deletions src/app/groups/common-resolvers/group-notes.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { GroupsService } from '@fineract/client';

/**
* Group Notes data resolver.
Expand All @@ -24,7 +24,7 @@ export class GroupNotesResolver {
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const groupId = route.parent.paramMap.get('groupId');
return this.groupsService.getGroupNotes(groupId);
const groupId = Number(route.parent.paramMap.get('groupId'));
return this.groupsService.retrieveOne15({ groupId });
}
}
13 changes: 9 additions & 4 deletions src/app/groups/common-resolvers/group-summary.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { SelfRunReportService } from '@fineract/client';

/**
* Group Summary resolver.
*/
@Injectable()
export class GroupSummaryResolver {
/**
* @param {GroupsService} GroupsService Groups service.
* @param {SelfRunReportService} SelfRunReportService Groups service.
*/
constructor(private groupsService: GroupsService) {}
constructor(private selfRunReportService: SelfRunReportService) {}

/**
* Returns the Group Summary data.
Expand All @@ -25,6 +25,11 @@ export class GroupSummaryResolver {
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const groupId = route.parent.paramMap.get('groupId');
return this.groupsService.getGroupSummary(groupId);
// Use runReport1 with reportName and query params
return this.selfRunReportService.runReport1({
reportName: 'GroupSummaryCounts',
// @ts-ignore: allow extra params for query
R_groupId: groupId
});
}
}
6 changes: 3 additions & 3 deletions src/app/groups/common-resolvers/group-view.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { GroupsService } from '@fineract/client';

/**
* Groups data resolver.
Expand All @@ -24,7 +24,7 @@ export class GroupViewResolver {
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const groupId = route.paramMap.get('groupId');
return this.groupsService.getGroupData(groupId);
const groupId = Number(route.paramMap.get('groupId'));
return this.groupsService.retrieveOne15({ groupId });
}
}
7 changes: 4 additions & 3 deletions src/app/groups/common-resolvers/gsim-account-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { GroupsService } from '@fineract/client';

/**
* GSIM Accounts data resolver.
Expand All @@ -24,7 +24,8 @@ export class GSIMAccountsResolver {
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const groupId = route.parent.paramMap.get('groupId');
return this.groupsService.getGSIMAccountsData(groupId);
const groupIdParam = route.parent.paramMap.get('groupId');
const groupId = groupIdParam ? Number(groupIdParam) : undefined;
return this.groupsService.retrieveGsimAccounts({ groupId: groupId as number });
}
}
6 changes: 3 additions & 3 deletions src/app/groups/create-group/create-group.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { Router, ActivatedRoute, RouterLink } from '@angular/router';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { GroupsService } from '@fineract/client';
import { ClientService } from '@fineract/client';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
Expand Down Expand Up @@ -144,7 +144,7 @@ export class CreateGroupComponent implements OnInit, AfterViewInit {
*/
buildDependencies() {
this.groupForm.get('officeId').valueChanges.subscribe((option: any) => {
this.groupService.getStaff(option).subscribe((data) => {
this.groupService.retrieveTemplate7(option).subscribe((data) => {
this.staffData = data['staffOptions'];
if (this.staffData === undefined) {
this.groupForm.controls['staffId'].disable();
Expand Down Expand Up @@ -211,7 +211,7 @@ export class CreateGroupComponent implements OnInit, AfterViewInit {
};
data.clientMembers = [];
this.clientMembers.forEach((client: any) => data.clientMembers.push(client.id));
this.groupService.createGroup(data).subscribe((response: any) => {
this.groupService.activateOrGenerateCollectionSheet(data).subscribe((response: any) => {
this.router.navigate([
'../groups',
response.resourceId,
Expand Down
4 changes: 2 additions & 2 deletions src/app/groups/edit-group/edit-group.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { Router, ActivatedRoute, RouterLink } from '@angular/router';

/** Custom Services */
import { GroupsService } from '../groups.service';
import { GroupsService } from '@fineract/client';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
Expand Down Expand Up @@ -135,7 +135,7 @@ export class EditGroupComponent implements OnInit {
dateFormat,
locale
};
this.groupService.updateGroup(data, this.groupData.id).subscribe((response: any) => {
this.groupService.update13(data, this.groupData.id).subscribe((response: any) => {
this.router.navigate(['../'], { relativeTo: this.route });
});
}
Expand Down
8 changes: 6 additions & 2 deletions src/app/groups/groups-view/add-role/add-role.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule }
import { ActivatedRoute, Router, RouterLink } from '@angular/router';

/** Custom Services */
import { GroupsService } from '../../groups.service';
import { GroupsService } from '@fineract/client';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';

/**
Expand Down Expand Up @@ -72,7 +72,11 @@ export class AddRoleComponent implements OnInit {
*/
submit() {
this.groupsService
.executeGroupCommand(this.groupAndTemplateData.id, 'assignRole', this.groupsAddRoleForm.value)
.activateOrGenerateCollectionSheet({
groupId: this.groupAndTemplateData.id,
command: 'assignRole',
...this.groupsAddRoleForm.value
})
.subscribe(() => {
this.router.navigate(['../'], { relativeTo: this.route });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { UnassignRoleDialogComponent } from '../custom-dialogs/unassign-role-dialog/unassign-role-dialog.component';

/** Custom Services */
import { GroupsService } from 'app/groups/groups.service';
import { GroupsService } from '@fineract/client';
import { MatTooltip } from '@angular/material/tooltip';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';

Expand Down Expand Up @@ -94,7 +94,7 @@ export class CommitteeTabComponent {
const clientIndex = this.groupRolesData.findIndex((client: any) => client.clientId === clientId);
this.groupRolesData.splice(clientIndex, 1);
this.rolesTableRef.renderRows();
this.groupsService.unAssignRoleCommand(this.groupViewData.id, roleId).subscribe(() => {});
this.groupsService.activateOrGenerateCollectionSheet(this.groupViewData.id, roleId).subscribe(() => {});
}
});
}
Expand Down
Loading