summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/run-report-form-fields.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/run-report-form-fields.component.ts')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/run-report-form-fields.component.ts290
1 files changed, 284 insertions, 6 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/run-report-form-fields.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/run-report-form-fields.component.ts
index ced812d2..a7b21de2 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/run-report-form-fields.component.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/report-run/run/run-report-form-fields/run-report-form-fields.component.ts
@@ -11,7 +11,7 @@ import {HttpCacheService} from '../../../shared/services/cache.service';
styleUrls: ['./run-report-form-fields.component.css']
})
export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
- @Input('formFieldList') formFieldList: {}[];
+ @Input('formFieldList') formFieldList: any;
@Input('reportId') reportId: string;
staticFormFieldList: {}[] = [];
formFieldListValueArr: any[];
@@ -29,7 +29,7 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
triggerFormFieldArr = [];
initialObject = {};
formFieldGroupObjList: {}[] = [];
- toggleFormFieldRenderArr: {}[] = [];
+ toggleFormFieldRenderArr:any;
groupSelectValue = '';
oldGroupSelectValue = '';
unCommonCnt = 0;
@@ -65,6 +65,13 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
downloadPrevReport = '';
timeStampArray: any[];
hoursArray : any[];
+ private orderSeqArray: any;
+ minDate:any;
+ maxDate:any;
+ reportHeader: string;
+ reportFooter: string;
+ reportType: string;
+
constructor(private _runService: RunService,
private _route: ActivatedRoute,
private _router: Router,
@@ -93,6 +100,10 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
this.downloadPrevReport = '';
this.timeStampArray = [];
this.hoursArray = [];
+ this.orderSeqArray = [];
+ this.reportHeader = '';
+ this.reportFooter = '';
+ this.reportType = '';
}
@@ -148,6 +159,11 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
this.chartType = '';
this.showRunButton = false;
this.downloadPrevReport = '';
+ this.minDate = '';
+ this.maxDate = '';
+ this.reportType = '';
+ this.reportHeader='';
+ this.reportFooter='';
}
ngOnInit() {
@@ -158,7 +174,9 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
this.getHours();
this._route.params.subscribe(params => {
this.createNewObject();
+ if(params['reportId'] !== undefined){
this.reportId = params['reportId'];
+ }
const checkOfCache = this.httpCacheService.getPreviousId(this.reportId) || null;
if (!checkOfCache) {
this.httpCacheService.clearCache();
@@ -194,9 +212,13 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
for (const ff of this.actualformFieldValues) {
const formfiledArray = ff.split('=');
const formFieldId = formfiledArray[0];
- const formFieldObj = formfiledArray[1];
+ const formFieldObj = formfiledArray[1].replaceAll('||','/');
this.finalQueryParamsObj[formFieldId] = formFieldObj;
}
+ if(this.directCallQueryParams.includes('NULL')){
+ this.directCallQueryParams = this.directCallQueryParams.replaceAll('NULL','');
+ }
+ this.directCallQueryParams = this.directCallQueryParams.replaceAll('||','/')
this.queryString = this.directCallQueryParams;
}
@@ -206,6 +228,18 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
this.reportName = responseDefPage['reportName'];
this.reportSubTitle = responseDefPage['reportSubTitle'];
this.chartType = responseDefPage['chartType'];
+ this.reportType = responseDefPage['reportType'];
+
+ if (responseDefPage['reportType'] === 'Cross-Tab' || responseDefPage['reportType'] === 'Linear' ) {
+ if(responseDefPage['reportHeader'] !== undefined){
+ this.reportHeader = responseDefPage['reportHeader'];
+ }
+ if(responseDefPage['reportFooter'] !== undefined){
+ this.reportFooter = responseDefPage['reportFooter'];
+ }
+
+ }
+
if (responseDefPage['reportType'] !== 'Dashboard') {
if (this.calledWithFormFields == false) {
this._runService.getReportData(this.reportId)
@@ -249,7 +283,57 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
if (this.finalQueryParamsObj[ff.fieldId]) {
if (ff.validationType == 'DATE') {
const dateVal = this.finalQueryParamsObj[ff.fieldId];
+ dateVal.toString().replace(/%2F/g, '/')
this.formFieldListValueMap.set(ff.fieldId, new Date(dateVal.toString().replace(/%2F/g, '/')));
+ if (ff.rangeStartDate != null) {
+ if (ff.rangeStartDate != '')
+ this.minDate = this.getMinMaxDate(ff.rangeStartDate);
+ else {
+ this.minDate = '';
+ }
+ } else {
+ this.minDate = '';
+ }
+
+ if (ff.rangeEndDate != null) {
+ if (ff.rangeEndDate != '')
+ this.maxDate = this.getMinMaxDate(ff.rangeEndDate);
+ else {
+ this.maxDate = '';
+ }
+ } else {
+ this.maxDate = '';
+ }
+
+ if(this.minDate == '' && this.maxDate ==''){
+
+ if (ff.rangeStartDateSQL != null) {
+ if (ff.rangeStartDateSQL != '')
+ this.minDate = this.getMinMaxDate(ff.rangeStartDateSQL);
+ else {
+ this.minDate = '';
+ }
+ } else {
+ this.minDate = '';
+ }
+
+ if (ff.rangeEndDateSQL != null) {
+ if (ff.rangeEndDateSQL != '')
+ this.maxDate = this.getMinMaxDate(ff.rangeEndDateSQL);
+ else {
+ this.maxDate = '';
+ }
+ } else {
+ this.maxDate = '';
+ }
+
+
+ }
+ this.formFieldListValueMap.set(ff.fieldId+'_minDate', this.minDate);
+ this.formFieldListValueMap.set(ff.fieldId+'_maxDate', this.maxDate);
+
+
+
} else if (ff.fieldType == 'LIST_MULTI_SELECT') {
const multiSelectArray = [];
let multiVal = this.finalQueryParamsObj[ff.fieldId];
@@ -267,7 +351,34 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
multiSelectArray.push(multiVal);
}
this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
- } else {
+ } else if (ff.validationType == 'TIMESTAMP_SEC') {
+ const dateVal = this.finalQueryParamsObj[ff.fieldId];
+ const multiSelectArray = [];
+ multiSelectArray.push(new Date(dateVal.toString().replace(/%2F/g, '/')));
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Min']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Sec']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+
+ }
+ else if (ff.validationType == 'TIMESTAMP_MIN') {
+ const dateVal = this.finalQueryParamsObj[ff.fieldId];
+ const multiSelectArray = [];
+ multiSelectArray.push(new Date(dateVal.toString().replace(/%2F/g, '/')));
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Min']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+ }
+ else if (ff.validationType == 'TIMESTAMP_HOUR') {
+ const dateVal = this.finalQueryParamsObj[ff.fieldId];
+ const multiSelectArray = [];
+ multiSelectArray.push(new Date(dateVal.toString().replace(/%2F/g, '/')));
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+
+ }
+
+ else {
let multiVal = this.finalQueryParamsObj[ff.fieldId];
multiVal = multiVal.toString().replace(/%2F/g, '/');
multiVal = multiVal.toString().replace(/%20/g, ' ');
@@ -280,6 +391,29 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
if (ff.fieldType == 'LIST_MULTI_SELECT') {
const multiSelectArray = [];
this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+ } else if (ff.validationType == 'TIMESTAMP_SEC') {
+
+ const multiSelectArray = [];
+ multiSelectArray.push('');
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Min']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Sec']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+ }
+ else if (ff.validationType == 'TIMESTAMP_MIN') {
+
+ const multiSelectArray = [];
+ multiSelectArray.push('');
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Min']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+ }
+ else if (ff.validationType == 'TIMESTAMP_HOUR') {
+ const multiSelectArray = [];
+ multiSelectArray.push('');
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+
} else {
this.formFieldListValueMap.set(ff.fieldId, '');
}
@@ -399,7 +533,33 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
multiSelectArray.push(multiVal);
}
this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
- } else {
+ } else if (ff.validationType == 'TIMESTAMP_SEC') {
+ const dateVal = this.finalQueryParamsObj[ff.fieldId];
+ const multiSelectArray = [];
+ multiSelectArray.push(new Date(dateVal.toString().replace(/%2F/g, '/')));
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Min']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Sec']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+
+ }
+ else if (ff.validationType == 'TIMESTAMP_MIN') {
+ const dateVal = this.finalQueryParamsObj[ff.fieldId];
+ const multiSelectArray = [];
+ multiSelectArray.push(new Date(dateVal.toString().replace(/%2F/g, '/')));
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Min']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+ }
+ else if (ff.validationType == 'TIMESTAMP_HOUR') {
+ const dateVal = this.finalQueryParamsObj[ff.fieldId];
+ const multiSelectArray = [];
+ multiSelectArray.push(new Date(dateVal.toString().replace(/%2F/g, '/')));
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+
+ }
+ else {
let multiVal = this.finalQueryParamsObj[ff.fieldId];
multiVal = multiVal.toString().replace(/%2F/g, '/');
multiVal = multiVal.toString().replace(/%20/g, ' ');
@@ -416,6 +576,29 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
if (ff.fieldType == 'LIST_MULTI_SELECT') {
const multiSelectArray = [];
this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+ } else if (ff.validationType == 'TIMESTAMP_SEC') {
+
+ const multiSelectArray = [];
+ multiSelectArray.push('');
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Min']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Sec']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+ }
+ else if (ff.validationType == 'TIMESTAMP_MIN') {
+
+ const multiSelectArray = [];
+ multiSelectArray.push('');
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Min']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+ }
+ else if (ff.validationType == 'TIMESTAMP_HOUR') {
+ const multiSelectArray = [];
+ multiSelectArray.push('');
+ multiSelectArray.push(this.finalQueryParamsObj[ff.fieldId + '_Hr']);
+ this.formFieldListValueMap.set(ff.fieldId, multiSelectArray);
+
} else {
this.formFieldListValueMap.set(ff.fieldId, '');
}
@@ -652,6 +835,21 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
}
}
+ let orderSeqArray = [];
+ for (let ff = 0; ff < this.formFieldList.length; ff++) {
+ let val = this.formFieldList[ff]['setOrderBySeq'];
+ orderSeqArray.push(val);
+ }
+
+ if (!(orderSeqArray.includes(null) || orderSeqArray.length !== new Set(orderSeqArray).size)) {
+ this.toggleFormFieldRenderArr = this.toggleFormFieldRenderArr.sort(function (a, b) {
+ if ((a['setOrderBySeq']) === (b['setOrderBySeq'])) {
+ return a;
+ } else {
+ return (a['setOrderBySeq']) - (b['setOrderBySeq']);
+ }
+ });
+ }
}
if (this.firstRun) {
this.saveGroupSelectValue = this.groupSelectValue;
@@ -675,6 +873,13 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
}
}
+ getMinMaxDate(str: any){
+
+ let date = str;
+ let tempDate = new Date(date);
+ return date = new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate());
+ }
+
fetchAndPopulateFormFields(respObj: any, ffReportId: string) {
this._runService.getFormFieldGroupsData(ffReportId)
.subscribe((responseFormFieldGroups) => {
@@ -683,6 +888,22 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
this.formFieldGroupObjList = JSON.parse(responseFormFieldGroups['formFieldGroupsJSON']);
this.saveFormFieldGroups = JSON.parse(responseFormFieldGroups['formFieldGroupsJSON']);
this.formFieldList = respObj['formFieldList'];
+ let orderSeqArray = [];
+ for (let ff = 0; ff < this.formFieldList.length; ff++) {
+ let val = this.formFieldList[ff]['setOrderBySeq'];
+ orderSeqArray.push(val);
+ }
+
+ if (!(orderSeqArray.includes(null) || orderSeqArray.length !== new Set(orderSeqArray).size)) {
+ this.formFieldList = this.formFieldList.sort(function (a, b) {
+ if ((a['setOrderBySeq']) === (b['setOrderBySeq'])) {
+ return a;
+ } else {
+ return (a['setOrderBySeq']) - (b['setOrderBySeq']);
+ }
+ });
+ }
+
if (this.formFieldList.length === 1 && this.formFieldList[0]['visible'] === false) {
this.showRunButton = false;
} else if (this.formFieldList.length > 0) {
@@ -733,7 +954,7 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
for (let i = 0; i < this.formFieldList.length; i++) {
const formFieldObj = this.formFieldList[i];
if (formFieldObj['formFieldValues'] != null && this.calledWithFormFields != true) {
- if ((formFieldObj['validationType'] == 'DATE' && formFieldObj['formFieldValues'].length > 0) || formFieldObj['validationType'] == 'TIMESTAMP_SEC' || formFieldObj['validationType'] == 'TIMESTAMP_MIN' || formFieldObj['validationType'] == 'TIMESTAMP_HOUR') {
+ if (formFieldObj['validationType'] == 'DATE' || formFieldObj['validationType'] == 'TIMESTAMP_SEC' || formFieldObj['validationType'] == 'TIMESTAMP_MIN' || formFieldObj['validationType'] == 'TIMESTAMP_HOUR') {
if (formFieldObj['validationType'] == 'TIMESTAMP_SEC') {
const multiSelectArray = [];
@@ -785,8 +1006,58 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
}
}
else{
+ if(formFieldObj['formFieldValues'].length > 0){
const date = formFieldObj['formFieldValues'][0]['id'];
this.formFieldListValueMap.set(formFieldObj['fieldId'], new Date(date));
+ }else{
+ this.formFieldListValueMap.set(formFieldObj['fieldId'], '');
+ }
+ if (formFieldObj['rangeStartDate'] != null) {
+ if (formFieldObj['rangeStartDate'] != '')
+ this.minDate = this.getMinMaxDate(formFieldObj['rangeStartDate']);
+ else {
+ this.minDate = '';
+ }
+ } else {
+ this.minDate = '';
+ }
+
+ if (formFieldObj['rangeEndDate'] != null) {
+ if (formFieldObj['rangeEndDate'] != '')
+ this.maxDate = this.getMinMaxDate(formFieldObj['rangeEndDate']);
+ else {
+ this.maxDate = '';
+ }
+ } else {
+ this.maxDate = '';
+ }
+
+ if(this.minDate == '' && this.maxDate ==''){
+
+ if (formFieldObj['rangeStartDateSQL'] != null) {
+ if (formFieldObj['rangeStartDateSQL'] != '')
+ this.minDate = this.getMinMaxDate(formFieldObj['rangeStartDateSQL']);
+ else {
+ this.minDate = '';
+ }
+ } else {
+ this.minDate = '';
+ }
+
+ if (formFieldObj['rangeEndDateSQL'] != null) {
+ if (formFieldObj['rangeEndDateSQL'] != '')
+ this.maxDate = this.getMinMaxDate(formFieldObj['rangeEndDateSQL']);
+ else {
+ this.maxDate = '';
+ }
+ } else {
+ this.maxDate = '';
+ }
+
+
+ }
+ this.formFieldListValueMap.set(formFieldObj['fieldId']+'_minDate', this.minDate);
+ this.formFieldListValueMap.set(formFieldObj['fieldId']+'_maxDate', this.maxDate);
}
} else if (formFieldObj['fieldType'] == 'LIST_BOX' && formFieldObj['formFieldValues'].length > 0) {
let isAdded = false;
@@ -943,6 +1214,7 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
}
editReport(reportId: string) {
+ this.httpCacheService.clearCache();
this._router.navigate(['v2/app/reports', 'Edit', reportId]);
}
@@ -1003,12 +1275,18 @@ export class RunReportFormFieldsComponent implements OnInit, OnDestroy {
getTime(){
for(let i=0; i<=59; i++){
+ if(i<=9){
+ this.timeStampArray.push('0'+i)
+ }else
this.timeStampArray.push(i);
}
}
getHours(){
for(let i=0; i<=23; i++){
+ if(i<=9){
+ this.hoursArray.push('0'+i)
+ }else
this.hoursArray.push(i);
}
}