build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
/** Chart Data Model */
|
||||
export class ChartData {
|
||||
|
||||
keysLabel: string;
|
||||
valuesLabel: string;
|
||||
keys: string[];
|
||||
@@ -12,5 +11,4 @@ export class ChartData {
|
||||
this.keys = response.data.map((object: any) => object.row[0]);
|
||||
this.values = response.data.map((object: any) => object.row[1]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,31 +1,29 @@
|
||||
/** 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;
|
||||
|
||||
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]}`;
|
||||
}
|
||||
|
||||
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]}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
/** Select Option model */
|
||||
export class SelectOption {
|
||||
id: number;
|
||||
name: string;
|
||||
|
||||
id: number;
|
||||
name: string;
|
||||
|
||||
constructor(options: any[]) {
|
||||
this.id = options[0],
|
||||
this.name = options[1];
|
||||
}
|
||||
constructor(options: any[]) {
|
||||
(this.id = options[0]), (this.name = options[1]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ReportsService } from '../reports.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class MixMappingsResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ReportsService} reportsService Reports service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class MixMappingsResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.reportsService.getMixMappings();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ReportsService } from '../reports.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class MixTaxonomyResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ReportsService} reportsService Reports service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class MixTaxonomyResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.reportsService.getMixTaxonomyArray();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ReportsService } from '../reports.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ReportsResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ReportsService} reportsService Reports service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class ReportsResolver implements Resolve<Object> {
|
||||
resolve(): Observable<any> {
|
||||
return this.reportsService.getReports();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { ReportsService } from '../reports.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class RunReportResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {ReportsService} reportsService Reports service.
|
||||
*/
|
||||
@@ -26,5 +25,4 @@ export class RunReportResolver implements Resolve<Object> {
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
return this.reportsService.getReportParams(route.params['name']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ const routes: Routes = [
|
||||
]
|
||||
}
|
||||
])
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -88,4 +89,4 @@ const routes: Routes = [
|
||||
GlAccountsResolver
|
||||
]
|
||||
})
|
||||
export class ReportsRoutingModule { }
|
||||
export class ReportsRoutingModule {}
|
||||
|
||||
@@ -14,13 +14,16 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
styleUrls: ['./reports.component.scss']
|
||||
})
|
||||
export class ReportsComponent implements OnInit {
|
||||
|
||||
/** Reports data. */
|
||||
reportsData: any;
|
||||
/** Report category filter. */
|
||||
filter: string;
|
||||
/** Columns to be displayed in reports table. */
|
||||
displayedColumns: string[] = ['reportName', 'reportType', 'reportCategory'];
|
||||
displayedColumns: string[] = [
|
||||
'reportName',
|
||||
'reportType',
|
||||
'reportCategory'
|
||||
];
|
||||
/** Data source for reports table. */
|
||||
dataSource = new MatTableDataSource();
|
||||
|
||||
@@ -35,10 +38,12 @@ export class ReportsComponent implements OnInit {
|
||||
* Prevents reuse of route parameter `filter`.
|
||||
* @param {Router} router: Router.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
) {
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.route.data.subscribe(( data: { reports: any }) => {
|
||||
this.route.data.subscribe((data: { reports: any }) => {
|
||||
this.reportsData = data.reports;
|
||||
});
|
||||
this.filter = this.route.snapshot.params['filter'];
|
||||
@@ -58,8 +63,8 @@ export class ReportsComponent implements OnInit {
|
||||
*/
|
||||
applyFilter(filterValue: string) {
|
||||
if (filterValue.length) {
|
||||
this.setCustomFilterPredicate();
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
this.setCustomFilterPredicate();
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
} else {
|
||||
this.filterReportsByCategory();
|
||||
}
|
||||
@@ -89,22 +94,23 @@ export class ReportsComponent implements OnInit {
|
||||
*/
|
||||
setCustomFilterPredicate() {
|
||||
this.dataSource.filterPredicate = (data: any, filter: string) => {
|
||||
/** Transform the data into a lowercase string of all property values. */
|
||||
const dataStr = Object.keys(data).reduce(function (currentTerm: string, key: string) {
|
||||
/** Use an obscure Unicode character to delimit the words in the concatenated string.
|
||||
* This avoids matches where the values of two columns combined will match the user's query
|
||||
*/
|
||||
return currentTerm + ((/** @type {any} */ (data)))[key] + '◬';
|
||||
}, '').toLowerCase();
|
||||
/** Transform the filter by converting it to lowercase and removing whitespace. */
|
||||
const transformedFilter = filter.trim().toLowerCase();
|
||||
/* Seperates filter for All reports page.*/
|
||||
if (this.filter) {
|
||||
return dataStr.indexOf(transformedFilter) !== -1 && data.reportCategory === this.filter;
|
||||
} else {
|
||||
return dataStr.indexOf(transformedFilter) !== -1;
|
||||
}
|
||||
/** Transform the data into a lowercase string of all property values. */
|
||||
const dataStr = Object.keys(data)
|
||||
.reduce(function (currentTerm: string, key: string) {
|
||||
/** Use an obscure Unicode character to delimit the words in the concatenated string.
|
||||
* This avoids matches where the values of two columns combined will match the user's query
|
||||
*/
|
||||
return currentTerm + /** @type {any} */ data[key] + '◬';
|
||||
}, '')
|
||||
.toLowerCase();
|
||||
/** Transform the filter by converting it to lowercase and removing whitespace. */
|
||||
const transformedFilter = filter.trim().toLowerCase();
|
||||
/* Seperates filter for All reports page.*/
|
||||
if (this.filter) {
|
||||
return dataStr.indexOf(transformedFilter) !== -1 && data.reportCategory === this.filter;
|
||||
} else {
|
||||
return dataStr.indexOf(transformedFilter) !== -1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,6 @@ import { XBRLReportComponent } from './xbrl-report/xbrl-report.component';
|
||||
XBRLComponent,
|
||||
XBRLReportComponent
|
||||
],
|
||||
providers: [ DecimalPipe ]
|
||||
providers: [DecimalPipe]
|
||||
})
|
||||
export class ReportsModule { }
|
||||
export class ReportsModule {}
|
||||
|
||||
@@ -18,11 +18,10 @@ import { ChartData } from './common-models/chart-data.model';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ReportsService {
|
||||
|
||||
/**
|
||||
* @param {HttpClient} http Http Client to send requests.
|
||||
*/
|
||||
constructor(private http: HttpClient) { }
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Reports data
|
||||
@@ -58,9 +57,7 @@ export class ReportsService {
|
||||
* @returns {Observable<any>} Mix Report
|
||||
*/
|
||||
getMixReport(dates: any): Observable<any> {
|
||||
const httpParams = new HttpParams()
|
||||
.set('startDate', dates.startDate)
|
||||
.set('endDate', dates.endDate);
|
||||
const httpParams = new HttpParams().set('startDate', dates.startDate).set('endDate', dates.endDate);
|
||||
return this.http.get('/mixreport', { params: httpParams, responseType: 'text' });
|
||||
}
|
||||
|
||||
@@ -69,11 +66,10 @@ export class ReportsService {
|
||||
* @returns {Observable<ReportParameter[]>}
|
||||
*/
|
||||
getReportParams(reportName: string): Observable<ReportParameter[]> {
|
||||
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)) ));
|
||||
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))));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,8 +78,9 @@ export class ReportsService {
|
||||
*/
|
||||
getSelectOptions(inputString: string): Observable<SelectOption[]> {
|
||||
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)) ));
|
||||
return this.http
|
||||
.get(`/runreports/${inputString}`, { params: httpParams })
|
||||
.pipe(map((response: any) => response.data.map((entry: any) => new SelectOption(entry.row))));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,7 +89,8 @@ export class ReportsService {
|
||||
*/
|
||||
getPentahoParams(reportId: number): Observable<any> {
|
||||
const httpParams = new HttpParams().set('fields', 'reportParameters');
|
||||
return this.http.get(`/reports/${reportId}`, {params: httpParams})
|
||||
return this.http
|
||||
.get(`/reports/${reportId}`, { params: httpParams })
|
||||
.pipe(map((response: any) => response.reportParameters));
|
||||
}
|
||||
|
||||
@@ -104,10 +102,13 @@ export class ReportsService {
|
||||
*/
|
||||
getRunReportData(reportName: string, formData: object): Observable<any> {
|
||||
let httpParams = new HttpParams();
|
||||
for (const [key, value] of Object.entries(formData)) {
|
||||
for (const [
|
||||
key,
|
||||
value
|
||||
] of Object.entries(formData)) {
|
||||
httpParams = httpParams.set(key, value);
|
||||
}
|
||||
return this.http.get(`/runreports/${reportName}`, {params: httpParams});
|
||||
return this.http.get(`/runreports/${reportName}`, { params: httpParams });
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,11 +119,15 @@ export class ReportsService {
|
||||
*/
|
||||
getChartRunReportData(reportName: string, formData: object): Observable<ChartData> {
|
||||
let httpParams = new HttpParams();
|
||||
for (const [key, value] of Object.entries(formData)) {
|
||||
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)));
|
||||
return this.http
|
||||
.get(`/runreports/${reportName}`, { params: httpParams })
|
||||
.pipe(map((response: any) => new ChartData(response)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,15 +136,27 @@ export class ReportsService {
|
||||
* @param {object} formData Form Data.
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
getPentahoRunReportData(reportName: string, formData: object, tenantIdentifier: string, locale: string, dateFormat: string): Observable<any> {
|
||||
getPentahoRunReportData(
|
||||
reportName: string,
|
||||
formData: object,
|
||||
tenantIdentifier: string,
|
||||
locale: string,
|
||||
dateFormat: string
|
||||
): Observable<any> {
|
||||
let httpParams = new HttpParams()
|
||||
.set('tenantIdentifier', tenantIdentifier)
|
||||
.set('locale', locale)
|
||||
.set('dateFormat', dateFormat);
|
||||
for (const [key, value] of Object.entries(formData)) {
|
||||
.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});
|
||||
return this.http.get(`/runreports/${reportName}`, {
|
||||
responseType: 'arraybuffer',
|
||||
observe: 'response',
|
||||
params: httpParams
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ChartComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ChartComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ChartComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -16,10 +16,9 @@ import Chart from 'chart.js';
|
||||
@Component({
|
||||
selector: 'mifosx-chart',
|
||||
templateUrl: './chart.component.html',
|
||||
styleUrls: ['./chart.component.scss' ]
|
||||
styleUrls: ['./chart.component.scss']
|
||||
})
|
||||
export class ChartComponent implements OnChanges {
|
||||
|
||||
/** Run Report Data */
|
||||
@Input() dataObject: any;
|
||||
|
||||
@@ -33,7 +32,7 @@ export class ChartComponent implements OnChanges {
|
||||
/**
|
||||
* @param {ReportsService} reportsService Reports Service
|
||||
*/
|
||||
constructor(private reportsService: ReportsService) { }
|
||||
constructor(private reportsService: ReportsService) {}
|
||||
|
||||
/**
|
||||
* Fetches run report data post changes in run report form.
|
||||
@@ -43,12 +42,13 @@ export class ChartComponent implements OnChanges {
|
||||
}
|
||||
|
||||
getRunReportData() {
|
||||
this.reportsService.getChartRunReportData(this.dataObject.report.name, this.dataObject.formData)
|
||||
.subscribe((response: ChartData) => {
|
||||
this.inputData = response;
|
||||
this.setPieChart(this.inputData);
|
||||
this.hideOutput = false;
|
||||
});
|
||||
this.reportsService
|
||||
.getChartRunReportData(this.dataObject.report.name, this.dataObject.formData)
|
||||
.subscribe((response: ChartData) => {
|
||||
this.inputData = response;
|
||||
this.setPieChart(this.inputData);
|
||||
this.hideOutput = false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,12 +62,14 @@ export class ChartComponent implements OnChanges {
|
||||
this.chart = new Chart('output', {
|
||||
type: 'pie',
|
||||
data: {
|
||||
labels: inputData.keys,
|
||||
datasets: [{
|
||||
label: inputData.valuesLabel,
|
||||
data: inputData.values,
|
||||
backgroundColor: this.randomColorArray(inputData.values.length)
|
||||
}]
|
||||
labels: inputData.keys,
|
||||
datasets: [
|
||||
{
|
||||
label: inputData.valuesLabel,
|
||||
data: inputData.values,
|
||||
backgroundColor: this.randomColorArray(inputData.values.length)
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
title: {
|
||||
@@ -90,24 +92,28 @@ export class ChartComponent implements OnChanges {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: inputData.keys,
|
||||
datasets: [{
|
||||
datasets: [
|
||||
{
|
||||
label: inputData.valuesLabel,
|
||||
data: inputData.values,
|
||||
backgroundColor: this.randomColorArray(inputData.values.length)
|
||||
}]
|
||||
}
|
||||
]
|
||||
},
|
||||
options: {
|
||||
legend: { display: false },
|
||||
scales: {
|
||||
xAxes: [{
|
||||
scaleLabel: {
|
||||
display: true,
|
||||
labelString: inputData.keysLabel
|
||||
},
|
||||
ticks: {
|
||||
beginAtZero: true
|
||||
xAxes: [
|
||||
{
|
||||
scaleLabel: {
|
||||
display: true,
|
||||
labelString: inputData.keysLabel
|
||||
},
|
||||
ticks: {
|
||||
beginAtZero: true
|
||||
}
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -135,5 +141,4 @@ export class ChartComponent implements OnChanges {
|
||||
const b = Math.floor(Math.random() * 255);
|
||||
return `rgb(${r},${g},${b},0.6)`;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('PentahoComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ PentahoComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [PentahoComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -16,7 +16,6 @@ import { ProgressBarService } from 'app/core/progress-bar/progress-bar.service';
|
||||
styleUrls: ['./pentaho.component.scss']
|
||||
})
|
||||
export class PentahoComponent implements OnChanges {
|
||||
|
||||
/** Run Report Data */
|
||||
@Input() dataObject: any;
|
||||
|
||||
@@ -30,10 +29,12 @@ export class PentahoComponent implements OnChanges {
|
||||
* @param {ReportsService} reportsService Reports Service
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private sanitizer: DomSanitizer,
|
||||
private reportsService: ReportsService,
|
||||
private settingsService: SettingsService,
|
||||
private progressBarService: ProgressBarService) { }
|
||||
constructor(
|
||||
private sanitizer: DomSanitizer,
|
||||
private reportsService: ReportsService,
|
||||
private settingsService: SettingsService,
|
||||
private progressBarService: ProgressBarService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Fetches run report data post changes in run report form.
|
||||
@@ -44,15 +45,21 @@ export class PentahoComponent implements OnChanges {
|
||||
}
|
||||
|
||||
getRunReportData() {
|
||||
this.reportsService.getPentahoRunReportData(this.dataObject.report.name, this.dataObject.formData, 'default', this.settingsService.language.code, this.settingsService.dateFormat)
|
||||
.subscribe( (res: any) => {
|
||||
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});
|
||||
const file = new Blob([res.body], { type: contentType });
|
||||
const filecontent = URL.createObjectURL(file);
|
||||
this.pentahoUrl = this.sanitizer.bypassSecurityTrustResourceUrl(filecontent);
|
||||
this.hideOutput = false;
|
||||
this.progressBarService.decrease();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('RunReportComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ RunReportComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [RunReportComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -25,7 +25,6 @@ import { AlertService } from 'app/core/alert/alert.service';
|
||||
styleUrls: ['./run-report.component.scss']
|
||||
})
|
||||
export class RunReportComponent implements OnInit {
|
||||
|
||||
/** Minimum date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum date allowed. */
|
||||
@@ -51,9 +50,9 @@ export class RunReportComponent implements OnInit {
|
||||
isCollapsed = false;
|
||||
/** Toggles Table output. */
|
||||
hideTable = true;
|
||||
/** Toggles Chart output */
|
||||
/** Toggles Chart output */
|
||||
hideChart = true;
|
||||
/** Toggles Pentaho output */
|
||||
/** Toggles Pentaho output */
|
||||
hidePentaho = true;
|
||||
/** Report uses dates */
|
||||
reportUsesDates = false;
|
||||
@@ -71,17 +70,19 @@ export class RunReportComponent implements OnInit {
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
* @param {Dates} dateUtils Date Utils
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private reportsService: ReportsService,
|
||||
private settingsService: SettingsService,
|
||||
private alertService: AlertService,
|
||||
private dateUtils: Dates) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private reportsService: ReportsService,
|
||||
private settingsService: SettingsService,
|
||||
private alertService: AlertService,
|
||||
private dateUtils: Dates
|
||||
) {
|
||||
this.report.name = this.route.snapshot.params['name'];
|
||||
this.route.queryParams.subscribe((queryParams: { type: any, id: any }) => {
|
||||
this.route.queryParams.subscribe((queryParams: { type: any; id: any }) => {
|
||||
this.report.type = queryParams.type;
|
||||
this.report.id = queryParams.id;
|
||||
});
|
||||
this.route.data.subscribe((data: { reportParameters: ReportParameter[], configurations: any }) => {
|
||||
this.route.data.subscribe((data: { reportParameters: ReportParameter[]; configurations: any }) => {
|
||||
this.paramData = data.reportParameters;
|
||||
if (this.isTableReport()) {
|
||||
data.configurations.globalConfiguration.forEach((config: GlobalConfiguration) => {
|
||||
@@ -95,11 +96,11 @@ export class RunReportComponent implements OnInit {
|
||||
}
|
||||
|
||||
isTableReport(): boolean {
|
||||
return (this.report.type === 'Table');
|
||||
return this.report.type === 'Table';
|
||||
}
|
||||
|
||||
isPentahoReport(): boolean {
|
||||
return (this.report.type === 'Pentaho');
|
||||
return this.report.type === 'Pentaho';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,30 +116,30 @@ export class RunReportComponent implements OnInit {
|
||||
* Fetches dropdown options and builds child dependencies.
|
||||
*/
|
||||
createRunReportForm() {
|
||||
this.paramData.forEach(
|
||||
(param: ReportParameter) => {
|
||||
if (!param.parentParameterName) { // Non Child Parameter
|
||||
this.reportForm.addControl(param.name, new UntypedFormControl('', Validators.required));
|
||||
if (param.displayType === 'select') {
|
||||
this.fetchSelectOptions(param, param.name);
|
||||
}
|
||||
} else { // Child Parameter
|
||||
const parent: ReportParameter = this.paramData
|
||||
.find((entry: any) => entry.name === param.parentParameterName);
|
||||
if (parent != null) {
|
||||
parent.childParameters.push(param);
|
||||
this.updateParentParameters(parent);
|
||||
}
|
||||
this.paramData.forEach((param: ReportParameter) => {
|
||||
if (!param.parentParameterName) {
|
||||
// Non Child Parameter
|
||||
this.reportForm.addControl(param.name, new UntypedFormControl('', Validators.required));
|
||||
if (param.displayType === 'select') {
|
||||
this.fetchSelectOptions(param, param.name);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// Child Parameter
|
||||
const parent: ReportParameter = this.paramData.find((entry: any) => entry.name === param.parentParameterName);
|
||||
if (parent != null) {
|
||||
parent.childParameters.push(param);
|
||||
this.updateParentParameters(parent);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (this.isPentahoReport()) {
|
||||
this.reportForm.addControl('outputType', new UntypedFormControl('', Validators.required));
|
||||
this.outputTypeOptions = [
|
||||
{ 'name': 'PDF format', 'value': 'PDF' },
|
||||
{ 'name': 'Normal format', 'value': 'HTML' },
|
||||
{ 'name': 'Excel format', 'value': 'XLS' },
|
||||
{ 'name': 'Excel 2007 format', 'value': 'XLSX' },
|
||||
{ 'name': 'CSV format', 'value': 'CSV' }
|
||||
{ name: 'PDF format', value: 'PDF' },
|
||||
{ name: 'Normal format', value: 'HTML' },
|
||||
{ name: 'Excel format', value: 'XLS' },
|
||||
{ name: 'Excel 2007 format', value: 'XLSX' },
|
||||
{ name: 'CSV format', value: 'CSV' }
|
||||
];
|
||||
this.mapPentahoParams();
|
||||
}
|
||||
@@ -154,10 +155,12 @@ export class RunReportComponent implements OnInit {
|
||||
* @param {ReportParameter} parent Parent report parameter
|
||||
*/
|
||||
updateParentParameters(parent: ReportParameter) {
|
||||
const parentNames = this.parentParameters.map(parameter => parameter.name);
|
||||
if (!parentNames.includes(parent.name)) { // Parent's first child.
|
||||
const parentNames = this.parentParameters.map((parameter) => parameter.name);
|
||||
if (!parentNames.includes(parent.name)) {
|
||||
// Parent's first child.
|
||||
this.parentParameters.push(parent);
|
||||
} else { // Parent already has a child
|
||||
} else {
|
||||
// Parent already has a child
|
||||
const index = parentNames.indexOf(parent.name);
|
||||
this.parentParameters[index] = parent;
|
||||
}
|
||||
@@ -169,8 +172,7 @@ export class RunReportComponent implements OnInit {
|
||||
mapPentahoParams() {
|
||||
this.reportsService.getPentahoParams(this.report.id).subscribe((data: any) => {
|
||||
data.forEach((entry: any) => {
|
||||
const param: ReportParameter = this.paramData
|
||||
.find((_entry: any) => _entry.name === entry.parameterName);
|
||||
const param: ReportParameter = this.paramData.find((_entry: any) => _entry.name === entry.parameterName);
|
||||
param.pentahoName = `R_${entry.reportParameterName}`;
|
||||
});
|
||||
});
|
||||
@@ -206,7 +208,7 @@ export class RunReportComponent implements OnInit {
|
||||
this.reportsService.getSelectOptions(inputstring).subscribe((options: SelectOption[]) => {
|
||||
param.selectOptions = options;
|
||||
if (param.selectAll === 'Y') {
|
||||
param.selectOptions.push({id: '-1', name: 'All'});
|
||||
param.selectOptions.push({ id: '-1', name: 'All' });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -219,7 +221,10 @@ export class RunReportComponent implements OnInit {
|
||||
const formattedResponse: any = {};
|
||||
let newKey: string;
|
||||
this.reportToBeExportedInRepository = false;
|
||||
for (const [key, value] of Object.entries(response)) {
|
||||
for (const [
|
||||
key,
|
||||
value
|
||||
] of Object.entries(response)) {
|
||||
if (key === 'outputType') {
|
||||
formattedResponse['output-type'] = value;
|
||||
continue;
|
||||
@@ -228,8 +233,7 @@ export class RunReportComponent implements OnInit {
|
||||
continue;
|
||||
}
|
||||
|
||||
const param: ReportParameter = this.paramData
|
||||
.find((_entry: any) => _entry.name === key);
|
||||
const param: ReportParameter = this.paramData.find((_entry: any) => _entry.name === key);
|
||||
newKey = this.isPentahoReport() ? param.pentahoName : param.inputName;
|
||||
switch (param.displayType) {
|
||||
case 'text':
|
||||
@@ -261,7 +265,7 @@ export class RunReportComponent implements OnInit {
|
||||
this.isCollapsed = true;
|
||||
const userResponseValues = this.formatUserResponse(this.reportForm.value);
|
||||
let formData = {
|
||||
...userResponseValues,
|
||||
...userResponseValues
|
||||
};
|
||||
if (this.reportUsesDates) {
|
||||
let dateFormat = this.settingsService.dateFormat;
|
||||
@@ -286,13 +290,13 @@ export class RunReportComponent implements OnInit {
|
||||
case 'SMS':
|
||||
case 'Table':
|
||||
this.hideTable = false;
|
||||
break;
|
||||
break;
|
||||
case 'Chart':
|
||||
this.hideChart = false;
|
||||
break;
|
||||
break;
|
||||
case 'Pentaho':
|
||||
this.hidePentaho = false;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -304,13 +308,12 @@ export class RunReportComponent implements OnInit {
|
||||
const reportName = this.report.name;
|
||||
const payload = {
|
||||
...userResponseValues,
|
||||
decimalChoice: this.decimalChoice.value,
|
||||
decimalChoice: this.decimalChoice.value
|
||||
// exportCSV: true
|
||||
};
|
||||
this.reportsService.getRunReportData(reportName, payload)
|
||||
.subscribe( (res: any) => {
|
||||
this.reportsService.getRunReportData(reportName, payload).subscribe((res: any) => {
|
||||
if (res.data.length > 0) {
|
||||
this.alertService.alert({type: 'Report generation', message: `Report: ${reportName} data generated`});
|
||||
this.alertService.alert({ type: 'Report generation', message: `Report: ${reportName} data generated` });
|
||||
|
||||
const displayedColumns: string[] = [];
|
||||
res.columnHeaders.forEach((header: any) => {
|
||||
@@ -319,7 +322,7 @@ export class RunReportComponent implements OnInit {
|
||||
|
||||
this.exportToXLS(reportName, res.data, displayedColumns);
|
||||
} else {
|
||||
this.alertService.alert({type: 'Report generation', message: `Report: ${reportName} without data generated`});
|
||||
this.alertService.alert({ type: 'Report generation', message: `Report: ${reportName} without data generated` });
|
||||
}
|
||||
this.isProcessing = false;
|
||||
});
|
||||
@@ -334,10 +337,9 @@ export class RunReportComponent implements OnInit {
|
||||
}
|
||||
return row;
|
||||
});
|
||||
const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(data, {header: displayedColumns});
|
||||
const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(data, { header: displayedColumns });
|
||||
const wb: XLSX.WorkBook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(wb, ws, 'report');
|
||||
XLSX.writeFile(wb, fileName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('TableAndSmsComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ TableAndSmsComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [TableAndSmsComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -25,7 +25,6 @@ import * as XLSX from 'xlsx';
|
||||
styleUrls: ['./table-and-sms.component.scss']
|
||||
})
|
||||
export class TableAndSmsComponent implements OnChanges {
|
||||
|
||||
/** Run Report Data */
|
||||
@Input() dataObject: any;
|
||||
|
||||
@@ -49,10 +48,12 @@ export class TableAndSmsComponent implements OnChanges {
|
||||
* @param {ReportsService} reportsService Reports Service
|
||||
* @param {DecimalPipe} decimalPipe Decimal Pipe
|
||||
*/
|
||||
constructor(private reportsService: ReportsService,
|
||||
public dialog: MatDialog,
|
||||
private decimalPipe: DecimalPipe,
|
||||
private progressBarService: ProgressBarService) { }
|
||||
constructor(
|
||||
private reportsService: ReportsService,
|
||||
public dialog: MatDialog,
|
||||
private decimalPipe: DecimalPipe,
|
||||
private progressBarService: ProgressBarService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Fetches run report data post changes in run report form.
|
||||
@@ -66,21 +67,22 @@ export class TableAndSmsComponent implements OnChanges {
|
||||
|
||||
getRunReportData() {
|
||||
const exportS3 = this.dataObject.formData.exportS3;
|
||||
this.reportsService.getRunReportData(this.dataObject.report.name, this.dataObject.formData)
|
||||
.subscribe( (res: any) => {
|
||||
this.toBeExportedToRepo = exportS3;
|
||||
if (!this.toBeExportedToRepo) {
|
||||
this.csvData = res.data;
|
||||
this.notExistsReportData = (res.data.length === 0);
|
||||
this.setOutputTable(res.data);
|
||||
res.columnHeaders.forEach((header: any) => {
|
||||
this.columnTypes.push(header.columnDisplayType);
|
||||
this.displayedColumns.push(header.columnName);
|
||||
});
|
||||
}
|
||||
this.hideOutput = false;
|
||||
this.progressBarService.decrease();
|
||||
});
|
||||
this.reportsService
|
||||
.getRunReportData(this.dataObject.report.name, this.dataObject.formData)
|
||||
.subscribe((res: any) => {
|
||||
this.toBeExportedToRepo = exportS3;
|
||||
if (!this.toBeExportedToRepo) {
|
||||
this.csvData = res.data;
|
||||
this.notExistsReportData = res.data.length === 0;
|
||||
this.setOutputTable(res.data);
|
||||
res.columnHeaders.forEach((header: any) => {
|
||||
this.columnTypes.push(header.columnDisplayType);
|
||||
this.displayedColumns.push(header.columnName);
|
||||
});
|
||||
}
|
||||
this.hideOutput = false;
|
||||
this.progressBarService.decrease();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,11 +101,11 @@ export class TableAndSmsComponent implements OnChanges {
|
||||
*/
|
||||
exportFile() {
|
||||
const delimiterOptions: any[] = [
|
||||
{name: 'Comma (,)', char: ','},
|
||||
{name: 'Colon (:)', char: ':'},
|
||||
{name: 'SemiColon (;)', char: ';'},
|
||||
{name: 'Pipe (|)', char: '|'},
|
||||
{name: 'Space ( )', char: ' '},
|
||||
{ name: 'Comma (,)', char: ',' },
|
||||
{ name: 'Colon (:)', char: ':' },
|
||||
{ name: 'SemiColon (;)', char: ';' },
|
||||
{ name: 'Pipe (|)', char: '|' },
|
||||
{ name: 'Space ( )', char: ' ' }
|
||||
];
|
||||
const fileName = `${this.dataObject.report.name}.csv`;
|
||||
const formfields: FormfieldBase[] = [
|
||||
@@ -123,6 +125,7 @@ export class TableAndSmsComponent implements OnChanges {
|
||||
required: true,
|
||||
order: 2
|
||||
})
|
||||
|
||||
];
|
||||
const data = {
|
||||
title: 'Export data to File',
|
||||
@@ -146,7 +149,7 @@ export class TableAndSmsComponent implements OnChanges {
|
||||
}
|
||||
return row;
|
||||
});
|
||||
const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(data, {header: this.displayedColumns});
|
||||
const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(data, { header: this.displayedColumns });
|
||||
const wb: XLSX.WorkBook = XLSX.utils.book_new();
|
||||
XLSX.utils.book_append_sheet(wb, ws, 'Report');
|
||||
XLSX.writeFile(wb, fileName);
|
||||
@@ -184,5 +187,4 @@ export class TableAndSmsComponent implements OnChanges {
|
||||
isDecimal(index: number) {
|
||||
return this.columnTypes[index] === 'DECIMAL';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('XBRLReportComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ XBRLReportComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [XBRLReportComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, UntypedFormControl} from '@angular/forms';
|
||||
import { UntypedFormGroup, UntypedFormBuilder, Validators, UntypedFormControl } from '@angular/forms';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
@@ -18,7 +18,6 @@ import { Dates } from 'app/core/utils/dates';
|
||||
styleUrls: ['./xbrl-report.component.scss']
|
||||
})
|
||||
export class XBRLReportComponent implements OnInit {
|
||||
|
||||
/** Minimum Due Date allowed. */
|
||||
minDate = new Date(2000, 0, 1);
|
||||
/** Maximum Due Date allowed. */
|
||||
@@ -34,7 +33,11 @@ export class XBRLReportComponent implements OnInit {
|
||||
/** Trusted url resource for xml download */
|
||||
fileUrl: any;
|
||||
/** Columns to be displayed in XBRL reports table */
|
||||
displayedColumns: string[] = ['name', 'dimension', 'value'];
|
||||
displayedColumns: string[] = [
|
||||
'name',
|
||||
'dimension',
|
||||
'value'
|
||||
];
|
||||
/** Data source for XBRL reports table */
|
||||
dataSource = new MatTableDataSource();
|
||||
|
||||
@@ -44,15 +47,17 @@ export class XBRLReportComponent implements OnInit {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private reportService: ReportsService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private sanitizer: DomSanitizer) {}
|
||||
constructor(
|
||||
private reportService: ReportsService,
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private settingsService: SettingsService,
|
||||
private dateUtils: Dates,
|
||||
private sanitizer: DomSanitizer
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Creates the XBRL form.
|
||||
*/
|
||||
/**
|
||||
* Creates the XBRL form.
|
||||
*/
|
||||
ngOnInit() {
|
||||
this.maxDate = this.settingsService.businessDate;
|
||||
this.createXbrlForm();
|
||||
@@ -60,8 +65,14 @@ export class XBRLReportComponent implements OnInit {
|
||||
|
||||
createXbrlForm() {
|
||||
this.xbrlForm = this.formBuilder.group({
|
||||
'startDate': ['', Validators.required],
|
||||
'endDate': ['', Validators.required],
|
||||
startDate: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
endDate: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -72,7 +83,7 @@ export class XBRLReportComponent implements OnInit {
|
||||
buildXMLTable(response: any) {
|
||||
const parser = new DOMParser();
|
||||
const xml = parser.parseFromString(response, 'text/xml');
|
||||
xml.querySelectorAll('[contextRef]').forEach( (element: HTMLElement) => {
|
||||
xml.querySelectorAll('[contextRef]').forEach((element: HTMLElement) => {
|
||||
const contextId = element.getAttribute('contextRef');
|
||||
const scenario = xml.querySelector(`#${contextId}`).querySelector('scenario');
|
||||
const context = scenario ? scenario.textContent : undefined;
|
||||
@@ -113,8 +124,8 @@ export class XBRLReportComponent implements OnInit {
|
||||
submit() {
|
||||
const parser = new DOMParser();
|
||||
const xmlDOM = parser.parseFromString(this.rawXml, 'text/xml');
|
||||
xmlDOM.querySelectorAll('[contextRef]').forEach( (element: HTMLElement) => {
|
||||
this.xmlData.forEach( (entry: any) => {
|
||||
xmlDOM.querySelectorAll('[contextRef]').forEach((element: HTMLElement) => {
|
||||
this.xmlData.forEach((entry: any) => {
|
||||
if (entry.name === element.tagName) {
|
||||
element.textContent = entry.value.value;
|
||||
}
|
||||
@@ -126,6 +137,4 @@ export class XBRLReportComponent implements OnInit {
|
||||
this.fileUrl = this.sanitizer.bypassSecurityTrustResourceUrl(window.URL.createObjectURL(blob));
|
||||
return this.fileUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('XBRLComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ XBRLComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [XBRLComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -16,7 +16,6 @@ import { ReportsService } from '../reports.service';
|
||||
styleUrls: ['./xbrl.component.scss']
|
||||
})
|
||||
export class XBRLComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Mix Taxonomy Array */
|
||||
mixtaxonomyArray: any = [];
|
||||
/** Mix Mappings */
|
||||
@@ -26,7 +25,12 @@ export class XBRLComponent implements OnInit, AfterViewInit {
|
||||
/** Filtered GL Accounts */
|
||||
filteredGlAccounts: any;
|
||||
/** Columns to be displayed in reports table. */
|
||||
displayedColumns: string[] = ['info', 'name', 'dimension', 'mapping'];
|
||||
displayedColumns: string[] = [
|
||||
'info',
|
||||
'name',
|
||||
'dimension',
|
||||
'mapping'
|
||||
];
|
||||
/** Data source for reports table. */
|
||||
dataSource = new MatTableDataSource();
|
||||
/** XBRL save status */
|
||||
@@ -39,10 +43,12 @@ export class XBRLComponent implements OnInit, AfterViewInit {
|
||||
* @param {Router} router: Route.
|
||||
* @param {ReportService} reportService ReportService
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private reportService: ReportsService) {
|
||||
this.route.data.subscribe(( data: { mixtaxonomy: any, mixmapping: any, glAccounts: any }) => {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private reportService: ReportsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { mixtaxonomy: any; mixmapping: any; glAccounts: any }) => {
|
||||
this.mixtaxonomyArray = data.mixtaxonomy;
|
||||
this.mixMappingJson = data.mixmapping.config || JSON.stringify({});
|
||||
this.glAccounts = data.glAccounts;
|
||||
@@ -56,19 +62,21 @@ export class XBRLComponent implements OnInit, AfterViewInit {
|
||||
if (localStorage.getItem('XbrlReportSaveSuccess')) {
|
||||
localStorage.removeItem('XbrlReportSaveSuccess');
|
||||
this.XBRLSuccess = true;
|
||||
setTimeout(() => { this.XBRLSuccess = false; }, 3000);
|
||||
setTimeout(() => {
|
||||
this.XBRLSuccess = false;
|
||||
}, 3000);
|
||||
}
|
||||
this.createMappings();
|
||||
this.dataSource = new MatTableDataSource(this.mixtaxonomyArray);
|
||||
this.setDatasourceFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe to taxonomy's value changes and filters options accordingly.
|
||||
*/
|
||||
/**
|
||||
* Subscribe to taxonomy's value changes and filters options accordingly.
|
||||
*/
|
||||
ngAfterViewInit() {
|
||||
this.mixtaxonomyArray.forEach((taxonomy: any) => {
|
||||
taxonomy.mapping?.valueChanges.subscribe( (value: string) => {
|
||||
taxonomy.mapping?.valueChanges.subscribe((value: string) => {
|
||||
this.filteredGlAccounts = this.applyFilter(value);
|
||||
});
|
||||
});
|
||||
@@ -80,8 +88,8 @@ export class XBRLComponent implements OnInit, AfterViewInit {
|
||||
createMappings() {
|
||||
this.mixtaxonomyArray.forEach((taxonomy: any) => {
|
||||
const mapping = JSON.parse(this.mixMappingJson)[taxonomy.id];
|
||||
taxonomy.mapping = new UntypedFormControl('');
|
||||
taxonomy.mapping.value = mapping || '';
|
||||
taxonomy.mapping = new UntypedFormControl('');
|
||||
taxonomy.mapping.value = mapping || '';
|
||||
});
|
||||
}
|
||||
|
||||
@@ -120,8 +128,8 @@ export class XBRLComponent implements OnInit, AfterViewInit {
|
||||
* @returns {string} Gl Account name if valid otherwise undefined.
|
||||
*/
|
||||
displayGLAccount(glAccount?: any): string | undefined {
|
||||
if (typeof(glAccount) === 'object') {
|
||||
return glAccount ? glAccount.name + ' (' + glAccount.glCode + ')' : undefined;
|
||||
if (typeof glAccount === 'object') {
|
||||
return glAccount ? glAccount.name + ' (' + glAccount.glCode + ')' : undefined;
|
||||
} else {
|
||||
return glAccount;
|
||||
}
|
||||
@@ -142,7 +150,7 @@ export class XBRLComponent implements OnInit, AfterViewInit {
|
||||
submit() {
|
||||
const config: any = {};
|
||||
const serialObject: any = {};
|
||||
this.mixtaxonomyArray.forEach( (taxonomy: any) => {
|
||||
this.mixtaxonomyArray.forEach((taxonomy: any) => {
|
||||
config[taxonomy.id] = taxonomy.mapping.value;
|
||||
});
|
||||
serialObject['config'] = JSON.stringify(config);
|
||||
@@ -152,5 +160,4 @@ export class XBRLComponent implements OnInit, AfterViewInit {
|
||||
this.reloadComponent();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user