Skip to content

Commit 61f63cd

Browse files
authored
Merge pull request #2686 from JaySoni1/WEB-300-replace-custom-api-of-organization-service-ts
WEB-300 replace custom api of organization-service.ts
2 parents f669671 + 4db761a commit 61f63cd

File tree

84 files changed

+467
-384
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+467
-384
lines changed

src/app/customApis.service.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,41 @@ export class AccountTransfersService {
193193
);
194194
}
195195
}
196+
197+
@Injectable({
198+
providedIn: 'root'
199+
})
200+
export class OrganizationService {
201+
constructor(
202+
private http: HttpClient,
203+
private settingsService: any
204+
) {}
205+
206+
/**
207+
* @param urlSuffix of Bulk-Import
208+
* @param officeId Office ID for template retrieval
209+
* @param staffId Staff ID for template retrieval
210+
* @param legalFormType Legal Form type fortemplate retrieval
211+
* @returns {Observable<any>} Import Template
212+
*/
213+
getImportTemplate(urlSuffix: string, officeId: any, staffId: any, legalFormType: string): Observable<any> {
214+
let httpParams = new HttpParams()
215+
.set('tenantIdentifier', 'default')
216+
.set('locale', this.settingsService.language.code)
217+
.set('dateFormat', this.settingsService.dateFormat);
218+
if (officeId) {
219+
httpParams = httpParams.set('officeId', officeId.toString());
220+
}
221+
if (staffId) {
222+
httpParams = httpParams.set('staffId', staffId.toString());
223+
}
224+
if (legalFormType.length) {
225+
httpParams = httpParams.set('legalFormType', legalFormType);
226+
}
227+
return this.http.get(`${urlSuffix}/downloadtemplate`, {
228+
params: httpParams,
229+
responseType: 'arraybuffer',
230+
observe: 'response'
231+
});
232+
}
233+
}

src/app/loans/loans-view/loan-account-actions/adjust-loan-charge/adjust-loan-charge.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import {
77
ReactiveFormsModule
88
} from '@angular/forms';
99
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
10-
import { LoansService, LoanChargesService } from '@fineract/client';
11-
import { OrganizationService } from 'app/organization/organization.service';
10+
import { LoansService, LoanChargesService, PaymentTypeService } from '@fineract/client';
1211
import { SettingsService } from 'app/settings/settings.service';
1312
import { MatSlideToggle } from '@angular/material/slide-toggle';
1413
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
@@ -49,6 +48,7 @@ export class AdjustLoanChargeComponent implements OnInit {
4948
* @param {ActivatedRoute} route Activated Route.
5049
* @param {Router} router Router for navigation.
5150
* @param {SettingsService} settingsService Settings Service
51+
* @param {PaymentTypeService} paymentTypeService Payment Type Service
5252
*/
5353
constructor(
5454
private formBuilder: UntypedFormBuilder,
@@ -57,7 +57,7 @@ export class AdjustLoanChargeComponent implements OnInit {
5757
private route: ActivatedRoute,
5858
private router: Router,
5959
private settingsService: SettingsService,
60-
private organizationService: OrganizationService
60+
private paymentTypeService: PaymentTypeService
6161
) {
6262
this.loanId = this.route.snapshot.params['loanId'];
6363
this.chargeId = this.route.snapshot.params['id'];
@@ -93,7 +93,7 @@ export class AdjustLoanChargeComponent implements OnInit {
9393
}
9494

9595
setRepaymentLoanDetails() {
96-
this.organizationService.getPaymentTypes().subscribe((paymentTypes: any) => {
96+
this.paymentTypeService.getAllPaymentTypes().subscribe((paymentTypes: any) => {
9797
this.paymentTypes = paymentTypes;
9898
});
9999
}

src/app/loans/loans-view/loan-account-actions/approve-loan/approve-loan.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { InputAmountComponent } from '../../../../shared/input-amount/input-amou
1212
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
1313
import { FormatNumberPipe } from '../../../../pipes/format-number.pipe';
1414
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
15-
import { MatIcon } from '@angular/material/icon';
1615

1716
/**
1817
* Approve Loan component.

src/app/loans/loans-view/loan-account-actions/disburse-to-savings-account/disburse-to-savings-account.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { InputAmountComponent } from '../../../../shared/input-amount/input-amou
99
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
1010
import { FormatNumberPipe } from '../../../../pipes/format-number.pipe';
1111
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
12-
import { MatIcon } from '@angular/material/icon';
1312

1413
@Component({
1514
selector: 'mifosx-disburse-to-savings-account',

src/app/loans/loans-view/loan-account-actions/disburse/disburse.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { MatSlideToggle } from '@angular/material/slide-toggle';
1313
import { CdkTextareaAutosize } from '@angular/cdk/text-field';
1414
import { FormatNumberPipe } from '../../../../pipes/format-number.pipe';
1515
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
16-
import { MatIcon } from '@angular/material/icon';
1716

1817
/**
1918
* Disburse Loan Option

src/app/loans/loans-view/transactions/view-transaction/view-transaction.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { LoansService, LoanTransactionsService } from '@fineract/client';
88
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
99
import { SettingsService } from 'app/settings/settings.service';
1010
import { Dates } from 'app/core/utils/dates';
11-
import { OrganizationService } from 'app/organization/organization.service';
11+
import { PaymentTypeService } from '@fineract/client';
1212
import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base';
1313
import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
1414
import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base';
@@ -116,7 +116,7 @@ export class ViewTransactionComponent implements OnInit {
116116
public dialog: MatDialog,
117117
private translateService: TranslateService,
118118
private settingsService: SettingsService,
119-
private organizationService: OrganizationService,
119+
private paymentTypeService: PaymentTypeService,
120120
private alertService: AlertService
121121
) {
122122
this.route.data.subscribe((data: { loansAccountTransaction: any }) => {
@@ -159,8 +159,8 @@ export class ViewTransactionComponent implements OnInit {
159159

160160
ngOnInit(): void {
161161
if (this.allowChargeback) {
162-
this.organizationService
163-
.getPaymentTypesWithCode()
162+
this.paymentTypeService
163+
.getAllPaymentTypes()
164164
.toPromise()
165165
.then((data) => {
166166
this.paymentTypeOptions = data;

src/app/organization/adhoc-query/adhoc-query-template.resolver.ts

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

77
/** Custom Services */
8-
import { OrganizationService } from 'app/organization/organization.service';
9-
8+
import { AdhocQueryApiService } from '@fineract/client';
109
/**
1110
* Adhoc Query template data resolver.
1211
*/
1312
@Injectable()
1413
export class AdhocQueryTemplateResolver {
1514
/**
16-
* @param {OrganizationService} organizationService Organization service.
15+
* @param {AdhocQueryApiService} adhocQueryApiService Adhoc Query API service.
1716
*/
18-
constructor(private organizationService: OrganizationService) {}
17+
constructor(private adhocQueryApiService: AdhocQueryApiService) {}
1918

2019
/**
2120
* Returns the adhoc query template data.
2221
* @returns {Observable<any>}
2322
*/
2423
resolve(): Observable<any> {
25-
return this.organizationService.getAdhocQueryTemplate();
24+
return this.adhocQueryApiService.template();
2625
}
2726
}

src/app/organization/adhoc-query/common-resolvers/adhoc-queries.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 { OrganizationService } from '../../organization.service';
8+
import { AdhocQueryApiService } from '@fineract/client';
99

1010
/**
1111
* Adhoc Queries data resolver.
1212
*/
1313
@Injectable()
1414
export class AdhocQueriesResolver {
1515
/**
16-
* @param {OrganizationService} organizationService Organization service.
16+
* @param {AdhocQueryApiService} adhocQueryApiService Adhoc Query API service.
1717
*/
18-
constructor(private organizationService: OrganizationService) {}
18+
constructor(private adhocQueryApiService: AdhocQueryApiService) {}
1919

2020
/**
2121
* Returns the adhoc queries data.
2222
* @returns {Observable<any>}
2323
*/
2424
resolve(): Observable<any> {
25-
return this.organizationService.getAdhocQueries();
25+
return this.adhocQueryApiService.retrieveAll2();
2626
}
2727
}

src/app/organization/adhoc-query/common-resolvers/adhoc-query-and-template.resolver.ts

Lines changed: 4 additions & 4 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 { OrganizationService } from 'app/organization/organization.service';
9+
import { AdhocQueryApiService } from '@fineract/client';
1010

1111
/**
1212
* Adhoc Query and template data resolver.
1313
*/
1414
@Injectable()
1515
export class AdhocQueryAndTemplateResolver {
1616
/**
17-
* @param {OrganizationService} organizationService Organization service.
17+
* @param {AdhocQueryApiService} adhocQueryApiService Adhoc Query API service.
1818
*/
19-
constructor(private organizationService: OrganizationService) {}
19+
constructor(private adhocQueryApiService: AdhocQueryApiService) {}
2020

2121
/**
2222
* Returns the adhoc query and template data.
2323
* @returns {Observable<any>}
2424
*/
2525
resolve(route: ActivatedRouteSnapshot): Observable<any> {
2626
const adhocQueryId = route.paramMap.get('id');
27-
return this.organizationService.getAdhocQueryAndTemplate(adhocQueryId);
27+
return this.adhocQueryApiService.retrieveAll2();
2828
}
2929
}

src/app/organization/adhoc-query/common-resolvers/adhoc-query.resolver.ts

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

88
/** Custom Services */
9-
import { OrganizationService } from 'app/organization/organization.service';
9+
import { AdhocQueryApiService } from '@fineract/client';
1010

1111
/**
1212
* Adhoc Query data resolver.
1313
*/
1414
@Injectable()
1515
export class AdhocQueryResolver {
1616
/**
17-
* @param {OrganizationService} organizationService Organization service.
17+
* @param {AdhocQueryApiService} adhocQueryApiService Adhoc Query API service.
1818
*/
19-
constructor(private organizationService: OrganizationService) {}
19+
constructor(private adhocQueryApiService: AdhocQueryApiService) {}
2020

2121
/**
2222
* Returns the adhoc query data.
2323
* @returns {Observable<any>}
2424
*/
2525
resolve(route: ActivatedRouteSnapshot): Observable<any> {
2626
const adhocQueryId = route.paramMap.get('id');
27-
return this.organizationService.getAdhocQuery(adhocQueryId);
27+
return this.adhocQueryApiService.retrieveAdHocQuery({
28+
adHocId: Number(adhocQueryId)
29+
});
2830
}
2931
}

0 commit comments

Comments
 (0)