Skip to content

Commit 0201921

Browse files
authored
Merge pull request #2698 from JaySoni1/WEB-314-replace-custom-api-of-tasks-service-ts
WEB-314 replace custom api of tasks-service.ts
2 parents 61f63cd + 4b7f539 commit 0201921

17 files changed

+89
-199
lines changed

src/app/system/manage-jobs/cob-workflow/loan-locked/loan-locked.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { TranslateService } from '@ngx-translate/core';
2020
import { LoansService } from '@fineract/client';
2121
import { ErrorDialogComponent } from 'app/shared/error-dialog/error-dialog.component';
2222
import { SystemService } from 'app/system/system.service';
23-
import { TasksService } from 'app/tasks/tasks.service';
23+
import { LoanAccountLockService } from '@fineract/client';
2424
import { MatButton, MatIconButton } from '@angular/material/button';
2525
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
2626
import { MatCheckbox } from '@angular/material/checkbox';
@@ -94,13 +94,14 @@ export class LoanLockedComponent implements OnInit {
9494
* @param {Router} router Router for navigation.
9595
* @param {MatDialog} dialog Dialog reference.
9696
* @param {TranslateService} translateService Translate Service.
97+
* @param {LoanAccountLockService} tasksService Loan Account Lock Service.
9798
*/
9899
constructor(
99100
private route: ActivatedRoute,
100101
private router: Router,
101102
private loansService: LoansService,
102103
private systemService: SystemService,
103-
private tasksService: TasksService,
104+
private loanAccountLockService: LoanAccountLockService,
104105
private dialog: MatDialog,
105106
private translateService: TranslateService
106107
) {}
@@ -122,7 +123,7 @@ export class LoanLockedComponent implements OnInit {
122123
}
123124

124125
getLoansLocked(page: number) {
125-
this.tasksService.getAllLoansLocked(page, this.itemsToRead).subscribe((data: any) => {
126+
this.loanAccountLockService.retrieveLockedAccounts({ page: page }).subscribe((data: any) => {
126127
this.loans = data.content;
127128
this.dataSource = new MatTableDataSource(this.loans);
128129
this.dataSource.paginator = this.paginator;
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
import { Injectable } from '@angular/core';
22
import { Router, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router';
3-
import { TasksService } from 'app/tasks/tasks.service';
3+
import { LoanAccountLockService } from '@fineract/client';
44
import { Observable, of } from 'rxjs';
55

66
@Injectable({
77
providedIn: 'root'
88
})
99
export class LoanLockedResolver {
1010
/**
11-
* @param {TasksService} tasksService Tasks service.
11+
* @param {LoanAccountLockService} loanAccountLockService Loan Account Lock service.
1212
*/
13-
constructor(private tasksService: TasksService) {}
13+
constructor(private loanAccountLockService: LoanAccountLockService) {}
1414

1515
/**
1616
* Returns all the loans data.
1717
* @returns {Observable<any>}
1818
*/
1919
resolve(): Observable<any> {
20-
return this.tasksService.getAllLoansLocked(0, 200);
20+
return this.loanAccountLockService.retrieveLockedAccounts();
2121
}
2222
}

src/app/tasks/checker-inbox-and-tasks-tabs/checker-inbox/checker-inbox.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
import { MatDialog } from '@angular/material/dialog';
2020

2121
/** Custom Services */
22-
import { TasksService } from '../../tasks.service';
22+
import { MakerCheckerOr4EyeFunctionalityService } from '@fineract/client';
2323
import { SettingsService } from 'app/settings/settings.service';
2424

2525
/** Dialog Components */
@@ -89,7 +89,7 @@ export class CheckerInboxComponent implements OnInit {
8989
* @param {Dates} dateUtils Date Utils.
9090
* @param {router} router Router.
9191
* @param {SettingsService} settingsService Settings Service.
92-
* @param {TasksService} tasksService Tasks Service.
92+
* @param {MakerCheckerOr4EyeFunctionalityService} makerCheckerService Maker Checker Service.
9393
* @param {FormBuilder} formBuilder Form Builder.
9494
*/
9595
constructor(
@@ -98,7 +98,7 @@ export class CheckerInboxComponent implements OnInit {
9898
private dateUtils: Dates,
9999
private router: Router,
100100
private translateService: TranslateService,
101-
private tasksService: TasksService,
101+
private makerCheckerService: MakerCheckerOr4EyeFunctionalityService,
102102
private settingsService: SettingsService,
103103
private formBuilder: UntypedFormBuilder
104104
) {
@@ -137,7 +137,7 @@ export class CheckerInboxComponent implements OnInit {
137137
makerDateTimeFrom: this.dateUtils.formatDate(this.makerCheckerSearchForm.value.makerDateTimeFrom, dateFormat),
138138
makerDateTimeto: this.dateUtils.formatDate(this.makerCheckerSearchForm.value.makerDateTimeto, dateFormat)
139139
};
140-
this.tasksService.getMakerCheckerData(makerCheckerSearchParams).subscribe((response: any) => {
140+
this.makerCheckerService.retrieveCommands(makerCheckerSearchParams).subscribe((response: any) => {
141141
this.searchData = response;
142142
if (this.searchData.length === 0) {
143143
this.noSearchedData = true;
@@ -218,7 +218,7 @@ export class CheckerInboxComponent implements OnInit {
218218
const listSelectedAccounts = this.selection.selected;
219219
let approvedAccounts = 0;
220220
listSelectedAccounts.forEach((element: any) => {
221-
this.tasksService.executeMakerCheckerAction(element.id, action).subscribe((response: any) => {
221+
this.makerCheckerService.approveMakerCheckerEntry(element.id, action).subscribe((response: any) => {
222222
approvedAccounts++;
223223
if (selectedAccounts === approvedAccounts) {
224224
this.reload();
@@ -232,7 +232,7 @@ export class CheckerInboxComponent implements OnInit {
232232
const listSelectedAccounts = this.selection.selected;
233233
let approvedAccounts = 0;
234234
listSelectedAccounts.forEach((element: any) => {
235-
this.tasksService.deleteMakerChecker(element.id).subscribe((response: any) => {
235+
this.makerCheckerService.deleteMakerCheckerEntry(element.id).subscribe((response: any) => {
236236
approvedAccounts++;
237237
if (selectedAccounts === approvedAccounts) {
238238
this.reload();

src/app/tasks/checker-inbox-and-tasks-tabs/client-approval/client-approval.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-
2424
import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base';
2525

2626
/** Custom Services */
27-
import { TasksService } from '../../tasks.service';
27+
import { BatchAPIService } from '@fineract/client';
2828
import { SettingsService } from 'app/settings/settings.service';
2929
import { Dates } from 'app/core/utils/dates';
3030
import { NgIf, NgFor, KeyValuePipe } from '@angular/common';
@@ -81,15 +81,15 @@ export class ClientApprovalComponent {
8181
* @param {Dates} dateUtils Date Utils.
8282
* @param {router} router Router.
8383
* @param {SettingsService} settingsService Settings Service.
84-
* @param {TasksService} tasksService Tasks Service.
84+
* @param {BatchAPIService} batchAPIService Batch API Service.
8585
*/
8686
constructor(
8787
private route: ActivatedRoute,
8888
private dialog: MatDialog,
8989
private dateUtils: Dates,
9090
private router: Router,
9191
private settingsService: SettingsService,
92-
private tasksService: TasksService
92+
private batchAPIService: BatchAPIService
9393
) {
9494
this.route.data.subscribe((data: { groupedClientData: any }) => {
9595
this.groupedClients = _.groupBy(data.groupedClientData.pageItems, 'officeName');
@@ -170,7 +170,7 @@ export class ClientApprovalComponent {
170170
const batchData = { requestId: reqId++, relativeUrl: url, method: 'POST', body: bodyData };
171171
this.batchRequests.push(batchData);
172172
});
173-
this.tasksService.submitBatchData(this.batchRequests).subscribe((response: any) => {
173+
this.batchAPIService.handleBatchRequests({ batchRequest: this.batchRequests }).subscribe((response: any) => {
174174
response.forEach((responseEle: any) => {
175175
if ((responseEle.statusCode = '200')) {
176176
activatedAccounts++;

src/app/tasks/checker-inbox-and-tasks-tabs/loan-approval/loan-approval.component.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { MatDialog } from '@angular/material/dialog';
2222
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
2323

2424
/** Custom Services */
25-
import { TasksService } from '../../tasks.service';
25+
import { BatchAPIService, LoansService } from '@fineract/client';
2626
import { SettingsService } from 'app/settings/settings.service';
2727
import { Dates } from 'app/core/utils/dates';
2828
import { TranslateService } from '@ngx-translate/core';
@@ -91,7 +91,8 @@ export class LoanApprovalComponent {
9191
* @param {Dates} dateUtils Date Utils.
9292
* @param {router} router Router.
9393
* @param {SettingsService} settingsService Settings Service.
94-
* @param {TasksService} tasksService Tasks Service.
94+
* @param {BatchAPIService} batchAPIService Batch API Service.
95+
* @param {LoansService} loan Loan Service.
9596
*/
9697
constructor(
9798
private route: ActivatedRoute,
@@ -100,7 +101,8 @@ export class LoanApprovalComponent {
100101
private router: Router,
101102
private translateService: TranslateService,
102103
private settingsService: SettingsService,
103-
private tasksService: TasksService
104+
private batchAPIService: BatchAPIService,
105+
private loansService: LoansService
104106
) {
105107
this.route.data.subscribe((data: { officesData: any; loansData: any }) => {
106108
this.offices = data.officesData;
@@ -200,7 +202,7 @@ export class LoanApprovalComponent {
200202
const batchData = { requestId: reqId++, relativeUrl: url, method: 'POST', body: bodyData };
201203
this.batchRequests.push(batchData);
202204
});
203-
this.tasksService.submitBatchData(this.batchRequests).subscribe((response: any) => {
205+
this.batchAPIService.handleBatchRequests({ batchRequest: this.batchRequests }).subscribe((response: any) => {
204206
response.forEach((responseEle: any) => {
205207
if ((responseEle.statusCode = '200')) {
206208
approvedAccounts++;
@@ -219,7 +221,7 @@ export class LoanApprovalComponent {
219221
}
220222

221223
loanResource() {
222-
this.tasksService.getAllLoansToBeApproved().subscribe((response: any) => {
224+
this.loansService.retrieveAll27().subscribe((response: any) => {
223225
this.loans = response.pageItems;
224226
this.loans = this.loans.filter((account: any) => {
225227
return account.status.waitingForDisbursal === true;

src/app/tasks/checker-inbox-and-tasks-tabs/loan-disbursal/loan-disbursal.component.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { MatDialog } from '@angular/material/dialog';
2121
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
2222

2323
/** Custom Services */
24-
import { TasksService } from '../../tasks.service';
24+
import { BatchAPIService, LoansService } from '@fineract/client';
2525
import { SettingsService } from 'app/settings/settings.service';
2626
import { Dates } from 'app/core/utils/dates';
2727
import { TranslateService } from '@ngx-translate/core';
@@ -76,15 +76,17 @@ export class LoanDisbursalComponent {
7676
* @param {Dates} dateUtils Date Utils.
7777
* @param {router} router Router.
7878
* @param {SettingsService} settingsService Settings Service.
79-
* @param {TasksService} tasksService Tasks Service.
79+
* @param {BatchAPIService} batchAPIService Batch API Service.
80+
* @param {LoansService} loansService Loans Service.
8081
*/
8182
constructor(
8283
private route: ActivatedRoute,
8384
private dialog: MatDialog,
8485
private dateUtils: Dates,
8586
private settingsService: SettingsService,
8687
private translateService: TranslateService,
87-
private tasksService: TasksService
88+
private batchAPIService: BatchAPIService,
89+
private loansService: LoansService
8890
) {
8991
this.route.data.subscribe((data: { loansData: any }) => {
9092
this.loans = data.loansData.pageItems;
@@ -152,7 +154,7 @@ export class LoanDisbursalComponent {
152154
const batchData = { requestId: reqId++, relativeUrl: url, method: 'POST', body: bodyData };
153155
this.batchRequests.push(batchData);
154156
});
155-
this.tasksService.submitBatchData(this.batchRequests).subscribe((response: any) => {
157+
this.batchAPIService.handleBatchRequests({ batchRequest: this.batchRequests }).subscribe((response: any) => {
156158
response.forEach((responseEle: any) => {
157159
if ((responseEle.statusCode = '200')) {
158160
approvedAccounts++;
@@ -166,7 +168,7 @@ export class LoanDisbursalComponent {
166168
}
167169

168170
loanResource() {
169-
this.tasksService.getAllLoansToBeDisbursed().subscribe((response: any) => {
171+
this.loansService.retrieveAll27().subscribe((response: any) => {
170172
this.loans = response.pageItems;
171173
this.loans = this.loans.filter((account: any) => {
172174
return account.status.waitingForDisbursal === true;

src/app/tasks/checker-inbox-and-tasks-tabs/reschedule-loan/reschedule-loan.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { MatDialog } from '@angular/material/dialog';
2222
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
2323

2424
/** Custom Services */
25-
import { TasksService } from '../../tasks.service';
25+
import { BatchAPIService } from '@fineract/client';
2626
import { SettingsService } from 'app/settings/settings.service';
2727
import { Dates } from 'app/core/utils/dates';
2828
import { TranslateService } from '@ngx-translate/core';
@@ -85,7 +85,7 @@ export class RescheduleLoanComponent {
8585
* @param {Dates} dateUtils Date Utils.
8686
* @param {router} router Router.
8787
* @param {SettingsService} settingsService Settings Service.
88-
* @param {TasksService} tasksService Tasks Service.
88+
* @param {BatchAPIService} batchAPIService Batch API Service.
8989
*/
9090
constructor(
9191
private route: ActivatedRoute,
@@ -94,7 +94,7 @@ export class RescheduleLoanComponent {
9494
private router: Router,
9595
private settingsService: SettingsService,
9696
private translateService: TranslateService,
97-
private tasksService: TasksService
97+
private batchAPIService: BatchAPIService
9898
) {
9999
this.route.data.subscribe((data: { recheduleLoansData: any }) => {
100100
this.loans = data.recheduleLoansData;
@@ -164,7 +164,7 @@ export class RescheduleLoanComponent {
164164
const batchData = { requestId: reqId++, relativeUrl: url, method: 'POST', body: bodyData };
165165
this.batchRequests.push(batchData);
166166
});
167-
this.tasksService.submitBatchData(this.batchRequests).subscribe((response: any) => {
167+
this.batchAPIService.handleBatchRequests({ batchRequest: this.batchRequests }).subscribe((response: any) => {
168168
this.reload();
169169
});
170170
}

src/app/tasks/common-resolvers/getCheckerInboxDetail.resolver.ts

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

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

1111
/**
1212
* Checker Inbox Detail resolver.
1313
*/
1414
@Injectable()
1515
export class GetCheckerInboxDetailResolver {
1616
/**
17-
* @param {TasksService} tasksService Tasks service.
17+
* @param {AuditsService} auditsService Audits service.
1818
*/
19-
constructor(private tasksService: TasksService) {}
19+
constructor(private auditsService: AuditsService) {}
2020

2121
/**
2222
* Returns the detail data of the checker inbox.
2323
* @returns {Observable<any>}
2424
*/
2525
resolve(route: ActivatedRouteSnapshot): Observable<any> {
26-
const checkerId = route.paramMap.get('id');
27-
return this.tasksService.getCheckerInboxDetail(checkerId);
26+
const checkerId = Number(route.paramMap.get('id'));
27+
return this.auditsService.retrieveAuditEntries({ resourceId: checkerId });
2828
}
2929
}

src/app/tasks/common-resolvers/getGroupedClientsData.resolver.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ import { Injectable } from '@angular/core';
55
import { Observable } from 'rxjs';
66

77
/** Custom Services */
8-
import { TasksService } from '../tasks.service';
8+
import { ClientService } from '@fineract/client';
99

1010
/**
1111
* Grouped Client Data data resolver.
1212
*/
1313
@Injectable()
1414
export class GetGroupedClientsData {
1515
/**
16-
* @param {TasksService} tasksService Tasks service.
16+
* @param {ClientService} clientService Client service.
1717
*/
18-
constructor(private tasksService: TasksService) {}
18+
constructor(private clientService: ClientService) {}
1919

2020
/**
2121
* Returns the grouped client data.
2222
* @returns {Observable<any>}
2323
*/
2424
resolve(): Observable<any> {
25-
return this.tasksService.getGroupedClientsData();
25+
return this.clientService.retrieveAll21();
2626
}
2727
}

src/app/tasks/common-resolvers/getLoansToBeApproved.resolver.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ import { Injectable } from '@angular/core';
55
import { Observable } from 'rxjs';
66

77
/** Custom Services */
8-
import { TasksService } from '../tasks.service';
8+
import { LoansService } from '@fineract/client';
99

1010
/**
1111
* Loans data resolver.
1212
*/
1313
@Injectable()
1414
export class GetLoansToBeApproved {
1515
/**
16-
* @param {TasksService} tasksService Tasks service.
16+
* @param {LoansService} loansService Loans service.
1717
*/
18-
constructor(private tasksService: TasksService) {}
18+
constructor(private loansService: LoansService) {}
1919

2020
/**
2121
* Returns all the loans data.
2222
* @returns {Observable<any>}
2323
*/
2424
resolve(): Observable<any> {
25-
return this.tasksService.getAllLoansToBeApproved();
25+
return this.loansService.retrieveAll27();
2626
}
2727
}

0 commit comments

Comments
 (0)