diff --git a/src/GenericDashboard.ts b/src/GenericDashboard.ts index f66b7c4..a2cb0da 100644 --- a/src/GenericDashboard.ts +++ b/src/GenericDashboard.ts @@ -76,7 +76,7 @@ namespace GenericDashboard { labelHistoryData: XRLabelEntry[] = []; - dateRangeData : dateRangeData = { + dateRangeData: dateRangeData = { currentWeekCategoryData: [], currentMonthCategoryData: {}, threeMonthsCategoryData: [], @@ -147,20 +147,50 @@ namespace GenericDashboard { dataSources.forEach(dataSourceConfig => { if (dataSourceConfig.type == "Needles") { let needleSourceCategory; + let needleSourceFieldName; let needleSourceFieldId; dataSourceConfig.sourceAtrributes.forEach(sourceAttribute => { if (sourceAttribute.name == "category") { needleSourceCategory = sourceAttribute.value; - } else if (sourceAttribute.name == "fieldId") { - needleSourceFieldId = sourceAttribute.value; + } else if (sourceAttribute.name == "fieldName") { + needleSourceFieldName = sourceAttribute.value; } }); + needleSourceFieldId = IC.getFieldByName(needleSourceCategory,needleSourceFieldName).id; if (needleSourceCategory && needleSourceFieldId) { - dataSourcePromises.push(Matrix.Labels.getNeedlesByCategoryAndFiledId(needleSourceCategory, + dataSourcePromises.push(Matrix.Labels.getNeedlesByCategoryAndFiledId(dataSourceConfig.id,dataSourceConfig.type,needleSourceCategory, needleSourceFieldId)); } + } else if (dataSourceConfig.type == "NeedlesBySearch") { + + let needleSourceCategory; + let needleSourceFieldName; + let needleSourceFieldId; + dataSourceConfig.sourceAtrributes.forEach(sourceAttribute => { + if (sourceAttribute.name == "category") { + needleSourceCategory = sourceAttribute.value; + } else if (sourceAttribute.name == "fieldName") { + needleSourceFieldName = sourceAttribute.value; + } + }); + needleSourceFieldId = IC.getFieldByName(needleSourceCategory,needleSourceFieldName).id; + if (needleSourceCategory && needleSourceFieldId) { + dataSourcePromises.push(Matrix.Labels.getNeedlesBySearch(dataSourceConfig.id,dataSourceConfig.type,needleSourceCategory, + needleSourceFieldId)); + } + + // if (dataSourceConfig.sourceAtrributes.length > 0) { + // let searchParams = ""; + // dataSourceConfig.sourceAtrributes.forEach(sourceAttribute => { + // let searchParam; + // searchParam = sourceAttribute.name + '=' + sourceAttribute.value; + // searchParams += searchParam + '&' + // }); + // dataSourcePromises.push(Matrix.Labels.getNeedlesBySearch(dataSourceConfig.id,dataSourceConfig.type,searchParams)); + // } } else if (dataSourceConfig.type == "Labels") { - dataSourcePromises.push(Matrix.Labels.projectLabelHistory()); + dataSourcePromises.push(Matrix.Labels.projectLabelHistory(dataSourceConfig.id,dataSourceConfig.type)); + } }); @@ -168,18 +198,21 @@ namespace GenericDashboard { dataSourcePromisesResults.forEach(dataSourcePromiseResult => { - if (dataSourcePromiseResult.length > 0 && that.instanceOfXRTrimNeedleItem(dataSourcePromiseResult[0])) { - dashboardPluginSources.push({ - "type": "Needles", - "source": dataSourcePromiseResult - }) - } else if (dataSourcePromiseResult.length > 0 && that.instanceOfXRLabelEntry(dataSourcePromiseResult[0])) { - that.labelHistoryData = dataSourcePromiseResult; - dashboardPluginSources.push({ - "type": "Labels", - "source": dataSourcePromiseResult - }) - } + // if (dataSourcePromiseResult.length > 0 && that.instanceOfXRTrimNeedleItem(dataSourcePromiseResult[0])) { + // dashboardPluginSources.push({ + // "type": "NeedlesBySearch", + // "source": dataSourcePromiseResult + // }) + // } else if (dataSourcePromiseResult.length > 0 && that.instanceOfXRLabelEntry(dataSourcePromiseResult[0])) { + // that.labelHistoryData = dataSourcePromiseResult; + // dashboardPluginSources.push({ + // "type": "Labels", + // "source": dataSourcePromiseResult + // }) + // } + + dashboardPluginSources.push(dataSourcePromiseResult); + }); @@ -208,7 +241,7 @@ namespace GenericDashboard { that.currentTimeRangeSelected = renderTemplateData.currentTimeRangeSelected; renderTemplateData.dateRangeData.forEach(dateRangeItem => { - that.initiateDateRangeActions(dateRangeItem.range,dateRangeItem.contentId); + that.initiateDateRangeActions(dateRangeItem.range, dateRangeItem.contentId); }); @@ -278,14 +311,14 @@ namespace GenericDashboard { categoriesFunctionalities.forEach(category => { category.functionalities.forEach(functionality => { - if(functionality.type === 'dateRangeComapre'){ + if (functionality.type === 'dateRangeComapre') { functionality.dateRanges.forEach(dateRange => { - that.initiateDateRangeActions(dateRange,functionality.id); + that.initiateDateRangeActions(dateRange, functionality.id); }); } }); }); - + } @@ -366,7 +399,7 @@ namespace GenericDashboard { if (byCategoryLabelData.groupByData.length > 0) { byCategoryLabelData.groupByData.forEach(groupByObject => { if (dateFilterId == groupByObject.id) { - that.renderGroupByChart(groupByObject.labelsDesc,groupByObject.groupWiseData,groupByObject.id); + that.renderGroupByChart(groupByObject.labelsDesc, groupByObject.groupWiseData, groupByObject.id); } }); } @@ -375,7 +408,7 @@ namespace GenericDashboard { if (byCategoryLabelData.groupByStateData.length > 0) { byCategoryLabelData.groupByStateData.forEach(groupByStateObject => { if (dateFilterId == groupByStateObject.id) { - that.renderGroupByStateChart(groupByStateObject.stateWiseData,groupByStateObject.stateColors,groupByStateObject.id); + that.renderGroupByStateChart(groupByStateObject.stateWiseData, groupByStateObject.stateColors, groupByStateObject.id); } }); } @@ -384,7 +417,7 @@ namespace GenericDashboard { if (byCategoryLabelData.groupByStateOverdueData.length > 0) { byCategoryLabelData.groupByStateOverdueData.forEach(groupByStateOverdueObject => { if (dateFilterId == groupByStateOverdueObject.id) { - that.renderGroupByStateChart(groupByStateOverdueObject.stateWiseData,groupByStateOverdueObject.stateColors,groupByStateOverdueObject.id); + that.renderGroupByStateChart(groupByStateOverdueObject.stateWiseData, groupByStateOverdueObject.stateColors, groupByStateOverdueObject.id); } }); } @@ -393,7 +426,7 @@ namespace GenericDashboard { if (byCategoryLabelData.groupByStackData.length > 0) { byCategoryLabelData.groupByStackData.forEach(groupByStackObject => { if (dateFilterId == groupByStackObject.id) { - that.renderGroupByStackChart(groupByStackObject.groupByStackData,groupByStackObject.groupByCodesDesc,groupByStackObject.categoryDesc,groupByStackObject.groupByCodeColors,groupByStackObject.id); + that.renderGroupByStackChart(groupByStackObject.groupByStackData, groupByStackObject.groupByCodesDesc, groupByStackObject.categoryDesc, groupByStackObject.groupByCodeColors, groupByStackObject.id); } }); } @@ -402,7 +435,7 @@ namespace GenericDashboard { if (byCategoryLabelData.avgData.length > 0) { byCategoryLabelData.avgData.forEach(avgObject => { if (dateFilterId == avgObject.id) { - that.renderAvgChart(avgObject.stateDesc,avgObject.statusWiseAvgData,avgObject.id); + that.renderAvgChart(avgObject.stateDesc, avgObject.statusWiseAvgData, avgObject.id); } }); } @@ -411,7 +444,7 @@ namespace GenericDashboard { if (byCategoryLabelData.closureData.length > 0) { byCategoryLabelData.closureData.forEach(closureObject => { if (dateFilterId == closureObject.id) { - that.renderClosureChart(closureObject.closedItemsData,closureObject.closureTimeData,closureObject.id); + that.renderClosureChart(closureObject.closedItemsData, closureObject.closureTimeData, closureObject.id); } }); } @@ -420,14 +453,32 @@ namespace GenericDashboard { if (byCategoryLabelData.trackerData.length > 0) { byCategoryLabelData.trackerData.forEach(trackerObject => { if (dateFilterId == trackerObject.id) { - that.renderTrackerChart(trackerObject.stateDesc,trackerObject.stateTrackerData,trackerObject.stateColors,trackerObject.id); + that.renderTrackerChart(trackerObject.stateDesc, trackerObject.stateTrackerData, trackerObject.stateColors, trackerObject.id); + } + }); + } + break; + case 'groupByNcrDept': + if (byCategoryLabelData.groupByNcrDeptData.length > 0) { + byCategoryLabelData.groupByNcrDeptData.forEach(groupByNcrDeptObject => { + if (dateFilterId == groupByNcrDeptObject.id) { + that.renderGroupByNcrDeptChart(groupByNcrDeptObject.labelsDesc, groupByNcrDeptObject.groupByNcrDeptWiseData, groupByNcrDeptObject.id); } }); } break; + case 'groupByNcrAuditor': + if (byCategoryLabelData.groupByNcrAuditorData.length > 0) { + byCategoryLabelData.groupByNcrAuditorData.forEach(groupByNcrAuditorObject => { + if (dateFilterId == groupByNcrAuditorObject.id) { + that.renderGroupByNcrAuditorChart(groupByNcrAuditorObject.groupByNcrAuditorWiseData, groupByNcrAuditorObject.id); + } + }); + } + break; case 'table': if (byCategoryLabelData.itemCurrentStateValues.length > 0) { - that.renderPluginTable(byCategoryLabelData.itemCurrentStateTableHeaders,byCategoryLabelData.itemCurrentStateValues); + that.renderPluginTable(byCategoryLabelData.itemCurrentStateTableHeaders, byCategoryLabelData.itemCurrentStateValues); } break; } @@ -490,6 +541,12 @@ namespace GenericDashboard { case 'tracker': that.renderTrackerChartByDateRanges(fromDateSelected, toDateSelected, byCategoryLabelData, dateFilterId); break; + case 'groupByNcrDept': + that.renderGroupByNcrDeptChartByDateRanges(fromDateSelected, toDateSelected, byCategoryLabelData, dateFilterId); + break; + case 'groupByNcrAuditor': + that.renderGroupByNcrAuditorChartByDateRanges(fromDateSelected, toDateSelected, byCategoryLabelData, dateFilterId); + break; case 'dateRangeComapre': that.renderDateRangeComapreDataByDateRanges(fromDateSelected, toDateSelected, byCategoryLabelData, dateFilterId); break; @@ -501,28 +558,28 @@ namespace GenericDashboard { } - initiateDateRangeActions(range,contentId){ + initiateDateRangeActions(range, contentId) { let that = this; - $("#"+range+"Range").click(function () { + $("#" + range + "Range").click(function () { - if(range == "dateCompare"){ - $("#"+contentId+"-date-filter").show(); - }else{ - $("#"+contentId+"-date-filter").hide(); + if (range == "dateCompare") { + $("#" + contentId + "-date-filter").show(); + } else { + $("#" + contentId + "-date-filter").hide(); } - + if (that.currentTimeRangeSelected !== range) { - $("#"+range+"Range").removeClass("timerangenormal"); - $("#"+range+"Range").addClass("timerangeselected"); + $("#" + range + "Range").removeClass("timerangenormal"); + $("#" + range + "Range").addClass("timerangeselected"); $('#' + that.currentTimeRangeSelected + 'Range').removeClass("timerangeselected"); $('#' + that.currentTimeRangeSelected + 'Range').addClass("timerangenormal"); that.currentTimeRangeSelected = range; - - if(range !== "dateCompare"){ - that.renderDateRangeByAction(range,contentId); + + if (range !== "dateCompare") { + that.renderDateRangeByAction(range, contentId); } } @@ -530,7 +587,7 @@ namespace GenericDashboard { } - renderDateRangeByAction(range,contentId){ + renderDateRangeByAction(range, contentId) { let that = this; let columnData; let categoryData; @@ -547,42 +604,42 @@ namespace GenericDashboard { case 'threeMonths': columnData = that.dateRangeData.threeMonthsColumnsData; categoryData = that.dateRangeData.threeMonthsCategoryData; - break; + break; case 'sixMonths': columnData = that.dateRangeData.sixMonthsColumnsData; categoryData = that.dateRangeData.sixMonthsCategoryData; - break; + break; case 'twelveMonths': columnData = that.dateRangeData.twelveMonthsColumnsData; categoryData = that.dateRangeData.twelveMonthsCategoryData; - break; + break; case 'ytd': columnData = that.dateRangeData.ytdColumnsData; categoryData = that.dateRangeData.ytdCategoryData; - break; + break; case 'moreThanYear': columnData = that.dateRangeData.moreThanYearColumnsData; categoryData = that.dateRangeData.moreThanYearCategoryData; - break; + break; case 'quarterlyCY': columnData = that.dateRangeData.quarterlyCYColumnsData; categoryData = that.dateRangeData.quarterlyCYCategoryData.categories; - break; + break; case 'quarterlyFY': columnData = that.dateRangeData.quarterlyFYColumnsData; categoryData = that.dateRangeData.quarterlyFYCategoryData.categories; - break; + break; }; let ByCategoryLabelData = this.ByCategoryLabelDetails .find(({ category }) => category === this.currentCat); - if(ByCategoryLabelData.dateRangeCompareData.length > 0){ + if (ByCategoryLabelData.dateRangeCompareData.length > 0) { ByCategoryLabelData.dateRangeCompareData.forEach(dateRangeCompareObject => { - if(dateRangeCompareObject.id == contentId){ - that.renderDateRangeChart(columnData,categoryData,dateRangeCompareObject.labelsDesc, - dateRangeCompareObject.labelColors,dateRangeCompareObject.id); - } + if (dateRangeCompareObject.id == contentId) { + that.renderDateRangeChart(columnData, categoryData, dateRangeCompareObject.labelsDesc, + dateRangeCompareObject.labelColors, dateRangeCompareObject.id); + } }); } } @@ -593,7 +650,7 @@ namespace GenericDashboard { if (cat == undefined) { return; } - if (cat == ""){ + if (cat == "") { cat = $("#itemSelectionLabelDashboard .dropdown-menu li:first").text(); } @@ -656,6 +713,19 @@ namespace GenericDashboard { }); } + if (ByCategoryLabelData.groupByNcrDeptData && ByCategoryLabelData.groupByNcrDeptData.length > 0) { + ByCategoryLabelData.groupByNcrDeptData.forEach(groupByNcrDeptObject => { + that.renderGroupByNcrDeptChart(groupByNcrDeptObject.labelsDesc, groupByNcrDeptObject.groupByNcrDeptWiseData, groupByNcrDeptObject.id); + }); + } + + if (ByCategoryLabelData.groupByNcrAuditorData && ByCategoryLabelData.groupByNcrAuditorData.length > 0) { + ByCategoryLabelData.groupByNcrAuditorData.forEach(groupByNcrAuditorObject => { + that.renderGroupByNcrAuditorChart(groupByNcrAuditorObject.groupByNcrAuditorWiseData, groupByNcrAuditorObject.id); + }); + } + + if (ByCategoryLabelData.dateRangeCompareData && ByCategoryLabelData.dateRangeCompareData.length > 0) { ByCategoryLabelData.dateRangeCompareData.forEach(dateRangeCompareObject => { @@ -1350,6 +1420,178 @@ namespace GenericDashboard { that.allChartsMap.set(groupId, trackerChart); } + + + renderGroupByNcrDeptChartByDateRanges(fromDateVal: any, toDateVal: any, byCategoryLabelData: ByCategoryLabelData, groupId: String) { + + let fromDate = new Date(fromDateVal); + let toDate = new Date(toDateVal); + + if (byCategoryLabelData.groupByNcrDeptData.length > 0) { + byCategoryLabelData.groupByNcrDeptData.forEach(groupByNcrDeptObject => { + if (groupByNcrDeptObject.id == groupId) { + + let groupByNcrDeptWiseData = []; + let groupByNcrDeptInitials = Array(groupByNcrDeptObject.labels.length).fill(0); + + for( let option of groupByNcrDeptObject.ncOptions){ + groupByNcrDeptWiseData.push([option.label, ...groupByNcrDeptInitials]); + } + + groupByNcrDeptObject.currentLabelData.forEach( (itemCurrentStateData) => { + if (itemCurrentStateData.creationDate && + (itemCurrentStateData.creationDate >= fromDate && itemCurrentStateData.creationDate <= toDate)) { + let itemDeptIndex = -1; + for(const label of groupByNcrDeptObject.labels){ + if(itemCurrentStateData.labels.includes(label)){ + let labelIndex = groupByNcrDeptObject.labels.findIndex(labelCode => labelCode === label); + itemDeptIndex = labelIndex; + break; + } + } + + if(itemDeptIndex > 0){ + groupByNcrDeptWiseData.forEach(ncDeptWiseData => { + if(ncDeptWiseData[0] == itemCurrentStateData.ncLabel){ + ncDeptWiseData[itemDeptIndex+1] += 1; + } + }); + } + } + }); + + this.renderGroupByNcrDeptChart(groupByNcrDeptObject.labelsDesc, groupByNcrDeptWiseData, groupByNcrDeptObject.id); + } + }); + } + } + + renderGroupByNcrDeptChart(labels, groupByNcrDeptWiseData, groupId) { + let that = this; + //prepare template "${contentConfig.id}-Chart" + let groupByChartparams: c3.ChartConfiguration = { + bindto: `#${groupId}Graph`, + data: { + x: 'x', + columns: [ + ['x', ...labels], + ...groupByNcrDeptWiseData + ], + type: 'bar' + }, + axis: { + x: { + type: 'category' + } + } + }; + + //prepare chart config and render + $(`#${groupId}-Chart div`).remove(); + + $(`#${groupId}-Chart`).append(`
`); + + let groupByChart = c3.generate(groupByChartparams); + + that.allChartsMap.set(groupId, groupByChart); + } + + + renderGroupByNcrAuditorChartByDateRanges(fromDateVal: any, toDateVal: any, byCategoryLabelData: ByCategoryLabelData, groupId: String) { + + let fromDate = new Date(fromDateVal); + let toDate = new Date(toDateVal); + + if (byCategoryLabelData.groupByNcrAuditorData.length > 0) { + byCategoryLabelData.groupByNcrAuditorData.forEach(groupByNcrAuditorObject => { + if (groupByNcrAuditorObject.id == groupId) { + + let auditorsData = []; + let auditCountData = []; + let auditItemsData = []; + let auditNcCountData = []; + let auditNcRatio = []; + + groupByNcrAuditorObject.currentAuditorInfoData.forEach( (currentAuditorData) => { + if (currentAuditorData.creationDate && + (currentAuditorData.creationDate >= fromDate && currentAuditorData.creationDate <= toDate)) { + let auditorIndex = auditorsData.findIndex(auditor => auditor === currentAuditorData.auditorName); + if(auditorIndex > -1){ + auditCountData[auditorIndex] += 1; + auditItemsData[auditorIndex].push(currentAuditorData.id); + }else{ + auditorsData.push(currentAuditorData.auditorName); + auditCountData.push(1); + auditItemsData.push([currentAuditorData.id]) + auditNcCountData.push(0); + auditNcRatio.push(0); + } + } + }); + + groupByNcrAuditorObject.currentAuditFindingsData.forEach( (currentAuditFindingsData) => { + if (currentAuditFindingsData.creationDate && + (currentAuditFindingsData.creationDate >= fromDate && currentAuditFindingsData.creationDate <= toDate)) { + let itemIndex = -1; + for( let auditItems of auditItemsData){ + itemIndex += 1; + let auditorItemIndex = auditItems.findIndex(itemRefId => itemRefId === currentAuditFindingsData.id); + if(auditorItemIndex > 0){ + let auditNcCount = currentAuditFindingsData.auditNcCount; + auditNcCountData[itemIndex] += auditNcCount; + break; + } + } + } + }); + + auditorsData.forEach((auditor, index) => { + if(auditNcCountData[index] !== 0){ + auditNcRatio[index] = Math.round(((auditNcCountData[index]/auditCountData[index]) + Number.EPSILON) * 100) / 100; + } + }); + + let groupByNcrAuditorWiseData = [ + ['x', ...auditorsData], + ['No of audits performed',...auditCountData], + ['No of NC given', ...auditNcCountData], + ['NC ratio', ...auditNcRatio] + ]; + + this.renderGroupByNcrAuditorChart(groupByNcrAuditorWiseData, groupByNcrAuditorObject.id); + + } + }); + } + } + + renderGroupByNcrAuditorChart(groupByNcrAuditorWiseData, groupId) { + let that = this; + //prepare template "${contentConfig.id}-Chart" + let groupByChartparams: c3.ChartConfiguration = { + bindto: `#${groupId}Graph`, + data: { + x: 'x', + columns: groupByNcrAuditorWiseData, + type: 'bar' + }, + axis: { + x: { + type: 'category' + } + } + }; + + //prepare chart config and render + $(`#${groupId}-Chart div`).remove(); + + $(`#${groupId}-Chart`).append(`
`); + + let groupByChart = c3.generate(groupByChartparams); + + that.allChartsMap.set(groupId, groupByChart); + } + renderPluginTableByDateRanges(fromDateVal: any, toDateVal: any, byCategoryLabelData: ByCategoryLabelData) { let fromDate = new Date(fromDateVal); @@ -1437,7 +1679,7 @@ namespace GenericDashboard { //process groupBy functionality ByCategoryLabelData.groupByData.forEach(groupByObject => { - let groupByObjectDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.type === groupByObject.dataSourceType); + let groupByObjectDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.id === groupByObject.dataSourceType); Commons.GenericFunctionalities.processGroupByObjectData(groupByObject, groupByObjectDataSource.source, ByCategoryLabelData.category, @@ -1450,7 +1692,7 @@ namespace GenericDashboard { //process groupBy-operands functionality ByCategoryLabelData.groupByOperandsData.forEach(groupByOperandsObject => { - let groupByOperandsDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.type === groupByOperandsObject.dataSourceType); + let groupByOperandsDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.id === groupByOperandsObject.dataSourceType); Commons.GenericFunctionalities.processGroupByOperandsData(groupByOperandsObject, groupByOperandsDataSource.source, ByCategoryLabelData.category @@ -1460,7 +1702,7 @@ namespace GenericDashboard { //process groupByStack functionality ByCategoryLabelData.groupByStackData.forEach(groupByStackObject => { - let groupByStackDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.type === groupByStackObject.dataSourceType); + let groupByStackDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.id === groupByStackObject.dataSourceType); Commons.GenericFunctionalities.processGroupByStackData(groupByStackObject, groupByStackDataSource.source, ByCategoryLabelData.category, @@ -1471,8 +1713,8 @@ namespace GenericDashboard { //process groupByState functionality ByCategoryLabelData.groupByStateData.forEach(groupByStateObject => { - let groupByStateDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.type === groupByStateObject.dataSourceType); - if(groupByStateDataSource.type === "Labels"){ + let groupByStateDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.id === groupByStateObject.dataSourceType); + if (groupByStateDataSource.type === "Labels") { Commons.GenericFunctionalities.processGroupByStateData(groupByStateObject, groupByStateDataSource.source, ByCategoryLabelData.category, @@ -1480,13 +1722,13 @@ namespace GenericDashboard { ByCategoryLabelData.itemCurrentStateTableHeaders, ByCategoryLabelData.itemCurrentStateValues ); - }else if(groupByStateDataSource.type === "Needles"){ + } else if (groupByStateDataSource.type === "Needles") { Commons.GenericFunctionalities.processGroupByStateNeedleData(groupByStateObject, groupByStateDataSource.source ); } - if(groupByStateObject.type === "groupByGapAnalysis"){ + if (groupByStateObject.type === "groupByGapAnalysis") { that.currentCat = "QMS"; } }); @@ -1499,7 +1741,7 @@ namespace GenericDashboard { for (const dataSourceType of groupByStateOverDueObject.dataSources) { - let dataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.type === dataSourceType); + let dataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.id === dataSourceType); if (dataSourceType === "Labels") { labelsDataSource = dataSource.source; } else if (dataSourceType === "Needles") { @@ -1520,7 +1762,7 @@ namespace GenericDashboard { //process avg functionality ByCategoryLabelData.avgData.forEach(avgObject => { - let avgDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.type === avgObject.dataSourceType); + let avgDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.id === avgObject.dataSourceType); Commons.GenericFunctionalities.processAvgData(avgObject, avgDataSource.source, ByCategoryLabelData.category @@ -1529,7 +1771,7 @@ namespace GenericDashboard { //process closure functionality ByCategoryLabelData.closureData.forEach(closureObject => { - let closureDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.type === closureObject.dataSourceType); + let closureDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.id === closureObject.dataSourceType); Commons.GenericFunctionalities.processClosureData(closureObject, closureDataSource.source, ByCategoryLabelData.category, @@ -1541,7 +1783,7 @@ namespace GenericDashboard { //process dateRangeComapre functionality ByCategoryLabelData.dateRangeCompareData.forEach(dateRangeCompareObject => { - let dateRangeCompareDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.type === dateRangeCompareObject.dataSourceType); + let dateRangeCompareDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.id === dateRangeCompareObject.dataSourceType); Commons.GenericFunctionalities.processDateRangeCompareData(dateRangeCompareObject, dateRangeCompareDataSource.source, ByCategoryLabelData.category @@ -1550,7 +1792,7 @@ namespace GenericDashboard { //process tracker functionality ByCategoryLabelData.trackerData.forEach(trackerObject => { - let trackerDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.type === trackerObject.dataSourceType); + let trackerDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.id === trackerObject.dataSourceType); Commons.GenericFunctionalities.processTrackerData(trackerObject, trackerDataSource.source, ByCategoryLabelData.category, @@ -1559,6 +1801,29 @@ namespace GenericDashboard { ByCategoryLabelData.itemCurrentStateValues ); }); + + //process groupBy NCR department wise functionality + ByCategoryLabelData.groupByNcrDeptData.forEach(groupByNcrDeptObject => { + let groupByNcrDeptObjectDataSource = functionalityDataSources.find((functionalityDataSource) => functionalityDataSource.id === groupByNcrDeptObject.dataSourceType); + Commons.GenericFunctionalities.processGroupByNcrDeptObjectData(groupByNcrDeptObject, + groupByNcrDeptObjectDataSource.source); + }); + + //process groupBy NCR auditor wise functionality + ByCategoryLabelData.groupByNcrAuditorData.forEach(groupByNcrAuditorObject => { + let auditFindingsDataSource: XRTrimNeedleItem[]; + let auditorinfoDataSource: XRTrimNeedleItem[]; + + for (const dataSource of functionalityDataSources) { + if (dataSource.id === "audit-findings") { + auditFindingsDataSource = dataSource.source; + } else if (dataSource.id === "general-auditor-information") { + auditorinfoDataSource = dataSource.source; + } + } + Commons.GenericFunctionalities.processGroupByNcrAuditorObjectData(groupByNcrAuditorObject, + auditFindingsDataSource,auditorinfoDataSource); + }); } } } diff --git a/src/MESQA-Config-RF.json b/src/MESQA-Config-RF.json index 8e8866e..9f9a844 100644 --- a/src/MESQA-Config-RF.json +++ b/src/MESQA-Config-RF.json @@ -1,5 +1,185 @@ { "plugins" : [ + { + "id": "IQAO", + "title": "IQA Overview", + "folder": "DASHBOARDS", + "order": 3000, + "icon": "fal fa-chart-bar", + "name": "IQA Overview", + "version": "1.0.0", + "dataSources": [ + { + "id": "iqalabels", + "type": "Labels" + }, + { + "id": "audit-findings", + "type": "NeedlesBySearch", + "sourceAtrributes": [ + { + "name": "category", + "value": "IQA" + }, + { + "name": "fieldName", + "value": "Audit Findings" + }, + { + "name": "labels", + "value": 1 + } + ] + }, + { + "id": "general-auditor-information", + "type": "NeedlesBySearch", + "sourceAtrributes": [ + { + "name": "category", + "value": "IQA" + }, + { + "name": "fieldName", + "value": "General Audit Information:" + }, + { + "name": "labels", + "value": 1 + } + ] + } + ], + "layoutConfig": { + "rowConfig": [ + { + "columnConfig": [ + { + "size": 6, + "contentType": "chart", + "contentConfig": { + "id" : "status", + "functionality" : "groupByState", + "title" : "Status wise IQA count overview", + "dateFilterRequired" : "Y", + "contentClass" : "chart" + } + }, + { + "size": 6, + "contentType": "chart", + "contentConfig": { + "id" : "avg", + "functionality" : "avg", + "title" : "Average time state wise overview", + "dateFilterRequired" : "N", + "contentClass" : "chart" + } + } + ] + }, + { + "columnConfig": [ + { + "size": 12, + "contentType": "chart", + "contentConfig": { + "id" : "ncrDeptWise", + "functionality" : "groupByNcrDept", + "title" : "NCR department wise overview", + "dateFilterRequired" : "Y", + "contentClass" : "chart" + } + } + ] + }, + { + "columnConfig": [ + { + "size": 12, + "contentType": "chart", + "contentConfig": { + "id" : "ncrauditorWise", + "functionality" : "groupByNcrAuditor", + "title" : "Auditor performance overview", + "dateFilterRequired" : "Y", + "contentClass" : "chart" + } + } + ] + }, + { + "columnConfig": [ + { + "size": 12, + "contentType": "table", + "contentConfig": { + "id" : "IQAO", + "functionality" : "table", + "title" : "IQA current status list", + "dateFilterRequired" : "Y" + } + } + ] + } + ], + "layoutDomStyle":" .chart { width: 90%; min-height: 350px; cursor:pointer; } .dateFilter{ display:flex; margin-left: 45px; } .filterDates { width: 115px; margin: 0 6px; } .date-filter-form-control { height: 20px; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 4px; } .date-filter-btn { margin-bottom: 0; margin-left: 12px; font-weight: 400; text-align: center; white-space: nowrap; vertical-align: middle; touch-action: manipulation; cursor: pointer; background-image: none; border: 1px solid transparent; padding: 0px 5px; font-size: 12px; line-height: 1.42857143; border-radius: 4px; } .tableDateFilter{ display:flex; margin-left: 350px; } .closureTimeChart{ width: 90%; min-height: 315px; cursor:pointer; } .bigChart{ width: 90%; min-height: 900px; cursor:pointer; }" + }, + "categories":["IQA"], + "categoriesFunctionalities":[ + { + "id":"IQA", + "functionalities": [ + { + "id": "status", + "type": "groupByState", + "dataSourceType": "iqalabels", + "renderChart": "Y", + "showInTable": "Y", + "tableHeader": "Current State", + "labels": ["Q4", "PLN1", "Q1", "Q2", "Q3"], + "labelsDesc": ["IQA Initiated", "IQA Plan Approved", "Report Approved", "Response Accepted", "IQA CLosed"], + "labelColors": ["#d62728", "#ff7f0e", "#9467bd", "#1f77b4", "#2ca02c"] + }, + { + "id": "avg", + "type": "avg", + "dataSourceType": "iqalabels", + "renderChart": "Y", + "title": "average time spent in state", + "labels": ["Q4", "PLN1", "Q1", "Q2"], + "labelsDesc": ["IQA Initiated", "IQA Plan Approved", "Report Approved", "Response Accepted"], + "allLabels": ["Q4", "PLN1", "Q1", "Q2", "Q3"], + "initialStateLabels": ["Q4", "PLN1", "Q1", "Q2"], + "allLabelDesc": ["IQA Initiated", "IQA Plan Approved", "Report Approved", "Response Accepted", "IQA CLosed"], + "initialSateLabel": "Q4", + "closedStateLabel": "Q3", + "rejectedStateLabel": "" + }, + { + "id": "ncrDeptWise", + "type": "groupByNcrDept", + "dataSourceType": "audit-findings", + "renderChart": "Y", + "sourceTableName": "Audit Findings", + "sourceTableColumnName": "NC Category", + "labels": ["PROD-AB", "PROD-C", "QC-AB", "QC-C", "QA", "RA", "SCM", "MICRO", "PUR", "Packaging", "HR", "ENG", "ST", "UT", "NDLP"], + "labelsDesc": ["PAB", "PC", "QCAB", "QCC", "QA", "RA", "SCM", "MI", "PUR", "PKG", "HR", "ENG","ST", "UT", "NDL"] + }, + { + "id": "ncrauditorWise", + "type": "groupByNcrAuditor", + "dataSources":["audit-findings","general-auditor-information"], + "renderChart": "Y", + "auditorSourceTableName": "General Audit Information:", + "auditorTypeColumnName": "Member Details", + "auditorNameColumnName": "Name", + "auditorOptionLabel": "Auditor" + } + ] + } + ] + }, { "id": "CAPAO", "title": "CAPA Status Overview", @@ -10,6 +190,7 @@ "version": "1.12.0", "dataSources": [ { + "id": "capalabels", "type": "Labels" } ], @@ -122,7 +303,7 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", @@ -133,7 +314,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -144,7 +325,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -155,7 +336,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": ["CAN1", "CAN2", "CAN5", "CAN3"], @@ -170,7 +351,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": ["CAN1", "CAN2", "CAN5", "CAN3"], @@ -185,7 +366,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -206,7 +387,7 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", @@ -217,7 +398,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -228,7 +409,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -239,7 +420,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": ["CAN1", "CAN2", "CAN5", "CAN3"], @@ -254,7 +435,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": ["CAN1", "CAN2", "CAN5", "CAN3"], @@ -269,7 +450,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -290,7 +471,7 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", @@ -301,7 +482,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -312,7 +493,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -323,7 +504,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": ["PN1", "PN2", "PN3", "PN4"], @@ -338,7 +519,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": ["PN1", "PN2", "PN3", "PN4"], @@ -353,7 +534,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -374,7 +555,7 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", @@ -385,7 +566,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -396,7 +577,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -407,7 +588,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": ["PN1", "PN2", "PN3", "PN4"], @@ -422,7 +603,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": ["PN1", "PN2", "PN3", "PN4"], @@ -437,7 +618,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -465,6 +646,7 @@ "version": "1.0.0", "dataSources": [ { + "id": "capalabels", "type": "Labels" } ], @@ -566,7 +748,7 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", @@ -577,7 +759,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -588,7 +770,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": ["CN2", "CC1", "CN3", "CN4"], @@ -603,7 +785,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": ["CN2", "CC1", "CN3", "CN4"], @@ -618,7 +800,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -638,7 +820,7 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", @@ -649,7 +831,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -660,7 +842,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": ["CN2", "CC1", "CN3", "CN4"], @@ -675,7 +857,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": ["CN2", "CC1", "CN3", "CN4"], @@ -690,7 +872,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -710,7 +892,7 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", @@ -721,7 +903,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -732,7 +914,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": ["DN1", "DN2", "DN3"], @@ -747,7 +929,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": ["DN1", "DN2", "DN3"], @@ -762,7 +944,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -789,6 +971,7 @@ "version": "1.0.0", "dataSources": [ { + "id": "capalabels", "type": "Labels" } ], @@ -901,7 +1084,7 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", @@ -912,7 +1095,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -923,7 +1106,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -934,7 +1117,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": ["NN1", "NN2"], @@ -949,7 +1132,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": ["NN1", "NN2"], @@ -964,7 +1147,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -991,6 +1174,7 @@ "version": "1.0.0", "dataSources": [ { + "id": "capalabels", "type": "Labels" } ], @@ -1103,7 +1287,7 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", @@ -1114,7 +1298,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -1125,7 +1309,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -1136,7 +1320,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": ["EV1", "EN2"], @@ -1151,7 +1335,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": ["EV1", "EN2"], @@ -1166,7 +1350,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", diff --git a/src/MHCQA-Config-RF.json b/src/MHCQA-Config-RF.json index ffd3481..1cd30a6 100644 --- a/src/MHCQA-Config-RF.json +++ b/src/MHCQA-Config-RF.json @@ -1,5 +1,263 @@ { "plugins": [ + { + "id": "IQAO", + "title": "IQA Overview", + "folder": "DASHBOARDS", + "order": 3000, + "icon": "fal fa-chart-bar", + "name": "IQA Overview", + "version": "1.0.0", + "dataSources": [ + { + "id": "iqalabels", + "type": "Labels" + }, + { + "id": "audit-findings", + "type": "NeedlesBySearch", + "sourceAtrributes": [ + { + "name": "category", + "value": "IQA" + }, + { + "name": "fieldName", + "value": "Audit Findings" + }, + { + "name": "labels", + "value": 1 + } + ] + }, + { + "id": "general-auditor-information", + "type": "NeedlesBySearch", + "sourceAtrributes": [ + { + "name": "category", + "value": "IQA" + }, + { + "name": "fieldName", + "value": "General Audit Information:" + }, + { + "name": "labels", + "value": 1 + } + ] + } + ], + "layoutConfig": { + "rowConfig": [ + { + "columnConfig": [ + { + "size": 6, + "contentType": "chart", + "contentConfig": { + "id": "status", + "functionality": "groupByState", + "title": "Status wise IQA count overview", + "dateFilterRequired": "Y", + "contentClass": "chart" + } + }, + { + "size": 6, + "contentType": "chart", + "contentConfig": { + "id": "avg", + "functionality": "avg", + "title": "Average time state wise overview", + "dateFilterRequired": "N", + "contentClass": "chart" + } + } + ] + }, + { + "columnConfig": [ + { + "size": 12, + "contentType": "chart", + "contentConfig": { + "id": "ncrDeptWise", + "functionality": "groupByNcrDept", + "title": "NCR department wise overview", + "dateFilterRequired": "Y", + "contentClass": "chart" + } + } + ] + }, + { + "columnConfig": [ + { + "size": 12, + "contentType": "chart", + "contentConfig": { + "id": "ncrauditorWise", + "functionality": "groupByNcrAuditor", + "title": "Auditor performance overview", + "dateFilterRequired": "Y", + "contentClass": "chart" + } + } + ] + }, + { + "columnConfig": [ + { + "size": 12, + "contentType": "table", + "contentConfig": { + "id": "IQAO", + "functionality": "table", + "title": "IQA current status list", + "dateFilterRequired": "Y" + } + } + ] + } + ], + "layoutDomStyle": " .chart { width: 90%; min-height: 350px; cursor:pointer; } .dateFilter{ display:flex; margin-left: 45px; } .filterDates { width: 115px; margin: 0 6px; } .date-filter-form-control { height: 20px; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 4px; } .date-filter-btn { margin-bottom: 0; margin-left: 12px; font-weight: 400; text-align: center; white-space: nowrap; vertical-align: middle; touch-action: manipulation; cursor: pointer; background-image: none; border: 1px solid transparent; padding: 0px 5px; font-size: 12px; line-height: 1.42857143; border-radius: 4px; } .tableDateFilter{ display:flex; margin-left: 350px; } .closureTimeChart{ width: 90%; min-height: 315px; cursor:pointer; } .bigChart{ width: 90%; min-height: 900px; cursor:pointer; }" + }, + "categories": [ + "IQA" + ], + "categoriesFunctionalities": [ + { + "id": "IQA", + "functionalities": [ + { + "id": "status", + "type": "groupByState", + "dataSourceType": "iqalabels", + "renderChart": "Y", + "showInTable": "Y", + "tableHeader": "Current State", + "labels": [ + "QA1", + "QA5", + "QA2", + "QA3", + "QA4" + ], + "labelsDesc": [ + "IQA Initiated", + "IQA Plan Approved", + "Report Approved", + "Response Accepted", + "IQA CLosed" + ], + "labelColors": [ + "#d62728", + "#ff7f0e", + "#9467bd", + "#1f77b4", + "#2ca02c" + ] + }, + { + "id": "avg", + "type": "avg", + "dataSourceType": "iqalabels", + "renderChart": "Y", + "title": "average time spent in state", + "labels": [ + "QA1", + "QA5", + "QA2", + "QA3" + ], + "labelsDesc": [ + "IQA Initiated", + "IQA Plan Approved", + "Report Approved", + "Response Accepted" + ], + "allLabels": [ + "QA1", + "QA5", + "QA2", + "QA3", + "QA4" + ], + "initialStateLabels": [ + "QA1", + "QA5", + "QA2", + "QA3" + ], + "allLabelDesc": [ + "IQA Initiated", + "IQA Plan Approved", + "Report Approved", + "Response Accepted", + "IQA CLosed" + ], + "initialSateLabel": "QA1", + "closedStateLabel": "QA4", + "rejectedStateLabel": "" + }, + { + "id": "ncrDeptWise", + "type": "groupByNcrDept", + "dataSourceType": "audit-findings", + "renderChart": "Y", + "sourceTableName": "Audit Findings", + "sourceTableColumnName": "NC Category", + "labels": [ + "MHC", + "QC", + "RA", + "Production", + "PUR", + "MICRO", + "PACK", + "Design", + "HR", + "SUC", + "ST", + "UT", + "QA" + ], + "labelsDesc": [ + "Common", + "QC", + "RA", + "Prod", + "PUR", + "MICRO", + "PACK", + "D&D", + "HR", + "SUC", + "ST", + "Utility", + "QA" + ] + }, + { + "id": "ncrauditorWise", + "type": "groupByNcrAuditor", + "dataSources": [ + "audit-findings", + "general-auditor-information" + ], + "renderChart": "Y", + "auditorSourceTableName": "General Audit Information:", + "auditorTypeColumnName": "Member Details", + "auditorNameColumnName": "Name", + "auditorOptionLabel": "Auditor" + } + ] + } + ] + }, { "id": "CAPAO", "title": "CAPA Status Overview", @@ -10,6 +268,7 @@ "version": "1.11.0", "dataSources": [ { + "id": "capalabels", "type": "Labels" } ], @@ -114,7 +373,12 @@ ], "layoutDomStyle": " .chart { width: 90%; min-height: 350px; cursor:pointer; } .dateFilter{ display:flex; margin-left: 45px; } .filterDates { width: 115px; margin: 0 6px; } .date-filter-form-control { height: 20px; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 4px; } .date-filter-btn { margin-bottom: 0; margin-left: 12px; font-weight: 400; text-align: center; white-space: nowrap; vertical-align: middle; touch-action: manipulation; cursor: pointer; background-image: none; border: 1px solid transparent; padding: 0px 5px; font-size: 12px; line-height: 1.42857143; border-radius: 4px; } .tableDateFilter{ display:flex; margin-left: 350px; } .closureTimeChart{ width: 90%; min-height: 315px; cursor:pointer; } .bigChart{ width: 90%; min-height: 900px; cursor:pointer; }" }, - "categories": ["CAA","PAA","CA","PA"], + "categories": [ + "CAA", + "PAA", + "CA", + "PA" + ], "categoriesFunctionalities": [ { "id": "CA", @@ -122,12 +386,13 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", "title": "count by department", "labels": [ + "MHC", "QC", "RA", "Production", @@ -142,6 +407,7 @@ "QA" ], "labelsDesc": [ + "Common", "QC", "RA", "Prod", @@ -159,7 +425,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -182,7 +448,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -214,7 +480,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": [ @@ -258,7 +524,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": [ @@ -307,7 +573,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -346,12 +612,13 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", "title": "count by department", "labels": [ + "MHC", "QC", "RA", "Production", @@ -366,6 +633,7 @@ "QA" ], "labelsDesc": [ + "Common", "QC", "RA", "Prod", @@ -383,7 +651,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -406,7 +674,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -438,7 +706,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": [ @@ -482,7 +750,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": [ @@ -531,7 +799,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -570,12 +838,13 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", "title": "count by department", "labels": [ + "MHC", "QC", "RA", "Production", @@ -590,6 +859,7 @@ "QA" ], "labelsDesc": [ + "Common", "QC", "RA", "Prod", @@ -607,7 +877,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -630,7 +900,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -662,7 +932,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": [ @@ -706,7 +976,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": [ @@ -755,7 +1025,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -794,12 +1064,13 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", "title": "count by department", "labels": [ + "MHC", "QC", "RA", "Production", @@ -814,6 +1085,7 @@ "QA" ], "labelsDesc": [ + "Common", "QC", "RA", "Prod", @@ -831,7 +1103,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -854,7 +1126,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -886,7 +1158,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": [ @@ -930,7 +1202,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": [ @@ -979,7 +1251,7 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", @@ -1024,6 +1296,7 @@ "version": "1.0.0", "dataSources": [ { + "id": "capalabels", "type": "Labels" } ], @@ -1129,12 +1402,13 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", "title": "count by department", "labels": [ + "MHC", "QC", "RA", "Production", @@ -1149,6 +1423,7 @@ "QA" ], "labelsDesc": [ + "Common", "QC", "RA", "Prod", @@ -1166,7 +1441,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -1198,7 +1473,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": [ @@ -1221,7 +1496,12 @@ "CCN5", "CCR" ], - "initialStateLabels": ["CCN1", "CCN2", "CCN3", "CCN4"], + "initialStateLabels": [ + "CCN1", + "CCN2", + "CCN3", + "CCN4" + ], "allLabelDesc": [ "CC Initiated", "CC Approved", @@ -1237,7 +1517,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": [ @@ -1258,23 +1538,61 @@ "#9467bd", "#1f77b4" ], - "allLabels": ["CCN1", "CCN2", "CCN3", "CCN4", "CCN5", "CCR"], - "allLabelDesc": ["CC Initiated", "CC Approved", "UI", "IV", "CC Closed", "CC Rejected"], - "tableLabelDesc": ["CC Initiated", "CC Approved", "UI", "IV"], + "allLabels": [ + "CCN1", + "CCN2", + "CCN3", + "CCN4", + "CCN5", + "CCR" + ], + "allLabelDesc": [ + "CC Initiated", + "CC Approved", + "UI", + "IV", + "CC Closed", + "CC Rejected" + ], + "tableLabelDesc": [ + "CC Initiated", + "CC Approved", + "UI", + "IV" + ], "closedStateLabel": "CCN5", "rejectedStateLabel": "CCR" }, { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", "title": "closure time(in days)", - "allLabels": ["CCN1", "CCN2", "CCN3", "CCN4", "CCN5", "CCR"], - "initialStateLabels": ["CCN1", "CCN2", "CCN3", "CCN4"], - "allLabelDesc": ["CC Initiated", "CC Approved", "UI", "IV", "CC Closed", "CC Rejected"], + "allLabels": [ + "CCN1", + "CCN2", + "CCN3", + "CCN4", + "CCN5", + "CCR" + ], + "initialStateLabels": [ + "CCN1", + "CCN2", + "CCN3", + "CCN4" + ], + "allLabelDesc": [ + "CC Initiated", + "CC Approved", + "UI", + "IV", + "CC Closed", + "CC Rejected" + ], "initialSateLabel": "CCN1", "closedStateLabel": "CCN5", "rejectedStateLabel": "CCR" @@ -1287,12 +1605,13 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", "title": "count by department", "labels": [ + "MHC", "QC", "RA", "Production", @@ -1307,6 +1626,7 @@ "QA" ], "labelsDesc": [ + "Common", "QC", "RA", "Prod", @@ -1324,7 +1644,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -1356,7 +1676,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": [ @@ -1379,7 +1699,12 @@ "CCN5", "CCR" ], - "initialStateLabels": ["CCN1", "CCN2", "CCN3", "CCN4"], + "initialStateLabels": [ + "CCN1", + "CCN2", + "CCN3", + "CCN4" + ], "allLabelDesc": [ "CC Initiated", "CC Approved", @@ -1395,7 +1720,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": [ @@ -1416,23 +1741,61 @@ "#9467bd", "#1f77b4" ], - "allLabels": ["CCN1", "CCN2", "CCN3", "CCN4", "CCN5", "CCR"], - "allLabelDesc": ["CC Initiated", "CC Approved", "UI", "IV", "CC Closed", "CC Rejected"], - "tableLabelDesc": ["CC Initiated", "CC Approved", "UI", "IV"], + "allLabels": [ + "CCN1", + "CCN2", + "CCN3", + "CCN4", + "CCN5", + "CCR" + ], + "allLabelDesc": [ + "CC Initiated", + "CC Approved", + "UI", + "IV", + "CC Closed", + "CC Rejected" + ], + "tableLabelDesc": [ + "CC Initiated", + "CC Approved", + "UI", + "IV" + ], "closedStateLabel": "CCN5", "rejectedStateLabel": "CCR" }, { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", "title": "closure time(in days)", - "allLabels": ["CCN1", "CCN2", "CCN3", "CCN4", "CCN5", "CCR"], - "initialStateLabels": ["CCN1", "CCN2", "CCN3", "CCN4"], - "allLabelDesc": ["CC Initiated", "CC Approved", "UI", "IV", "CC Closed", "CC Rejected"], + "allLabels": [ + "CCN1", + "CCN2", + "CCN3", + "CCN4", + "CCN5", + "CCR" + ], + "initialStateLabels": [ + "CCN1", + "CCN2", + "CCN3", + "CCN4" + ], + "allLabelDesc": [ + "CC Initiated", + "CC Approved", + "UI", + "IV", + "CC Closed", + "CC Rejected" + ], "initialSateLabel": "CCN1", "closedStateLabel": "CCN5", "rejectedStateLabel": "CCR" @@ -1445,12 +1808,13 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", "title": "count by department", "labels": [ + "MHC", "QC", "RA", "Production", @@ -1465,6 +1829,7 @@ "QA" ], "labelsDesc": [ + "Common", "QC", "RA", "Prod", @@ -1482,7 +1847,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -1511,7 +1876,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": [ @@ -1531,7 +1896,11 @@ "DCN4", "DR1" ], - "initialStateLabels": ["DCN1", "DCN2", "DCN3"], + "initialStateLabels": [ + "DCN1", + "DCN2", + "DCN3" + ], "allLabelDesc": [ "DC Initiated", "Approved by HOD", @@ -1546,7 +1915,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": [ @@ -1564,23 +1933,55 @@ "#ff7f0e", "#9467bd" ], - "allLabels": ["DCN1", "DCN2", "DCN3", "DCN4","DR1"], - "allLabelDesc": ["DC Initiated", "Approved by HOD", "DC Approved", "DC Closed", "DC Rejected"], - "tableLabelDesc": ["DC Initiated", "Approved by HOD", "DC Approved"], + "allLabels": [ + "DCN1", + "DCN2", + "DCN3", + "DCN4", + "DR1" + ], + "allLabelDesc": [ + "DC Initiated", + "Approved by HOD", + "DC Approved", + "DC Closed", + "DC Rejected" + ], + "tableLabelDesc": [ + "DC Initiated", + "Approved by HOD", + "DC Approved" + ], "closedStateLabel": "DCN4", "rejectedStateLabel": "DR1" }, { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", "title": "closure time(in days)", - "allLabels": ["DCN1", "DCN2", "DCN3", "DCN4","DR1"], - "initialStateLabels": ["DCN1", "DCN2", "DCN3"], - "allLabelDesc": ["DC Initiated", "Approved by HOD", "DC Approved", "DC Closed", "DC Rejected"], + "allLabels": [ + "DCN1", + "DCN2", + "DCN3", + "DCN4", + "DR1" + ], + "initialStateLabels": [ + "DCN1", + "DCN2", + "DCN3" + ], + "allLabelDesc": [ + "DC Initiated", + "Approved by HOD", + "DC Approved", + "DC Closed", + "DC Rejected" + ], "initialSateLabel": "DCN1", "closedStateLabel": "DCN4", "rejectedStateLabel": "DR1" @@ -1599,6 +2000,7 @@ "version": "1.0.0", "dataSources": [ { + "id": "capalabels", "type": "Labels" } ], @@ -1713,12 +2115,13 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", "title": "count by department", "labels": [ + "MHC", "QC", "RA", "Production", @@ -1733,6 +2136,7 @@ "QA" ], "labelsDesc": [ + "Common", "QC", "RA", "Prod", @@ -1750,7 +2154,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -1771,7 +2175,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -1794,7 +2198,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": [ @@ -1810,7 +2214,10 @@ "CR2", "CR3" ], - "initialStateLabels": ["CR1", "CR2"], + "initialStateLabels": [ + "CR1", + "CR2" + ], "allLabelDesc": [ "NCR Initiated", "NCR Approved", @@ -1823,7 +2230,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": [ @@ -1838,23 +2245,45 @@ "#d62728", "#ff7f0e" ], - "allLabels": ["CR1", "CR2", "CR3"], - "allLabelDesc": ["NCR Initiated", "NCR Approved", "NCR Closed"], - "tableLabelDesc": ["NCR Initiated", "NCR Approved"], + "allLabels": [ + "CR1", + "CR2", + "CR3" + ], + "allLabelDesc": [ + "NCR Initiated", + "NCR Approved", + "NCR Closed" + ], + "tableLabelDesc": [ + "NCR Initiated", + "NCR Approved" + ], "closedStateLabel": "CR3", "rejectedStateLabel": "" }, { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", "title": "closure time(in days)", - "allLabels": ["CR1", "CR2", "CR3"], - "initialStateLabels": ["CR1", "CR2"], - "allLabelDesc": ["NCR Initiated", "NCR Approved", "NCR Closed"], + "allLabels": [ + "CR1", + "CR2", + "CR3" + ], + "initialStateLabels": [ + "CR1", + "CR2" + ], + "allLabelDesc": [ + "NCR Initiated", + "NCR Approved", + "NCR Closed" + ], "initialSateLabel": "CR1", "closedStateLabel": "CR3", "rejectedStateLabel": "" @@ -1873,6 +2302,7 @@ "version": "1.0.0", "dataSources": [ { + "id": "capalabels", "type": "Labels" } ], @@ -1987,12 +2417,13 @@ { "id": "dept", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Department", "title": "count by department", "labels": [ + "MHC", "QC", "RA", "Production", @@ -2007,6 +2438,7 @@ "QA" ], "labelsDesc": [ + "Common", "QC", "RA", "Prod", @@ -2024,7 +2456,7 @@ { "id": "cat", "type": "groupBy", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Category", @@ -2047,7 +2479,7 @@ { "id": "status", "type": "groupByState", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Current State", @@ -2073,7 +2505,7 @@ { "id": "avg", "type": "avg", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "title": "average time spent in state", "labels": [ @@ -2090,7 +2522,10 @@ "EV3", "DR" ], - "initialStateLabels": ["EV1", "EN2"], + "initialStateLabels": [ + "EV1", + "EN2" + ], "allLabelDesc": [ "Deviation Initiated", "Deviation Approved", @@ -2104,7 +2539,7 @@ { "id": "tracker", "type": "tracker", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "labels": [ @@ -2119,10 +2554,21 @@ "#d62728", "#ff7f0e" ], - "allLabels": ["EV1", "EN2", "EV3", "DR"], - "allLabelDesc": ["Deviation Initiated", "Deviation Approved", "Deviation Closed","Deviation Rejected"], + "allLabels": [ + "EV1", + "EN2", + "EV3", + "DR" + ], + "allLabelDesc": [ + "Deviation Initiated", + "Deviation Approved", + "Deviation Closed", + "Deviation Rejected" + ], "tableLabelDesc": [ - "Deviation Initiated", "Deviation Approved" + "Deviation Initiated", + "Deviation Approved" ], "closedStateLabel": "EV3", "rejectedStateLabel": "DR" @@ -2130,14 +2576,27 @@ { "id": "closure", "type": "closure", - "dataSourceType": "Labels", + "dataSourceType": "capalabels", "renderChart": "Y", "showInTable": "Y", "tableHeader": "Closure Time", "title": "closure time(in days)", - "allLabels": ["EV1", "EN2", "EV3", "DR"], - "initialStateLabels": ["EV1", "EN2"], - "allLabelDesc": ["Deviation Initiated", "Deviation Approved", "Deviation Closed","Deviation Rejected"], + "allLabels": [ + "EV1", + "EN2", + "EV3", + "DR" + ], + "initialStateLabels": [ + "EV1", + "EN2" + ], + "allLabelDesc": [ + "Deviation Initiated", + "Deviation Approved", + "Deviation Closed", + "Deviation Rejected" + ], "initialSateLabel": "EV1", "closedStateLabel": "EV3", "rejectedStateLabel": "DR" diff --git a/src/api/Matrix.Labels.ts b/src/api/Matrix.Labels.ts index 9cd22b8..0120034 100644 --- a/src/api/Matrix.Labels.ts +++ b/src/api/Matrix.Labels.ts @@ -1,5 +1,6 @@ /// /// +/// /// namespace Matrix { @@ -7,11 +8,11 @@ namespace Matrix { /** * Get the label history for all items in a project */ - export function projectLabelHistory(): Promise { - return new Promise((resolve, reject) => { + export function projectLabelHistory(resourceId: string, resourceType: string): Promise { + return new Promise((resolve, reject) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars - Matrix.REST.projectGETRequest("/labelhistory") - .then((data: XRLabelHistory) => resolve(data.entries as XRLabelEntry[])) + Matrix.REST.projectGETRequest("/labelhistory") + .then((data: XRLabelHistory) => resolve({id:resourceId,type:resourceType,source:data.entries})) .catch((error) => reject(error)); }); } @@ -19,11 +20,33 @@ namespace Matrix { /** * Get needles by category and field id for all items in a project */ - export function getNeedlesByCategoryAndFiledId(category: string, fieldId: Number): Promise { - return new Promise((resolve, reject) => { + export function getNeedlesByCategoryAndFiledId(resourceId: string, resourceType: string, category: string, fieldId: Number): Promise { + return new Promise((resolve, reject) => { // eslint-disable-next-line @typescript-eslint/no-unused-vars Matrix.REST.projectGETRequest("/needle?search=mrql:category="+category+"&fieldsOut="+fieldId) - .then((data: XRTrimNeedle) => resolve(data.needles as XRTrimNeedleItem[])) + .then((data: XRTrimNeedle) => resolve({id:resourceId,type:resourceType,source:data.needles})) + .catch((error) => reject(error)); + }); + } + + /** + * Get needles by category and field id for all items in a project + */ + // export function getNeedlesBySearch(resourceId: string, resourceType: string, searchParams: string): Promise { + // return new Promise((resolve, reject) => { + // Matrix.REST.projectGETRequest("/needle?search=mrql:"+searchParams) + // .then((data: XRTrimNeedle) => resolve({id:resourceId,type:resourceType,source:data.needles})) + // .catch((error) => reject(error)); + // }); + // } + + /** + * Get needles by category and field id for all items in a project + */ + export function getNeedlesBySearch(resourceId: string, resourceType: string, category: string, fieldId: Number): Promise { + return new Promise((resolve, reject) => { + Matrix.REST.projectGETRequest("/needle?search=mrql:category="+category+"&fieldsOut="+fieldId+"&labels=1") + .then((data: XRTrimNeedle) => resolve({id:resourceId,type:resourceType,source:data.needles})) .catch((error) => reject(error)); }); } diff --git a/src/api/Matrix.d.ts b/src/api/Matrix.d.ts new file mode 100644 index 0000000..5561ab4 --- /dev/null +++ b/src/api/Matrix.d.ts @@ -0,0 +1,8 @@ +/// +/// + +interface resourcesData { + id: string; + type: string; + source: XRLabelEntry[] | XRTrimNeedleItem[]; +} \ No newline at end of file diff --git a/src/commons/Commons.GenericFunctionalities.ts b/src/commons/Commons.GenericFunctionalities.ts index bf6c900..6aace6d 100644 --- a/src/commons/Commons.GenericFunctionalities.ts +++ b/src/commons/Commons.GenericFunctionalities.ts @@ -82,12 +82,17 @@ namespace Commons { let avgData: avgObject[] = []; let closureData: closureObject[] = []; let trackerData: trackerObject[] = []; + let groupByNcrDeptData: groupByNcrDeptObject[] = []; + let groupByNcrAuditorData: groupByNcrAuditorObject[] = []; let dateRangeCompareData: dateRangeCompareObject[] = []; let groupByStackCurrentLabelData: groupByStackCurrentData[] = []; let groupByObjectCurrentLabelData: groupByObjectCurrentData[] = []; let closureLabelCurrentData: closureObjectCurrentData[] = []; let dateRangeCompareCurrentLabelData: groupByObjectCurrentData[] = []; let trackerLabelCurrentData: Map = new Map(); + let groupByNcrDeptCurrentLabelData: groupByNcrDeptCurrentData[] = []; + let currentAuditorInfoData: auditorInfoCurrentData[] = []; + let currentAuditFindingsData: auditFindingsCurrentData[] = []; let operandsData: Map = new Map(); category.functionalities.forEach(functionality => { @@ -325,7 +330,6 @@ namespace Commons { } break; case 'dateRangeComapre': - let dateRangeComapreObject: dateRangeCompareObject = { id: functionality.id, dataSourceType: functionality.dataSourceType, @@ -341,6 +345,70 @@ namespace Commons { }; dateRangeCompareData.push(dateRangeComapreObject); break; + case 'groupByNcrDept': + let ncOptions = []; + let groupByNcrDeptWiseData = []; + let groupByNcrDeptInitials = Array(functionality.labels.length).fill(0); + let fieldAuditFindings = IC.getFieldByName(category.id,functionality.sourceTableName); + let ncCatColumn = fieldAuditFindings.parameterJson.columns.find(col=>col.name == functionality.sourceTableColumnName); + let ncDropDownOptions = IC.getDropDowns(ncCatColumn.options.setting).pop(); + if( ncDropDownOptions && ncDropDownOptions.value && ncDropDownOptions.value.options){ + ncOptions = ncDropDownOptions.value.options; + for( let option of ncDropDownOptions.value.options){ + groupByNcrDeptWiseData.push([option.label, ...groupByNcrDeptInitials]); + } + } + let groupByNcrDeptObject: groupByNcrDeptObject = { + id: functionality.id, + dataSourceType: functionality.dataSourceType, + renderChart: functionality.renderChart, + sourceTableName: functionality.sourceTableName, + sourceTableColumnName: functionality.sourceTableColumnName, + labels: functionality.labels, + labelsDesc: functionality.labelsDesc, + ncOptions: ncOptions, + ncCatColumnField: ncCatColumn.field, + groupByNcrDeptWiseData: groupByNcrDeptWiseData, + currentLabelData: groupByNcrDeptCurrentLabelData + }; + groupByNcrDeptData.push(groupByNcrDeptObject); + break; + case 'groupByNcrAuditor': + let groupByNcrAuditorWiseData = [ + ['x'], + ['No of audits performed'], + ['No of NC given'], + ['NC ratio'] + ]; + let fieldAuditorInfo = IC.getFieldByName(category.id,functionality.auditorSourceTableName); + let auditorTypeColumn = fieldAuditorInfo.parameterJson.columns.find(col=>col.name == functionality.auditorTypeColumnName); + let auditorNameColumn = fieldAuditorInfo.parameterJson.columns.find(col=>col.name == functionality.auditorNameColumnName); + let auditorDropDownOptions = IC.getDropDowns(auditorTypeColumn.options.setting).pop(); + let auditorOptionId = ""; + if( auditorDropDownOptions && auditorDropDownOptions.value && auditorDropDownOptions.value.options){ + for( let option of auditorDropDownOptions.value.options){ + if(option.label == functionality.auditorOptionLabel){ + auditorOptionId = option.id; + } + } + } + let groupByNcrAuditorObject: groupByNcrAuditorObject = { + id: functionality.id, + dataSources: functionality.dataSources, + renderChart: functionality.renderChart, + auditorSourceTableName: functionality.auditorSourceTableName, + auditorTypeColumnName: functionality.auditorTypeColumnName, + auditorNameColumnName: functionality.auditorNameColumnName, + auditorOptionLabel: functionality.auditorOptionLabel, + auditorOptionId: auditorOptionId, + auditorTypeColumnField: auditorTypeColumn.field, + auditorNameColumnField: auditorNameColumn.field, + groupByNcrAuditorWiseData: groupByNcrAuditorWiseData, + currentAuditorInfoData: currentAuditorInfoData, + currentAuditFindingsData: currentAuditFindingsData + }; + groupByNcrAuditorData.push(groupByNcrAuditorObject); + break; }; }); @@ -352,6 +420,8 @@ namespace Commons { groupByStateData: groupByStateData, groupByStateOverdueData: groupByStateOverdueData, groupByStackData: groupByStackData, + groupByNcrDeptData: groupByNcrDeptData, + groupByNcrAuditorData: groupByNcrAuditorData, avgData: avgData, closureData: closureData, trackerData: trackerData, @@ -1097,5 +1167,129 @@ namespace Commons { } + export function processGroupByNcrDeptObjectData(groupByNcrDeptObject: groupByNcrDeptObject, + groupByNcrDeptObjectDataSource: XRTrimNeedleItem[]) { + + for (const item of groupByNcrDeptObjectDataSource) { + if(item.labels){ + let itemDeptIndex = -1; + for(const label of groupByNcrDeptObject.labels){ + if(item.labels.includes(label)){ + let labelIndex = groupByNcrDeptObject.labels.findIndex(labelCode => labelCode === label); + itemDeptIndex = labelIndex; + break; + } + } + + if(itemDeptIndex > 0){ + if(item.fieldVal.length == 1){ + let auditFindingTable = JSON.parse(item.fieldVal[0].value); + for( let auditFindingLine of auditFindingTable){ + let ncId = auditFindingLine[groupByNcrDeptObject.ncCatColumnField]; + let ncOption = groupByNcrDeptObject.ncOptions.find(ncOption => ncOption.id === ncId); + groupByNcrDeptObject.groupByNcrDeptWiseData.forEach(ncDeptWiseData => { + if(ncDeptWiseData[0] == ncOption.label){ + ncDeptWiseData[itemDeptIndex+1] += 1; + } + }); + + let groupByNcrDeptCurrentData: groupByNcrDeptCurrentData = { + id: item.itemOrFolderRef, + creationDate: new Date(item.creationDate), + labels: item.labels, + ncLabel: ncOption.label + }; + + groupByNcrDeptObject.currentLabelData.push(groupByNcrDeptCurrentData); + + } + } + } + } + } + } + + export function processGroupByNcrAuditorObjectData(groupByNcrAuditorObject: groupByNcrAuditorObject, + auditFindingsDataSource: XRTrimNeedleItem[], + auditorinfoDataSource: XRTrimNeedleItem[], + ) { + + let auditorsData = []; + let auditCountData = []; + let auditItemsData = []; + let auditNcCountData = []; + let auditNcRatio = []; + + for (const auditInfoItem of auditorinfoDataSource) { + if(auditInfoItem.fieldVal.length == 1){ + let auditInfoTable = JSON.parse(auditInfoItem.fieldVal[0].value); + for( let auditInfoLine of auditInfoTable){ + let auditorOptionId = auditInfoLine[groupByNcrAuditorObject.auditorTypeColumnField]; + if(auditorOptionId == groupByNcrAuditorObject.auditorOptionId){ + let auditorName = auditInfoLine[groupByNcrAuditorObject.auditorNameColumnField]; + + let auditorInfoCurrentData: auditorInfoCurrentData = { + id: auditInfoItem.itemOrFolderRef, + creationDate: new Date(auditInfoItem.creationDate), + auditorName: auditorName, + auditorOptionId: auditorOptionId + }; + + groupByNcrAuditorObject.currentAuditorInfoData.push(auditorInfoCurrentData); + + let auditorIndex = auditorsData.findIndex(auditor => auditor === auditorName); + if(auditorIndex > -1){ + auditCountData[auditorIndex] += 1; + auditItemsData[auditorIndex].push(auditInfoItem.itemOrFolderRef); + }else{ + auditorsData.push(auditorName); + auditCountData.push(1); + auditItemsData.push([auditInfoItem.itemOrFolderRef]) + auditNcCountData.push(0); + auditNcRatio.push(0); + } + } + } + } + } + + for (const auditFindingItem of auditFindingsDataSource) { + if(auditFindingItem.fieldVal.length == 1){ + let auditFindingTable = JSON.parse(auditFindingItem.fieldVal[0].value); + let itemIndex = -1; + for( let auditItems of auditItemsData){ + itemIndex += 1; + let auditorItemIndex = auditItems.findIndex(itemRefId => itemRefId === auditFindingItem.itemOrFolderRef); + if(auditorItemIndex > 0){ + let auditNcCount = auditFindingTable.length; + auditNcCountData[itemIndex] += auditNcCount; + + let auditFindingsCurrentData: auditFindingsCurrentData = { + id: auditFindingItem.itemOrFolderRef, + creationDate: new Date(auditFindingItem.creationDate), + auditNcCount: auditNcCount + }; + + groupByNcrAuditorObject.currentAuditFindingsData.push(auditFindingsCurrentData); + break; + } + } + } + } + + auditorsData.forEach((auditor, index) => { + if(auditNcCountData[index] !== 0){ + auditNcRatio[index] = Math.round(((auditNcCountData[index]/auditCountData[index]) + Number.EPSILON) * 100) / 100; + } + }); + + groupByNcrAuditorObject.groupByNcrAuditorWiseData = [ + ['x', ...auditorsData], + ['No of audits performed',...auditCountData], + ['No of NC given', ...auditNcCountData], + ['NC ratio', ...auditNcRatio] + ]; + } + } } \ No newline at end of file diff --git a/src/interfaces/generic-dashboard.d.ts b/src/interfaces/generic-dashboard.d.ts index 49d6931..fa3976c 100644 --- a/src/interfaces/generic-dashboard.d.ts +++ b/src/interfaces/generic-dashboard.d.ts @@ -24,6 +24,26 @@ interface trackerObjectCurrentData { itemStateDays: Map; } +interface groupByNcrDeptCurrentData { + id: string; + creationDate: Date; + labels: string; + ncLabel: string; +} + +interface auditorInfoCurrentData { + id: string; + creationDate: Date; + auditorName: string; + auditorOptionId: string; +} + +interface auditFindingsCurrentData { + id: string; + creationDate: Date; + auditNcCount: Number; +} + interface operandObjectData { operand: string; labelsState: Map; @@ -79,6 +99,36 @@ interface groupByStateObject { currentLabelData: groupByObjectCurrentData[]; } +interface groupByNcrDeptObject { + id: string; + dataSourceType: string; + renderChart: string; + sourceTableName: string; + sourceTableColumnName: string; + labels: any[]; + labelsDesc: any[]; + ncOptions: any[]; + ncCatColumnField: string; + groupByNcrDeptWiseData: any[]; + currentLabelData: groupByNcrDeptCurrentData[]; +} + +interface groupByNcrAuditorObject { + id: string; + dataSources: string[]; + renderChart: string; + auditorSourceTableName: string; + auditorTypeColumnName: string; + auditorNameColumnName: string; + auditorOptionLabel: string; + auditorOptionId: string; + auditorTypeColumnField: string; + auditorNameColumnField: string; + groupByNcrAuditorWiseData: any[]; + currentAuditorInfoData: auditorInfoCurrentData[]; + currentAuditFindingsData: auditFindingsCurrentData[]; +} + interface groupByStateOverDueObject extends groupByStateObject { dataSources: any[]; OpenItemsDueDateMap: Map; @@ -178,6 +228,8 @@ interface ByCategoryLabelData { groupByStateData: groupByStateObject[]; groupByStackData: groupByStackObject[]; groupByStateOverdueData: groupByStateOverDueObject[]; + groupByNcrDeptData: groupByNcrDeptObject[]; + groupByNcrAuditorData: groupByNcrAuditorObject[]; avgData: avgObject[]; closureData: closureObject[]; trackerData: trackerObject[];