@@ -4,6 +4,7 @@ import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
/** Custom Services */
|
||||
import { ReportsService } from '../../reports.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* Pentaho Component
|
||||
@@ -26,9 +27,10 @@ export class PentahoComponent implements OnChanges {
|
||||
/**
|
||||
* @param {DomSanitizer} sanitizer DOM Sanitizer
|
||||
* @param {ReportsService} reportsService Reports Service
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private sanitizer: DomSanitizer,
|
||||
private reportsService: ReportsService) { }
|
||||
private reportsService: ReportsService, private settingsService: SettingsService) { }
|
||||
|
||||
/**
|
||||
* Fetches run report data post changes in run report form.
|
||||
@@ -39,7 +41,7 @@ export class PentahoComponent implements OnChanges {
|
||||
}
|
||||
|
||||
getRunReportData() {
|
||||
this.reportsService.getPentahoRunReportData(this.dataObject.report.name, this.dataObject.formData, 'default', 'en', 'dd MMMM yyyy')
|
||||
this.reportsService.getPentahoRunReportData(this.dataObject.report.name, this.dataObject.formData, 'default', this.settingsService.language.code, this.settingsService.dateFormat)
|
||||
.subscribe( (res: any) => {
|
||||
const contentType = res.headers.get('Content-Type');
|
||||
const file = new Blob([res.body], {type: contentType});
|
||||
|
||||
@@ -6,6 +6,7 @@ import { DatePipe } from '@angular/common';
|
||||
|
||||
/** Custom Services */
|
||||
import { ReportsService } from '../reports.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/** Custom Models */
|
||||
import { ReportParameter } from '../common-models/report-parameter.model';
|
||||
@@ -55,10 +56,12 @@ export class RunReportComponent implements OnInit {
|
||||
* Fetches report specifications from route params and retrieves report parameters data from `resolve`.
|
||||
* @param {ActivatedRoute} route ActivatedRoute.
|
||||
* @param {ReportsService} reportsService ReportsService
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
* @param {DatePipe} datePipe Date Pipe
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private reportsService: ReportsService,
|
||||
private settingsService: SettingsService,
|
||||
private datePipe: DatePipe) {
|
||||
this.report.name = this.route.snapshot.params['name'];
|
||||
this.route.queryParams.subscribe((queryParams: { type: any, id: any }) => {
|
||||
@@ -189,7 +192,7 @@ export class RunReportComponent implements OnInit {
|
||||
formattedResponse[newKey] = value['id'];
|
||||
break;
|
||||
case 'date':
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
formattedResponse[newKey] = this.datePipe.transform(value, dateFormat);
|
||||
break;
|
||||
case 'none':
|
||||
|
||||
@@ -7,6 +7,7 @@ import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
/** Custom Services */
|
||||
import { ReportsService } from '../reports.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
|
||||
/**
|
||||
* XBRL Report Component
|
||||
@@ -41,9 +42,11 @@ export class XBRLReportComponent implements OnInit {
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private reportService: ReportsService,
|
||||
private formBuilder: FormBuilder,
|
||||
private settingsService: SettingsService,
|
||||
private datePipe: DatePipe,
|
||||
private sanitizer: DomSanitizer) {}
|
||||
|
||||
@@ -88,7 +91,7 @@ export class XBRLReportComponent implements OnInit {
|
||||
const startDate: Date = this.xbrlForm.value.startDate;
|
||||
const endDate: Date = this.xbrlForm.value.endDate;
|
||||
// TODO: Update once language and date settings are setup
|
||||
const dateFormat = 'yyyy-MM-dd';
|
||||
const dateFormat = this.settingsService.dateFormat;
|
||||
this.xbrlForm.patchValue({
|
||||
startDate: this.datePipe.transform(startDate, dateFormat),
|
||||
endDate: this.datePipe.transform(endDate, dateFormat)
|
||||
@@ -123,3 +126,4 @@ export class XBRLReportComponent implements OnInit {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user