From 8f020f3d53be09d088b0bb993065de098e2348cb Mon Sep 17 00:00:00 2001 From: JaySoni1 Date: Sat, 16 Aug 2025 14:37:40 +0530 Subject: [PATCH] WEB-256 replace custom api of groups.service.ts --- .../manage-groups/manage-groups.component.ts | 9 +++++-- .../create-center/create-center.component.ts | 4 +-- .../common-resolvers/glim-account-resolver.ts | 6 ++--- .../group-account.resolver.ts | 6 ++--- .../group-actions.resolver.ts | 26 ++++++++++++------ .../group-data-and-template.resolver.ts | 6 ++--- .../group-datatable.resolver.ts | 10 ++++--- .../group-datatables.resolver.ts | 8 +++--- .../common-resolvers/group-notes.resolver.ts | 6 ++--- .../group-summary.resolver.ts | 13 ++++++--- .../common-resolvers/group-view.resolver.ts | 6 ++--- .../common-resolvers/gsim-account-resolver.ts | 7 ++--- .../create-group/create-group.component.ts | 6 ++--- .../groups/edit-group/edit-group.component.ts | 4 +-- .../add-role/add-role.component.ts | 8 ++++-- .../committee-tab/committee-tab.component.ts | 4 +-- .../activate-group.component.ts | 14 +++++++--- .../attach-group-meeting.component.ts | 4 +-- .../close-group/close-group.component.ts | 17 ++++++++---- .../edit-group-meeting-schedule.component.ts | 4 +-- .../edit-group-meeting.component.ts | 4 +-- .../group-assign-staff.component.ts | 8 ++++-- .../group-attendance.component.ts | 22 +++++++++------ .../group-transfer-clients.component.ts | 27 ++++++++++++++----- .../manage-group-members.component.ts | 12 +++++---- .../groups-view/groups-view.component.ts | 9 ++++--- .../notes-tab/notes-tab.component.ts | 26 ++++++++++++++---- src/app/groups/groups.component.ts | 2 +- src/app/groups/groups.datasource.ts | 11 ++++++-- .../entity-notes-tab.component.ts | 2 +- 30 files changed, 191 insertions(+), 100 deletions(-) diff --git a/src/app/centers/centers-view/center-actions/manage-groups/manage-groups.component.ts b/src/app/centers/centers-view/center-actions/manage-groups/manage-groups.component.ts index e4a8b3de9a..17701b4b1e 100644 --- a/src/app/centers/centers-view/center-actions/manage-groups/manage-groups.component.ts +++ b/src/app/centers/centers-view/center-actions/manage-groups/manage-groups.component.ts @@ -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'; @@ -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; }); diff --git a/src/app/centers/create-center/create-center.component.ts b/src/app/centers/create-center/create-center.component.ts index 7b672455b3..69056a0998 100644 --- a/src/app/centers/create-center/create-center.component.ts +++ b/src/app/centers/create-center/create-center.component.ts @@ -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'; @@ -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(); diff --git a/src/app/groups/common-resolvers/glim-account-resolver.ts b/src/app/groups/common-resolvers/glim-account-resolver.ts index bc9989994d..69e20791a2 100644 --- a/src/app/groups/common-resolvers/glim-account-resolver.ts +++ b/src/app/groups/common-resolvers/glim-account-resolver.ts @@ -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. @@ -24,7 +24,7 @@ export class GLIMAccountsResolver { * @returns {Observable} */ resolve(route: ActivatedRouteSnapshot): Observable { - 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 }); } } diff --git a/src/app/groups/common-resolvers/group-account.resolver.ts b/src/app/groups/common-resolvers/group-account.resolver.ts index 5e3a1a3afa..54a9b8c221 100644 --- a/src/app/groups/common-resolvers/group-account.resolver.ts +++ b/src/app/groups/common-resolvers/group-account.resolver.ts @@ -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. @@ -24,7 +24,7 @@ export class GroupAccountsResolver { * @returns {Observable} */ resolve(route: ActivatedRouteSnapshot): Observable { - 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 }); } } diff --git a/src/app/groups/common-resolvers/group-actions.resolver.ts b/src/app/groups/common-resolvers/group-actions.resolver.ts index 1619e56e85..d031fc53d6 100644 --- a/src/app/groups/common-resolvers/group-actions.resolver.ts +++ b/src/app/groups/common-resolvers/group-actions.resolver.ts @@ -6,7 +6,7 @@ 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. @@ -14,9 +14,15 @@ import { GroupsService } from '../groups.service'; @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. @@ -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; } diff --git a/src/app/groups/common-resolvers/group-data-and-template.resolver.ts b/src/app/groups/common-resolvers/group-data-and-template.resolver.ts index 785c254dd3..19e9e91641 100644 --- a/src/app/groups/common-resolvers/group-data-and-template.resolver.ts +++ b/src/app/groups/common-resolvers/group-data-and-template.resolver.ts @@ -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. @@ -24,7 +24,7 @@ export class GroupDataAndTemplateResolver { * @returns {Observable} */ resolve(route: ActivatedRouteSnapshot): Observable { - 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 }); } } diff --git a/src/app/groups/common-resolvers/group-datatable.resolver.ts b/src/app/groups/common-resolvers/group-datatable.resolver.ts index 882d36b144..d997a7ef59 100644 --- a/src/app/groups/common-resolvers/group-datatable.resolver.ts +++ b/src/app/groups/common-resolvers/group-datatable.resolver.ts @@ -6,7 +6,7 @@ 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. @@ -14,9 +14,9 @@ import { GroupsService } from '../groups.service'; @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. @@ -25,6 +25,8 @@ export class GroupDatatableResolver { resolve(route: ActivatedRouteSnapshot): Observable { 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' + }); } } diff --git a/src/app/groups/common-resolvers/group-datatables.resolver.ts b/src/app/groups/common-resolvers/group-datatables.resolver.ts index 53e372fd23..d5596f6a4d 100644 --- a/src/app/groups/common-resolvers/group-datatables.resolver.ts +++ b/src/app/groups/common-resolvers/group-datatables.resolver.ts @@ -6,7 +6,7 @@ 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. @@ -14,15 +14,15 @@ import { GroupsService } from '../groups.service'; @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} */ resolve(): Observable { - return this.groupsService.getGroupDatatables(); + return this.dataTablesService.getDatatables(); } } diff --git a/src/app/groups/common-resolvers/group-notes.resolver.ts b/src/app/groups/common-resolvers/group-notes.resolver.ts index 40dbe1c7e0..11be4e35ac 100644 --- a/src/app/groups/common-resolvers/group-notes.resolver.ts +++ b/src/app/groups/common-resolvers/group-notes.resolver.ts @@ -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. @@ -24,7 +24,7 @@ export class GroupNotesResolver { * @returns {Observable} */ resolve(route: ActivatedRouteSnapshot): Observable { - 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 }); } } diff --git a/src/app/groups/common-resolvers/group-summary.resolver.ts b/src/app/groups/common-resolvers/group-summary.resolver.ts index 70243eb13e..403068b1d2 100644 --- a/src/app/groups/common-resolvers/group-summary.resolver.ts +++ b/src/app/groups/common-resolvers/group-summary.resolver.ts @@ -6,7 +6,7 @@ import { ActivatedRouteSnapshot } from '@angular/router'; import { Observable } from 'rxjs'; /** Custom Services */ -import { GroupsService } from '../groups.service'; +import { SelfRunReportService } from '@fineract/client'; /** * Group Summary resolver. @@ -14,9 +14,9 @@ import { GroupsService } from '../groups.service'; @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. @@ -25,6 +25,11 @@ export class GroupSummaryResolver { */ resolve(route: ActivatedRouteSnapshot): Observable { 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 + }); } } diff --git a/src/app/groups/common-resolvers/group-view.resolver.ts b/src/app/groups/common-resolvers/group-view.resolver.ts index 5b8853e748..e9b1a11558 100644 --- a/src/app/groups/common-resolvers/group-view.resolver.ts +++ b/src/app/groups/common-resolvers/group-view.resolver.ts @@ -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. @@ -24,7 +24,7 @@ export class GroupViewResolver { * @returns {Observable} */ resolve(route: ActivatedRouteSnapshot): Observable { - const groupId = route.paramMap.get('groupId'); - return this.groupsService.getGroupData(groupId); + const groupId = Number(route.paramMap.get('groupId')); + return this.groupsService.retrieveOne15({ groupId }); } } diff --git a/src/app/groups/common-resolvers/gsim-account-resolver.ts b/src/app/groups/common-resolvers/gsim-account-resolver.ts index c3f28265b4..be4425ea6f 100644 --- a/src/app/groups/common-resolvers/gsim-account-resolver.ts +++ b/src/app/groups/common-resolvers/gsim-account-resolver.ts @@ -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. @@ -24,7 +24,8 @@ export class GSIMAccountsResolver { * @returns {Observable} */ resolve(route: ActivatedRouteSnapshot): Observable { - 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 }); } } diff --git a/src/app/groups/create-group/create-group.component.ts b/src/app/groups/create-group/create-group.component.ts index 48884942b0..31fb80297b 100644 --- a/src/app/groups/create-group/create-group.component.ts +++ b/src/app/groups/create-group/create-group.component.ts @@ -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'; @@ -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(); @@ -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, diff --git a/src/app/groups/edit-group/edit-group.component.ts b/src/app/groups/edit-group/edit-group.component.ts index c69b2ae2f1..fc03c5a43c 100644 --- a/src/app/groups/edit-group/edit-group.component.ts +++ b/src/app/groups/edit-group/edit-group.component.ts @@ -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'; @@ -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 }); }); } diff --git a/src/app/groups/groups-view/add-role/add-role.component.ts b/src/app/groups/groups-view/add-role/add-role.component.ts index 653c8c60f3..1866307747 100644 --- a/src/app/groups/groups-view/add-role/add-role.component.ts +++ b/src/app/groups/groups-view/add-role/add-role.component.ts @@ -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'; /** @@ -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 }); }); diff --git a/src/app/groups/groups-view/committee-tab/committee-tab.component.ts b/src/app/groups/groups-view/committee-tab/committee-tab.component.ts index 47f68fe5ed..f5ca20d509 100644 --- a/src/app/groups/groups-view/committee-tab/committee-tab.component.ts +++ b/src/app/groups/groups-view/committee-tab/committee-tab.component.ts @@ -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'; @@ -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(() => {}); } }); } diff --git a/src/app/groups/groups-view/group-actions/activate-group/activate-group.component.ts b/src/app/groups/groups-view/group-actions/activate-group/activate-group.component.ts index 1b2859d81c..897b15f5c3 100644 --- a/src/app/groups/groups-view/group-actions/activate-group/activate-group.component.ts +++ b/src/app/groups/groups-view/group-actions/activate-group/activate-group.component.ts @@ -5,7 +5,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { Dates } from 'app/core/utils/dates'; /** Custom Services */ -import { GroupsService } from 'app/groups/groups.service'; +import { GroupsService } from '@fineract/client'; import { SettingsService } from 'app/settings/settings.service'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; @@ -83,8 +83,14 @@ export class ActivateGroupComponent implements OnInit { dateFormat, locale }; - this.groupsService.executeGroupCommand(this.groupId, 'activate', data).subscribe(() => { - this.router.navigate(['../../'], { relativeTo: this.route }); - }); + this.groupsService + .activateOrGenerateCollectionSheet({ + groupId: this.groupId, + command: 'activate', + ...data + }) + .subscribe(() => { + this.router.navigate(['../../'], { relativeTo: this.route }); + }); } } diff --git a/src/app/groups/groups-view/group-actions/attach-group-meeting/attach-group-meeting.component.ts b/src/app/groups/groups-view/group-actions/attach-group-meeting/attach-group-meeting.component.ts index 448d965490..4200b15920 100644 --- a/src/app/groups/groups-view/group-actions/attach-group-meeting/attach-group-meeting.component.ts +++ b/src/app/groups/groups-view/group-actions/attach-group-meeting/attach-group-meeting.component.ts @@ -11,7 +11,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { Dates } from 'app/core/utils/dates'; /** Custom Services */ -import { GroupsService } from 'app/groups/groups.service'; +import { GroupsService } from '@fineract/client'; import { SettingsService } from 'app/settings/settings.service'; import { MatCheckbox } from '@angular/material/checkbox'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; @@ -173,7 +173,7 @@ export class AttachGroupMeetingComponent implements OnInit { dateFormat, locale }; - this.groupsService.createGroupMeeting(this.groupId, data).subscribe((response: any) => { + this.groupsService.activateOrGenerateCollectionSheet(this.groupId, data).subscribe((response: any) => { this.router.navigate(['../../'], { relativeTo: this.route }); }); } diff --git a/src/app/groups/groups-view/group-actions/close-group/close-group.component.ts b/src/app/groups/groups-view/group-actions/close-group/close-group.component.ts index 2fe95c725b..e4e8e4da68 100644 --- a/src/app/groups/groups-view/group-actions/close-group/close-group.component.ts +++ b/src/app/groups/groups-view/group-actions/close-group/close-group.component.ts @@ -5,7 +5,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { Dates } from 'app/core/utils/dates'; /** Custom Services */ -import { GroupsService } from 'app/groups/groups.service'; +import { GroupsService } from '@fineract/client'; import { SettingsService } from 'app/settings/settings.service'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; @@ -89,10 +89,17 @@ export class CloseGroupComponent implements OnInit { const data = { ...closeGroupFormData, dateFormat, - locale + locale, + command: 'close' }; - this.groupsService.executeGroupCommand(this.groupId, 'close', data).subscribe(() => { - this.router.navigate(['../../'], { relativeTo: this.route }); - }); + this.groupsService + .activateOrGenerateCollectionSheet({ + groupId: this.groupId, + postGroupsGroupIdRequest: data, + command: 'close' + }) + .subscribe(() => { + this.router.navigate(['../../'], { relativeTo: this.route }); + }); } } diff --git a/src/app/groups/groups-view/group-actions/edit-group-meeting-schedule/edit-group-meeting-schedule.component.ts b/src/app/groups/groups-view/group-actions/edit-group-meeting-schedule/edit-group-meeting-schedule.component.ts index 9cd5d19a7d..cdc29f7e8b 100644 --- a/src/app/groups/groups-view/group-actions/edit-group-meeting-schedule/edit-group-meeting-schedule.component.ts +++ b/src/app/groups/groups-view/group-actions/edit-group-meeting-schedule/edit-group-meeting-schedule.component.ts @@ -5,7 +5,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { Dates } from 'app/core/utils/dates'; /** Custom Services */ -import { GroupsService } from 'app/groups/groups.service'; +import { GroupsService } from '@fineract/client'; import { SettingsService } from 'app/settings/settings.service'; import { DateFormatPipe } from '../../../../pipes/date-format.pipe'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; @@ -106,7 +106,7 @@ export class EditGroupMeetingScheduleComponent implements OnInit { dateFormat, locale }; - this.groupsService.updateGroupMeeting(this.groupId, data, this.calendarId).subscribe((response: any) => { + this.groupsService.update13(this.groupId, data, this.calendarId).subscribe((response: any) => { this.router.navigate(['../../'], { relativeTo: this.route }); }); } diff --git a/src/app/groups/groups-view/group-actions/edit-group-meeting/edit-group-meeting.component.ts b/src/app/groups/groups-view/group-actions/edit-group-meeting/edit-group-meeting.component.ts index 0a19d79f72..27061b8f7c 100644 --- a/src/app/groups/groups-view/group-actions/edit-group-meeting/edit-group-meeting.component.ts +++ b/src/app/groups/groups-view/group-actions/edit-group-meeting/edit-group-meeting.component.ts @@ -11,7 +11,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { Dates } from 'app/core/utils/dates'; /** Custom Services */ -import { GroupsService } from 'app/groups/groups.service'; +import { GroupsService } from '@fineract/client'; import { SettingsService } from 'app/settings/settings.service'; import { FaIconComponent } from '@fortawesome/angular-fontawesome'; import { MatFormField, MatLabel, MatError, MatSuffix, MatHint } from '@angular/material/form-field'; @@ -187,7 +187,7 @@ export class EditGroupMeetingComponent implements OnInit { dateFormat, locale }; - this.groupsService.updateGroupMeeting(this.groupId, data, this.calendarId).subscribe((response: any) => { + this.groupsService.update13(this.groupId, data, this.calendarId).subscribe((response: any) => { this.router.navigate(['../../'], { relativeTo: this.route }); }); } diff --git a/src/app/groups/groups-view/group-actions/group-assign-staff/group-assign-staff.component.ts b/src/app/groups/groups-view/group-actions/group-assign-staff/group-assign-staff.component.ts index 03049329c6..330b7dc5c0 100644 --- a/src/app/groups/groups-view/group-actions/group-assign-staff/group-assign-staff.component.ts +++ b/src/app/groups/groups-view/group-actions/group-assign-staff/group-assign-staff.component.ts @@ -4,7 +4,7 @@ import { UntypedFormGroup, UntypedFormBuilder, ReactiveFormsModule } from '@angu import { ActivatedRoute, Router, RouterLink } from '@angular/router'; /** Custom Services */ -import { GroupsService } from 'app/groups/groups.service'; +import { GroupsService } from '@fineract/client'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; /** @@ -63,7 +63,11 @@ export class GroupAssignStaffComponent implements OnInit { */ submit() { this.groupsService - .executeGroupCommand(this.groupData.id, 'assignStaff', this.groupAssignStaffForm.value) + .activateOrGenerateCollectionSheet({ + groupId: this.groupData.id, + command: 'assignStaff', + ...this.groupAssignStaffForm.value + }) .subscribe(() => { this.router.navigate(['../../'], { relativeTo: this.route }); }); diff --git a/src/app/groups/groups-view/group-actions/group-attendance/group-attendance.component.ts b/src/app/groups/groups-view/group-actions/group-attendance/group-attendance.component.ts index d64f0ec03a..d096dfcf34 100644 --- a/src/app/groups/groups-view/group-actions/group-attendance/group-attendance.component.ts +++ b/src/app/groups/groups-view/group-actions/group-attendance/group-attendance.component.ts @@ -5,7 +5,7 @@ import { ActivatedRoute, Router, RouterLink } from '@angular/router'; import { UntypedFormControl, ReactiveFormsModule } from '@angular/forms'; /** Custom Services */ -import { GroupsService } from 'app/groups/groups.service'; +import { GroupsService, MeetingsService } from '@fineract/client'; import { SettingsService } from 'app/settings/settings.service'; /** Custom Dialogs */ @@ -97,7 +97,8 @@ export class GroupAttendanceComponent implements OnInit { private router: Router, private groupsService: GroupsService, public dialog: MatDialog, - private settingsService: SettingsService + private settingsService: SettingsService, + private meetingService: MeetingsService ) { this.route.data.subscribe((data: { groupActionData: any }) => { this.groupData = data.groupActionData; @@ -121,7 +122,7 @@ export class GroupAttendanceComponent implements OnInit { */ getAttendanceOptions() { this.groupsService - .getMeetingsTemplate(this.groupData.id, this.groupData.collectionMeetingCalendar.id) + .retrieveOne15(this.groupData.id, this.groupData.collectionMeetingCalendar.id) .subscribe((response: any) => { this.attendanceTypeOptions = response.attendanceTypeOptions; }); @@ -172,10 +173,15 @@ export class GroupAttendanceComponent implements OnInit { dateFormat, locale }; - this.groupsService - .assignGroupAttendance(this.groupData.id, this.groupData.collectionMeetingCalendar.id, data) - .subscribe(() => { - this.router.navigate(['../../'], { relativeTo: this.route }); - }); + const requestParams = { + groupId: this.groupData.id, + calendarId: this.groupData.collectionMeetingCalendar.id, + entityType: 'groups', + entityId: this.groupData.id, + ...data + }; + this.meetingService.retrieveMeetings(requestParams).subscribe(() => { + this.router.navigate(['../../'], { relativeTo: this.route }); + }); } } diff --git a/src/app/groups/groups-view/group-actions/group-transfer-clients/group-transfer-clients.component.ts b/src/app/groups/groups-view/group-actions/group-transfer-clients/group-transfer-clients.component.ts index 83fb81f332..47d9dd5617 100644 --- a/src/app/groups/groups-view/group-actions/group-transfer-clients/group-transfer-clients.component.ts +++ b/src/app/groups/groups-view/group-actions/group-transfer-clients/group-transfer-clients.component.ts @@ -4,7 +4,7 @@ import { UntypedFormGroup, UntypedFormBuilder, FormControl, Validators, Reactive import { Router, ActivatedRoute, RouterLink } from '@angular/router'; /** Custom Services */ -import { GroupsService } from 'app/groups/groups.service'; +import { GroupsService } from '@fineract/client'; import { SettingsService } from 'app/settings/settings.service'; import { MatOption, MatAutocompleteTrigger, MatAutocomplete } from '@angular/material/autocomplete'; import { MatCheckbox } from '@angular/material/checkbox'; @@ -69,9 +69,16 @@ export class GroupTransferClientsComponent implements OnInit, AfterViewInit { ngAfterViewInit() { this.transferClientsForm.get('destinationGroupId').valueChanges.subscribe((value: string) => { if (value.length >= 2) { - this.groupsService.getFilteredGroups('name', 'ASC', value, this.groupData.officeId).subscribe((data: any) => { - this.groupsData = data; - }); + this.groupsService + .retrieveAll24({ + orderBy: 'name', + sortOrder: 'ASC', + name: value, + officeId: this.groupData.officeId + }) + .subscribe((data: any) => { + this.groupsData = data; + }); } }); } @@ -113,8 +120,14 @@ export class GroupTransferClientsComponent implements OnInit, AfterViewInit { destinationGroupId: this.transferClientsForm.get('destinationGroupId').value.id, locale }; - this.groupsService.executeGroupCommand(this.groupData.id, 'transferClients', data).subscribe(() => { - this.router.navigate(['../../'], { relativeTo: this.route }); - }); + this.groupsService + .activateOrGenerateCollectionSheet({ + groupId: this.groupData.id, + command: 'transferClients', + ...data + }) + .subscribe(() => { + this.router.navigate(['../../'], { relativeTo: this.route }); + }); } } diff --git a/src/app/groups/groups-view/group-actions/manage-group-members/manage-group-members.component.ts b/src/app/groups/groups-view/group-actions/manage-group-members/manage-group-members.component.ts index d4c4c3f9fb..dad760398d 100644 --- a/src/app/groups/groups-view/group-actions/manage-group-members/manage-group-members.component.ts +++ b/src/app/groups/groups-view/group-actions/manage-group-members/manage-group-members.component.ts @@ -7,8 +7,8 @@ import { Router, ActivatedRoute } from '@angular/router'; import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component'; /** Custom Services */ -import { GroupsService } from 'app/groups/groups.service'; -import { ClientService } from '@fineract/client'; +import { GroupsService, ClientService } from '@fineract/client'; +import { GroupsService as CustomGroupsService } from 'app/groups/groups.service'; import { MatDialog } from '@angular/material/dialog'; import { MatAutocompleteTrigger, MatAutocomplete, MatOption } from '@angular/material/autocomplete'; import { MatIconButton } from '@angular/material/button'; @@ -17,6 +17,7 @@ import { MatListSubheaderCssMatStyler, MatNavList } from '@angular/material/list import { MatLine } from '@angular/material/grid-list'; import { MatTooltip } from '@angular/material/tooltip'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; +import { privateDecrypt } from 'crypto'; /** * Manage Group Members Component @@ -58,7 +59,8 @@ export class ManageGroupMembersComponent implements AfterViewInit { private route: ActivatedRoute, private groupsService: GroupsService, private clientsService: ClientService, - public dialog: MatDialog + public dialog: MatDialog, + private customGroupsService: CustomGroupsService ) { this.route.data.subscribe((data: { groupActionData: any }) => { this.groupData = data.groupActionData; @@ -92,7 +94,7 @@ export class ManageGroupMembersComponent implements AfterViewInit { */ addClient() { if (!this.clientMembers.includes(this.clientChoice.value)) { - this.groupsService + this.customGroupsService .executeGroupCommand(this.groupData.id, 'associateClients', { clientMembers: [this.clientChoice.value.id] }) .subscribe(() => { this.clientMembers.push(this.clientChoice.value); @@ -111,7 +113,7 @@ export class ManageGroupMembersComponent implements AfterViewInit { }); removeMemberDialogRef.afterClosed().subscribe((response: any) => { if (response.delete) { - this.groupsService + this.customGroupsService .executeGroupCommand(this.groupData.id, 'disassociateClients', { clientMembers: [client.id] }) .subscribe(() => { this.clientMembers.splice(index, 1); diff --git a/src/app/groups/groups-view/groups-view.component.ts b/src/app/groups/groups-view/groups-view.component.ts index 3b46f2904c..6f2cd41f32 100644 --- a/src/app/groups/groups-view/groups-view.component.ts +++ b/src/app/groups/groups-view/groups-view.component.ts @@ -8,7 +8,7 @@ import { UnassignStaffDialogComponent } from './custom-dialogs/unassign-staff-di import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component'; /** Custom Services */ -import { GroupsService } from '../groups.service'; +import { GroupsService } from '@fineract/client'; import { MatCard, MatCardHeader, @@ -147,7 +147,10 @@ export class GroupsViewComponent { unAssignStaffDialogRef.afterClosed().subscribe((response: { confirm: any }) => { if (response.confirm) { this.groupsService - .executeGroupCommand(this.groupViewData.id, 'unassignStaff', { staffId: this.groupViewData.staffId }) + .update13({ + groupId: this.groupViewData.id, + putGroupsGroupIdRequest: {} // No extra properties, as 'command' is not allowed + }) .subscribe(() => { this.reload(); }); @@ -164,7 +167,7 @@ export class GroupsViewComponent { }); deleteGroupDialogRef.afterClosed().subscribe((response: any) => { if (response.delete) { - this.groupsService.deleteGroup(this.groupViewData.id).subscribe(() => { + this.groupsService.delete11(this.groupViewData.id).subscribe(() => { this.router.navigate(['/groups'], { relativeTo: this.route }); }); } diff --git a/src/app/groups/groups-view/notes-tab/notes-tab.component.ts b/src/app/groups/groups-view/notes-tab/notes-tab.component.ts index 69accdb06b..99245f601d 100644 --- a/src/app/groups/groups-view/notes-tab/notes-tab.component.ts +++ b/src/app/groups/groups-view/notes-tab/notes-tab.component.ts @@ -4,7 +4,7 @@ import { ActivatedRoute } from '@angular/router'; /** Custom Services */ import { AuthenticationService } from '../../../core/authentication/authentication.service'; -import { GroupsService } from '../../groups.service'; +import { NotesService } from '@fineract/client'; import { EntityNotesTabComponent } from '../../../shared/tabs/entity-notes-tab/entity-notes-tab.component'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; @@ -39,7 +39,7 @@ export class NotesTabComponent implements OnInit { constructor( private route: ActivatedRoute, private authenticationService: AuthenticationService, - private groupsService: GroupsService + private notesService: NotesService ) { this.entityId = this.route.parent.snapshot.params['groupId']; this.addNote = this.addNote.bind(this); @@ -57,7 +57,12 @@ export class NotesTabComponent implements OnInit { * Adds a new note. */ addNote(noteContent: any) { - this.groupsService.createGroupNote(this.entityId, noteContent).subscribe((response: any) => { + const params = { + resourceType: 'groups', + resourceId: parseInt(this.entityId, 10), + noteRequest: noteContent + }; + this.notesService.addNewNote(params).subscribe((response: any) => { this.entityNotes.push({ id: response.resourceId, createdByUsername: this.username, @@ -73,7 +78,13 @@ export class NotesTabComponent implements OnInit { * @param {any} noteContent Note's content. */ editNote(noteId: string, noteContent: any, index: number) { - this.groupsService.editGroupNote(this.entityId, noteId, noteContent).subscribe(() => { + const params = { + resourceType: 'groups', + resourceId: parseInt(this.entityId, 10), + noteId: parseInt(noteId, 10), + noteRequest: noteContent + }; + this.notesService.updateNote(params).subscribe(() => { this.entityNotes[index].note = noteContent.note; }); } @@ -83,7 +94,12 @@ export class NotesTabComponent implements OnInit { * @param {string} noteId Note Id. */ deleteNote(noteId: string, index: number) { - this.groupsService.deleteGroupNote(this.entityId, noteId).subscribe(() => { + const params = { + resourceType: 'groups', + resourceId: parseInt(this.entityId, 10), + noteId: parseInt(noteId, 10) + }; + this.notesService.deleteNote(params).subscribe(() => { this.entityNotes.splice(index, 1); }); } diff --git a/src/app/groups/groups.component.ts b/src/app/groups/groups.component.ts index e6779b49e1..12acd5d348 100644 --- a/src/app/groups/groups.component.ts +++ b/src/app/groups/groups.component.ts @@ -11,7 +11,7 @@ import { merge } from 'rxjs'; import { tap, startWith, map, distinctUntilChanged, debounceTime } from 'rxjs/operators'; /** Custom Services */ -import { GroupsService } from './groups.service'; +import { GroupsService } from '@fineract/client'; /** Custom Data Source */ import { GroupsDataSource } from './groups.datasource'; diff --git a/src/app/groups/groups.datasource.ts b/src/app/groups/groups.datasource.ts index 8650eee43a..0b62ae3351 100644 --- a/src/app/groups/groups.datasource.ts +++ b/src/app/groups/groups.datasource.ts @@ -5,7 +5,7 @@ import { CollectionViewer, DataSource } from '@angular/cdk/collections'; import { Observable, BehaviorSubject } from 'rxjs'; /** Custom Services */ -import { GroupsService } from './groups.service'; +import { GroupsService } from '@fineract/client'; /** * Groups custom data source to implement server side filtering, pagination and sorting. @@ -41,7 +41,14 @@ export class GroupsDataSource implements DataSource { groupActive: boolean = true ) { this.groupsSubject.next([]); - this.groupsService.getGroups(filterBy, orderBy, sortOrder, pageIndex * limit, limit).subscribe((groups: any) => { + const requestParams: any = { + ...filterBy, + orderBy: orderBy, + sortOrder: sortOrder, + offset: pageIndex * limit, + limit: limit + }; + this.groupsService.retrieveAll24(requestParams).subscribe((groups: any) => { groups.pageItems = groupActive ? groups.pageItems.filter((group: any) => group.active) : groups.pageItems; this.recordsSubject.next(groups.totalFilteredRecords); this.groupsSubject.next(groups.pageItems); diff --git a/src/app/shared/tabs/entity-notes-tab/entity-notes-tab.component.ts b/src/app/shared/tabs/entity-notes-tab/entity-notes-tab.component.ts index 8d7b587ee0..e1fc682712 100644 --- a/src/app/shared/tabs/entity-notes-tab/entity-notes-tab.component.ts +++ b/src/app/shared/tabs/entity-notes-tab/entity-notes-tab.component.ts @@ -2,7 +2,7 @@ import { Component, Input, OnInit, ViewChild } from '@angular/core'; import { UntypedFormBuilder, UntypedFormGroup, Validators, ReactiveFormsModule } from '@angular/forms'; import { MatDialog } from '@angular/material/dialog'; import { ClientService } from '@fineract/client'; -import { GroupsService } from 'app/groups/groups.service'; +import { GroupsService } from '@fineract/client'; import { LoansService } from 'app/loans/loans.service'; import { SavingsService } from 'app/savings/savings.service'; import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';