Add locale and dateFormat in runreport APi call

This commit is contained in:
Jose Alberto Hernandez
2022-07-28 17:04:20 +02:00
committed by Arnold Gálovics
parent a2bd33f9b1
commit 7f9cd7f300
@@ -51,6 +51,8 @@ export class RunReportComponent implements OnInit {
hideChart = true; hideChart = true;
/** Toggles Pentaho output */ /** Toggles Pentaho output */
hidePentaho = true; hidePentaho = true;
/** Report uses dates */
reportUsesDates = false;
/** /**
* Fetches report specifications from route params and retrieves report parameters data from `resolve`. * Fetches report specifications from route params and retrieves report parameters data from `resolve`.
@@ -194,6 +196,7 @@ export class RunReportComponent implements OnInit {
case 'date': case 'date':
const dateFormat = this.settingsService.dateFormat; const dateFormat = this.settingsService.dateFormat;
formattedResponse[newKey] = this.dateUtils.formatDate(value, dateFormat); formattedResponse[newKey] = this.dateUtils.formatDate(value, dateFormat);
this.reportUsesDates = true;
break; break;
case 'none': case 'none':
formattedResponse[newKey] = value; formattedResponse[newKey] = value;
@@ -208,9 +211,19 @@ export class RunReportComponent implements OnInit {
*/ */
run() { run() {
this.isCollapsed = true; this.isCollapsed = true;
const userResponse = this.formatUserResponse(this.reportForm.value); const userResponseValues = this.formatUserResponse(this.reportForm.value);
let formData = {
...userResponseValues,
};
if (this.reportUsesDates) {
formData = {
...userResponseValues,
locale: this.settingsService.language.code,
dateFormat: this.settingsService.dateFormat
};
}
this.dataObject = { this.dataObject = {
formData: userResponse, formData: formData,
report: this.report, report: this.report,
decimalChoice: this.decimalChoice.value decimalChoice: this.decimalChoice.value
}; };