diff --git a/src/app/clients/clients-view/general-tab/general-tab.component.ts b/src/app/clients/clients-view/general-tab/general-tab.component.ts index e6b2ded43b..02235463ae 100644 --- a/src/app/clients/clients-view/general-tab/general-tab.component.ts +++ b/src/app/clients/clients-view/general-tab/general-tab.component.ts @@ -39,7 +39,7 @@ import { DateFormatPipe } from '../../../pipes/date-format.pipe'; import { FormatNumberPipe } from '../../../pipes/format-number.pipe'; import { CurrencyPipe } from '@angular/common'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; -import { ReportsService } from 'app/reports/reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; import { SettingsService } from 'app/settings/settings.service'; import { Subject } from 'rxjs'; import { takeUntil, catchError } from 'rxjs/operators'; diff --git a/src/app/clients/clients-view/personal-data-tab/personal-data-tab.component.ts b/src/app/clients/clients-view/personal-data-tab/personal-data-tab.component.ts index 89ff88feb8..f97e07f1b4 100644 --- a/src/app/clients/clients-view/personal-data-tab/personal-data-tab.component.ts +++ b/src/app/clients/clients-view/personal-data-tab/personal-data-tab.component.ts @@ -20,7 +20,7 @@ import { DateFormatPipe } from '../../../pipes/date-format.pipe'; import { LegalFormId } from 'app/clients/models/legal-form.enum'; import { ClientsService } from 'app/clients/clients.service'; import { MatIcon } from '@angular/material/icon'; -import { ReportsService } from 'app/reports/reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; import { SettingsService } from 'app/settings/settings.service'; import { AlertService } from 'app/core/alert/alert.service'; import { SystemService } from 'app/system/system.service'; diff --git a/src/app/loans/common-resolvers/loans-transaction-reciept.resolver.ts b/src/app/loans/common-resolvers/loans-transaction-reciept.resolver.ts index 815395deb8..d6ee3bf48d 100644 --- a/src/app/loans/common-resolvers/loans-transaction-reciept.resolver.ts +++ b/src/app/loans/common-resolvers/loans-transaction-reciept.resolver.ts @@ -14,7 +14,7 @@ import { ActivatedRouteSnapshot } from '@angular/router'; import { Observable } from 'rxjs'; /** Custom Services */ -import { ReportsService } from 'app/reports/reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; /** * Loans Transaction Reciept resolver. diff --git a/src/app/loans/loans-view/transactions/export-transactions/export-transactions.component.ts b/src/app/loans/loans-view/transactions/export-transactions/export-transactions.component.ts index 0a42eada34..4448ed2e1b 100644 --- a/src/app/loans/loans-view/transactions/export-transactions/export-transactions.component.ts +++ b/src/app/loans/loans-view/transactions/export-transactions/export-transactions.component.ts @@ -13,7 +13,7 @@ import { UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/fo import { ActivatedRoute, RouterLink } from '@angular/router'; /** Custom Services */ -import { ReportsService } from 'app/reports/reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; import { Dates } from 'app/core/utils/dates'; import { SettingsService } from 'app/settings/settings.service'; import { FaIconComponent } from '@fortawesome/angular-fontawesome'; diff --git a/src/app/organization/sms-campaigns/sms-campaign-stepper/edit-sms-campaign-step/edit-business-rule-parameters/edit-business-rule-parameters.component.ts b/src/app/organization/sms-campaigns/sms-campaign-stepper/edit-sms-campaign-step/edit-business-rule-parameters/edit-business-rule-parameters.component.ts index 76383cc6fc..d1e06f63f8 100644 --- a/src/app/organization/sms-campaigns/sms-campaign-stepper/edit-sms-campaign-step/edit-business-rule-parameters/edit-business-rule-parameters.component.ts +++ b/src/app/organization/sms-campaigns/sms-campaign-stepper/edit-sms-campaign-step/edit-business-rule-parameters/edit-business-rule-parameters.component.ts @@ -14,12 +14,12 @@ import { Validators, UntypedFormGroup, UntypedFormControl, ReactiveFormsModule } import { distinctUntilChanged } from 'rxjs/operators'; /** Custom Services */ -import { ReportsService } from 'app/reports/reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; import { SettingsService } from 'app/settings/settings.service'; /** Custom Models */ -import { ReportParameter } from 'app/reports/common-models/report-parameter.model'; -import { SelectOption } from 'app/reports/common-models/select-option.model'; +import { ReportParameter } from 'app/reporting-plugin/models/report-parameter.model'; +import { SelectOption } from 'app/reporting-plugin/models/select-option.model'; import { Dates } from 'app/core/utils/dates'; import { MatDivider } from '@angular/material/divider'; import { NgFor, NgSwitch, NgIf, NgSwitchCase } from '@angular/common'; diff --git a/src/app/organization/sms-campaigns/sms-campaign-stepper/edit-sms-campaign-step/edit-sms-campaign-step.component.ts b/src/app/organization/sms-campaigns/sms-campaign-stepper/edit-sms-campaign-step/edit-sms-campaign-step.component.ts index 877f324ab5..37fa9edccb 100644 --- a/src/app/organization/sms-campaigns/sms-campaign-stepper/edit-sms-campaign-step/edit-sms-campaign-step.component.ts +++ b/src/app/organization/sms-campaigns/sms-campaign-stepper/edit-sms-campaign-step/edit-sms-campaign-step.component.ts @@ -17,10 +17,10 @@ import { } from '@angular/forms'; /** Custom Services */ -import { ReportsService } from 'app/reports/reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; /** Custom Models */ -import { ReportParameter } from 'app/reports/common-models/report-parameter.model'; +import { ReportParameter } from 'app/reporting-plugin/models/report-parameter.model'; import { SettingsService } from 'app/settings/settings.service'; import { MatCheckbox } from '@angular/material/checkbox'; import { EditBusinessRuleParametersComponent } from './edit-business-rule-parameters/edit-business-rule-parameters.component'; diff --git a/src/app/organization/sms-campaigns/sms-campaign-stepper/sms-campaign-step/business-rule-parameters/business-rule-parameters.component.ts b/src/app/organization/sms-campaigns/sms-campaign-stepper/sms-campaign-step/business-rule-parameters/business-rule-parameters.component.ts index 1f743324ae..1dbe771903 100644 --- a/src/app/organization/sms-campaigns/sms-campaign-stepper/sms-campaign-step/business-rule-parameters/business-rule-parameters.component.ts +++ b/src/app/organization/sms-campaigns/sms-campaign-stepper/sms-campaign-step/business-rule-parameters/business-rule-parameters.component.ts @@ -11,12 +11,12 @@ import { Component, OnChanges, Input, Output, EventEmitter, OnInit, inject } fro import { Validators, UntypedFormGroup, UntypedFormControl, ReactiveFormsModule } from '@angular/forms'; /** Custom Services */ -import { ReportsService } from 'app/reports/reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; import { SettingsService } from 'app/settings/settings.service'; /** Custom Models */ -import { ReportParameter } from 'app/reports/common-models/report-parameter.model'; -import { SelectOption } from 'app/reports/common-models/select-option.model'; +import { ReportParameter } from 'app/reporting-plugin/models/report-parameter.model'; +import { SelectOption } from 'app/reporting-plugin/models/select-option.model'; import { Dates } from 'app/core/utils/dates'; import { MatDivider } from '@angular/material/divider'; import { NgFor, NgSwitch, NgIf, NgSwitchCase } from '@angular/common'; diff --git a/src/app/organization/sms-campaigns/sms-campaign-stepper/sms-campaign-step/sms-campaign-step.component.ts b/src/app/organization/sms-campaigns/sms-campaign-stepper/sms-campaign-step/sms-campaign-step.component.ts index c8f7a40980..6350b0914c 100644 --- a/src/app/organization/sms-campaigns/sms-campaign-stepper/sms-campaign-step/sms-campaign-step.component.ts +++ b/src/app/organization/sms-campaigns/sms-campaign-stepper/sms-campaign-step/sms-campaign-step.component.ts @@ -17,10 +17,10 @@ import { } from '@angular/forms'; /** Custom Services */ -import { ReportsService } from 'app/reports/reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; /** Custom Models */ -import { ReportParameter } from 'app/reports/common-models/report-parameter.model'; +import { ReportParameter } from 'app/reporting-plugin/models/report-parameter.model'; /** Custom Components */ import { BusinessRuleParametersComponent } from './business-rule-parameters/business-rule-parameters.component'; diff --git a/src/app/products/manage-tax-components/view-tax-component/view-tax-component.component.html b/src/app/products/manage-tax-components/view-tax-component/view-tax-component.component.html index f3f63ae2f1..1b2575d7a8 100644 --- a/src/app/products/manage-tax-components/view-tax-component/view-tax-component.component.html +++ b/src/app/products/manage-tax-components/view-tax-component/view-tax-component.component.html @@ -39,10 +39,7 @@ @if (taxComponentData.debitAccountType) {
- {{ - 'labels.inputs.accounting.' + (taxComponentData.debitAccountType.value?.split('.')[1] || '').toUpperCase() - | translate - }} + {{ taxComponentData.debitAccountType.code | translateKey: 'inputs.accounting' }}
} @@ -67,10 +64,7 @@ @if (taxComponentData.creditAccountType) {
- {{ - 'labels.inputs.accounting.' + - (taxComponentData.creditAccountType.value?.split('.')[1] || '').toUpperCase() | translate - }} + {{ taxComponentData.creditAccountType.code | translateKey: 'inputs.accounting' }}
} diff --git a/src/app/reports/common-models/chart-data.model.ts b/src/app/reporting-plugin/models/chart-data.model.ts similarity index 55% rename from src/app/reports/common-models/chart-data.model.ts rename to src/app/reporting-plugin/models/chart-data.model.ts index c43c0a07b6..3abaf1b88f 100644 --- a/src/app/reports/common-models/chart-data.model.ts +++ b/src/app/reporting-plugin/models/chart-data.model.ts @@ -6,6 +6,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/** Chart Data Response Interface */ +export interface ChartDataResponse { + columnHeaders: { columnName: string }[]; + data: { row: (string | number)[] }[]; +} + /** Chart Data Model */ export class ChartData { keysLabel: string; @@ -13,10 +19,10 @@ export class ChartData { keys: string[]; values: number[]; - constructor(response: any) { + constructor(response: ChartDataResponse) { this.keysLabel = response.columnHeaders[0].columnName; this.valuesLabel = response.columnHeaders[1].columnName; - this.keys = response.data.map((object: any) => object.row[0]); - this.values = response.data.map((object: any) => object.row[1]); + this.keys = response.data.map((object: { row: (string | number)[] }) => object.row[0] as string); + this.values = response.data.map((object: { row: (string | number)[] }) => object.row[1] as number); } } diff --git a/src/app/reporting-plugin/models/report-parameter.model.ts b/src/app/reporting-plugin/models/report-parameter.model.ts new file mode 100644 index 0000000000..b17a6c25dc --- /dev/null +++ b/src/app/reporting-plugin/models/report-parameter.model.ts @@ -0,0 +1,40 @@ +/** + * Copyright since 2025 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** Custom Models */ +import { SelectOption } from './select-option.model'; + +/** Report Parameter Model */ +export class ReportParameter { + name: string; + variable: string; + label: string; + displayType: string; + formatType: string; + defaultVal: string | number | boolean | null; + selectOne: string | null; + selectAll: string | null; + parentParameterName: string | null; + inputName: string; + selectOptions: SelectOption[] = []; + childParameters: ReportParameter[] = []; + pentahoName: string | null; + + constructor(options: (string | number | boolean | null)[]) { + this.name = options[0] as string; + this.variable = options[1] as string; + this.label = options[2] as string; + this.displayType = options[3] as string; + this.formatType = options[4] as string; + this.defaultVal = options[5]; + this.selectOne = options[6]; + this.selectAll = options[7]; + this.parentParameterName = options[8] as string | null; + this.inputName = `R_${this.variable}`; + } +} diff --git a/src/app/reports/common-models/select-option.model.ts b/src/app/reporting-plugin/models/select-option.model.ts similarity index 90% rename from src/app/reports/common-models/select-option.model.ts rename to src/app/reporting-plugin/models/select-option.model.ts index 224f6bfd29..4ae9d2fe4b 100644 --- a/src/app/reports/common-models/select-option.model.ts +++ b/src/app/reporting-plugin/models/select-option.model.ts @@ -11,7 +11,7 @@ export class SelectOption { id: number; name: string; - constructor(options: any[]) { + constructor(options: [number, string]) { this.id = options[0]; this.name = options[1]; } diff --git a/src/app/reports/common-resolvers/reports.resolver.ts b/src/app/reporting-plugin/resolvers/reports.resolver.ts similarity index 91% rename from src/app/reports/common-resolvers/reports.resolver.ts rename to src/app/reporting-plugin/resolvers/reports.resolver.ts index 9c9e99e9c2..3dc01b3ade 100644 --- a/src/app/reports/common-resolvers/reports.resolver.ts +++ b/src/app/reporting-plugin/resolvers/reports.resolver.ts @@ -13,7 +13,7 @@ import { Injectable, inject } from '@angular/core'; import { Observable } from 'rxjs'; /** Custom Services */ -import { ReportsService } from '../reports.service'; +import { ReportsService } from '../services/reports.service'; /** * Reports data resolver. diff --git a/src/app/reports/common-resolvers/run-report.resolver.ts b/src/app/reporting-plugin/resolvers/run-report.resolver.ts similarity index 92% rename from src/app/reports/common-resolvers/run-report.resolver.ts rename to src/app/reporting-plugin/resolvers/run-report.resolver.ts index 9e2b01f25d..cacb8a6dc4 100644 --- a/src/app/reports/common-resolvers/run-report.resolver.ts +++ b/src/app/reporting-plugin/resolvers/run-report.resolver.ts @@ -14,7 +14,7 @@ import { ActivatedRouteSnapshot } from '@angular/router'; import { Observable } from 'rxjs'; /** Custom Services */ -import { ReportsService } from '../reports.service'; +import { ReportsService } from '../services/reports.service'; /** * Reports data resolver. diff --git a/src/app/reporting-plugin/services/reports.service.ts b/src/app/reporting-plugin/services/reports.service.ts new file mode 100644 index 0000000000..c46fc54e9a --- /dev/null +++ b/src/app/reporting-plugin/services/reports.service.ts @@ -0,0 +1,186 @@ +/** + * Copyright since 2025 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/** Angular Imports */ +import { Injectable, inject } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; + +/** rxjs Imports */ +import { Observable } from 'rxjs'; +import { map } from 'rxjs/operators'; + +/** Custom Models */ +import { ReportParameter } from '../models/report-parameter.model'; +import { SelectOption } from '../models/select-option.model'; +import { ChartData } from '../models/chart-data.model'; + +/** + * Reports service. + */ +@Injectable({ + providedIn: 'root' +}) +export class ReportsService { + private http = inject(HttpClient); + + /** + * @returns {Observable} Reports data + */ + getReports(): Observable { + return this.http.get('/reports'); + } + + /** + * @param {string} officeId Office ID to filter reports. + * @returns {Observable} Reports data for a specific office. + */ + getReportsByOffice(officeId: string): Observable { + const httpParams = new HttpParams().set('officeId', officeId); + return this.http.get('/reports', { params: httpParams }); + } + + /** + * @param {string} reportName Report name for which parameters are needed. + * @returns {Observable} + */ + getReportParams(reportName: string): Observable { + const httpParams = new HttpParams().set('R_reportListing', `'${reportName}'`).set('parameterType', 'true'); + return this.http + .get(`/runreports/FullParameterList`, { params: httpParams }) + .pipe(map((response: any) => response.data.map((entry: any) => new ReportParameter(entry.row)))); + } + + /** + * @param {string} inputString URL substring containing object details. + * @returns {Observable} + */ + getSelectOptions(inputString: string): Observable { + const httpParams = new HttpParams().set('parameterType', 'true'); + return this.http + .get(`/runreports/${inputString}`, { params: httpParams }) + .pipe(map((response: any) => response.data.map((entry: any) => new SelectOption(entry.row)))); + } + + /** + * @param {number} reportId Report id for which pentaho parameters are needed. + * @returns {Observable} + */ + getPentahoParams(reportId: number): Observable { + const httpParams = new HttpParams().set('fields', 'reportParameters'); + return this.http + .get(`/reports/${reportId}`, { params: httpParams }) + .pipe(map((response: any) => response.reportParameters)); + } + + /** + * Run Report Data for Table and SMS. + * @param {any} reportName report name + * @param {object} formData Form Data. + * @returns {Observable} + */ + getRunReportData(reportName: string, formData: object): Observable { + let httpParams = new HttpParams(); + for (const [ + key, + value + ] of Object.entries(formData)) { + httpParams = httpParams.set(key, value); + } + return this.http.get(`/runreports/${reportName}`, { params: httpParams }); + } + + /** + * Run Report Data for Charts. + * @param {any} reportName report name + * @param {object} formData Form Data. + * @returns {Observable} + */ + getChartRunReportData(reportName: string, formData: object): Observable { + let httpParams = new HttpParams(); + for (const [ + key, + value + ] of Object.entries(formData)) { + httpParams = httpParams.set(key, value); + } + return this.http + .get(`/runreports/${reportName}`, { params: httpParams }) + .pipe(map((response: any) => new ChartData(response))); + } + + /** + * Run Report Data for Pentaho. + * @param {any} reportName report name + * @param {object} formData Form Data. + * @returns {Observable} + */ + getPentahoRunReportData( + reportName: string, + formData: object, + tenantIdentifier: string, + locale: string, + dateFormat: string + ): Observable { + let httpParams = new HttpParams() + .set('tenantIdentifier', tenantIdentifier) + .set('locale', locale) + .set('dateFormat', dateFormat); + for (const [ + key, + value + ] of Object.entries(formData)) { + httpParams = httpParams.set(key, value); + } + return this.http.get(`/runreports/${reportName}`, { + responseType: 'arraybuffer', + observe: 'response', + params: httpParams + }); + } + + /** + * @param {number} reportId + * @returns {Observable} + */ + getBirtParams(reportId: number): Observable { + const httpParams = new HttpParams().set('fields', 'reportParameters'); + return this.http + .get(`/reports/${reportId}`, { params: httpParams }) + .pipe(map((response: any) => response.reportParameters)); + } + + /** + * Run Report Data for BIRT. + * @param {any} reportName + * @param {object} formData + * @returns {Observable} + */ + getBirtRunReportData( + reportName: string, + formData: object, + tenantIdentifier: string, + locale: string, + dateFormat: string + ): Observable { + let httpParams = new HttpParams() + .set('tenantIdentifier', tenantIdentifier) + .set('locale', locale) + .set('dateFormat', dateFormat); + for (const [ + key, + value + ] of Object.entries(formData)) { + httpParams = httpParams.set(key, value); + } + return this.http.get(`/runreports/${reportName}`, { + responseType: 'arraybuffer', + observe: 'response', + params: httpParams + }); + } +} diff --git a/src/app/reports/common-models/report-parameter.model.ts b/src/app/reports/common-models/report-parameter.model.ts deleted file mode 100644 index 3549df76d3..0000000000 --- a/src/app/reports/common-models/report-parameter.model.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright since 2025 Mifos Initiative - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -/** Report Parameter Model */ -export class ReportParameter { - name: string; - variable: string; - label: string; - displayType: string; - formatType: string; - defaultVal: any; - selectOne: any; - selectAll: any; - parentParameterName: string; - inputName: string; - selectOptions: any[] = []; - childParameters: any[] = []; - pentahoName: any; - - constructor(options: any[]) { - this.name = options[0]; - this.variable = options[1]; - this.label = options[2]; - this.displayType = options[3]; - this.formatType = options[4]; - this.defaultVal = options[5]; - this.selectOne = options[6]; - this.selectAll = options[7]; - this.parentParameterName = options[8]; - this.inputName = `R_${options[1]}`; - } -} diff --git a/src/app/reports/reports-routing.module.ts b/src/app/reports/reports-routing.module.ts index 860f9ba468..e42e9e7bca 100644 --- a/src/app/reports/reports-routing.module.ts +++ b/src/app/reports/reports-routing.module.ts @@ -18,8 +18,8 @@ import { ReportsComponent } from './reports.component'; import { RunReportComponent } from './run-report/run-report.component'; /** Custom Resolvers */ -import { ReportsResolver } from './common-resolvers/reports.resolver'; -import { RunReportResolver } from './common-resolvers/run-report.resolver'; +import { ReportsResolver } from 'app/reporting-plugin/resolvers/reports.resolver'; +import { RunReportResolver } from 'app/reporting-plugin/resolvers/run-report.resolver'; import { GlAccountsResolver } from '../accounting/common-resolvers/gl-accounts.resolver'; import { GlobalConfigurationsResolver } from 'app/system/configurations/global-configurations-tab/global-configurations.resolver'; diff --git a/src/app/reports/reports.service.ts b/src/app/reports/reports.service.ts index cbedd430d9..13f48115a8 100644 --- a/src/app/reports/reports.service.ts +++ b/src/app/reports/reports.service.ts @@ -6,172 +6,4 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/** Angular Imports */ -import { Injectable, inject } from '@angular/core'; -import { HttpClient, HttpParams } from '@angular/common/http'; - -/** rxjs Imports */ -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; - -/** Custom Models */ -import { ReportParameter } from './common-models/report-parameter.model'; -import { SelectOption } from './common-models/select-option.model'; -import { ChartData } from './common-models/chart-data.model'; - -/** - * Reports service. - */ -@Injectable({ - providedIn: 'root' -}) -export class ReportsService { - private http = inject(HttpClient); - - /** - * @returns {Observable} Reports data - */ - getReports(): Observable { - return this.http.get('/reports'); - } - - /** - * @param {string} reportName Report name for which parameters are needed. - * @returns {Observable} - */ - getReportParams(reportName: string): Observable { - const httpParams = new HttpParams().set('R_reportListing', `'${reportName}'`).set('parameterType', 'true'); - return this.http - .get(`/runreports/FullParameterList`, { params: httpParams }) - .pipe(map((response: any) => response.data.map((entry: any) => new ReportParameter(entry.row)))); - } - - /** - * @param {string} inputString URL substring containing object details. - * @returns {Observable} - */ - getSelectOptions(inputString: string): Observable { - const httpParams = new HttpParams().set('parameterType', 'true'); - return this.http - .get(`/runreports/${inputString}`, { params: httpParams }) - .pipe(map((response: any) => response.data.map((entry: any) => new SelectOption(entry.row)))); - } - - /** - * @param {number} reportId Report id for which pentaho parameters are needed. - * @returns {Observable} - */ - getPentahoParams(reportId: number): Observable { - const httpParams = new HttpParams().set('fields', 'reportParameters'); - return this.http - .get(`/reports/${reportId}`, { params: httpParams }) - .pipe(map((response: any) => response.reportParameters)); - } - - /** - * Run Report Data for Table and SMS. - * @param {any} reportName report name - * @param {object} formData Form Data. - * @returns {Observable} - */ - getRunReportData(reportName: string, formData: object): Observable { - let httpParams = new HttpParams(); - for (const [ - key, - value - ] of Object.entries(formData)) { - httpParams = httpParams.set(key, value); - } - return this.http.get(`/runreports/${reportName}`, { params: httpParams }); - } - - /** - * Run Report Data for Charts. - * @param {any} reportName report name - * @param {object} formData Form Data. - * @returns {Observable} - */ - getChartRunReportData(reportName: string, formData: object): Observable { - let httpParams = new HttpParams(); - for (const [ - key, - value - ] of Object.entries(formData)) { - httpParams = httpParams.set(key, value); - } - return this.http - .get(`/runreports/${reportName}`, { params: httpParams }) - .pipe(map((response: any) => new ChartData(response))); - } - - /** - * Run Report Data for Pentaho. - * @param {any} reportName report name - * @param {object} formData Form Data. - * @returns {Observable} - */ - getPentahoRunReportData( - reportName: string, - formData: object, - tenantIdentifier: string, - locale: string, - dateFormat: string - ): Observable { - let httpParams = new HttpParams() - .set('tenantIdentifier', tenantIdentifier) - .set('locale', locale) - .set('dateFormat', dateFormat); - for (const [ - key, - value - ] of Object.entries(formData)) { - httpParams = httpParams.set(key, value); - } - return this.http.get(`/runreports/${reportName}`, { - responseType: 'arraybuffer', - observe: 'response', - params: httpParams - }); - } - - /** - * @param {number} reportId - * @returns {Observable} - */ - getBirtParams(reportId: number): Observable { - const httpParams = new HttpParams().set('fields', 'reportParameters'); - return this.http - .get(`/reports/${reportId}`, { params: httpParams }) - .pipe(map((response: any) => response.reportParameters)); - } - - /** - * Run Report Data for BIRT. - * @param {any} reportName - * @param {object} formData - * @returns {Observable} - */ - getBirtRunReportData( - reportName: string, - formData: object, - tenantIdentifier: string, - locale: string, - dateFormat: string - ): Observable { - let httpParams = new HttpParams() - .set('tenantIdentifier', tenantIdentifier) - .set('locale', locale) - .set('dateFormat', dateFormat); - for (const [ - key, - value - ] of Object.entries(formData)) { - httpParams = httpParams.set(key, value); - } - return this.http.get(`/runreports/${reportName}`, { - responseType: 'arraybuffer', - observe: 'response', - params: httpParams - }); - } -} +export { ReportsService } from 'app/reporting-plugin/services/reports.service'; diff --git a/src/app/reports/run-report/birt/birt.component.ts b/src/app/reports/run-report/birt/birt.component.ts index cb471dafe7..ee6e90a88c 100644 --- a/src/app/reports/run-report/birt/birt.component.ts +++ b/src/app/reports/run-report/birt/birt.component.ts @@ -15,7 +15,7 @@ import { finalize, catchError } from 'rxjs/operators'; import { of } from 'rxjs'; /** Custom Services */ -import { ReportsService } from '../../reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; import { SettingsService } from 'app/settings/settings.service'; import { ProgressBarService } from 'app/core/progress-bar/progress-bar.service'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; diff --git a/src/app/reports/run-report/chart/chart.component.ts b/src/app/reports/run-report/chart/chart.component.ts index 4908ac0649..789a6b230f 100644 --- a/src/app/reports/run-report/chart/chart.component.ts +++ b/src/app/reports/run-report/chart/chart.component.ts @@ -10,10 +10,10 @@ import { Component, OnChanges, Input, inject } from '@angular/core'; /** Custom Services */ -import { ReportsService } from '../../reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; /** Custom Models */ -import { ChartData } from '../../common-models/chart-data.model'; +import { ChartData } from 'app/reporting-plugin/models/chart-data.model'; /** Charting Imports */ import { Chart, registerables } from 'chart.js'; diff --git a/src/app/reports/run-report/pentaho/pentaho.component.ts b/src/app/reports/run-report/pentaho/pentaho.component.ts index b5295ebefd..d1117ea53f 100644 --- a/src/app/reports/run-report/pentaho/pentaho.component.ts +++ b/src/app/reports/run-report/pentaho/pentaho.component.ts @@ -11,7 +11,7 @@ import { Component, OnChanges, OnDestroy, Input, inject } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; /** Custom Services */ -import { ReportsService } from '../../reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; import { SettingsService } from 'app/settings/settings.service'; import { ProgressBarService } from 'app/core/progress-bar/progress-bar.service'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; diff --git a/src/app/reports/run-report/run-report.component.ts b/src/app/reports/run-report/run-report.component.ts index 2182d36168..059640f49d 100644 --- a/src/app/reports/run-report/run-report.component.ts +++ b/src/app/reports/run-report/run-report.component.ts @@ -19,12 +19,12 @@ import { } from '@angular/forms'; /** Custom Services */ -import { ReportsService } from '../reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; import { SettingsService } from 'app/settings/settings.service'; /** Custom Models */ -import { ReportParameter } from '../common-models/report-parameter.model'; -import { SelectOption } from '../common-models/select-option.model'; +import { ReportParameter } from 'app/reporting-plugin/models/report-parameter.model'; +import { SelectOption } from 'app/reporting-plugin/models/select-option.model'; import { Dates } from 'app/core/utils/dates'; import { GlobalConfiguration } from 'app/system/configurations/global-configurations-tab/configuration.model'; diff --git a/src/app/reports/run-report/table-and-sms/table-and-sms.component.ts b/src/app/reports/run-report/table-and-sms/table-and-sms.component.ts index b1cbf8185d..978230a042 100644 --- a/src/app/reports/run-report/table-and-sms/table-and-sms.component.ts +++ b/src/app/reports/run-report/table-and-sms/table-and-sms.component.ts @@ -25,7 +25,7 @@ import { import { DecimalPipe } from '@angular/common'; /** Custom Servies */ -import { ReportsService } from '../../reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; import { MatDialog } from '@angular/material/dialog'; import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base'; import { SelectBase } from 'app/shared/form-dialog/formfield/model/select-base'; diff --git a/src/app/savings/common-resolvers/savings-transaction-reciept.resolver.ts b/src/app/savings/common-resolvers/savings-transaction-reciept.resolver.ts index 8fee1a8a58..77603073bf 100644 --- a/src/app/savings/common-resolvers/savings-transaction-reciept.resolver.ts +++ b/src/app/savings/common-resolvers/savings-transaction-reciept.resolver.ts @@ -14,7 +14,7 @@ import { ActivatedRouteSnapshot } from '@angular/router'; import { Observable } from 'rxjs'; /** Custom Services */ -import { ReportsService } from 'app/reports/reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; import { SettingsService } from 'app/settings/settings.service'; /** diff --git a/src/app/savings/savings-account-view/transactions-tab/export-transactions/export-transactions.component.ts b/src/app/savings/savings-account-view/transactions-tab/export-transactions/export-transactions.component.ts index bf43f4e081..4eb02dce4d 100644 --- a/src/app/savings/savings-account-view/transactions-tab/export-transactions/export-transactions.component.ts +++ b/src/app/savings/savings-account-view/transactions-tab/export-transactions/export-transactions.component.ts @@ -13,7 +13,7 @@ import { UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/fo import { ActivatedRoute, RouterLink } from '@angular/router'; /** Custom Services */ -import { ReportsService } from 'app/reports/reports.service'; +import { ReportsService } from 'app/reporting-plugin/services/reports.service'; import { SettingsService } from 'app/settings/settings.service'; import { Dates } from 'app/core/utils/dates'; import { FaIconComponent } from '@fortawesome/angular-fontawesome';