From b9ceb7e147cb23b618106b0b2c592eca42841da8 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Wed, 22 Apr 2015 12:39:39 -0400 Subject: [PATCH 1/8] Improvement schema.sql --- workflow/engine/data/mysql/schema.sql | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 22fa6d65d..1de922822 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2705,12 +2705,13 @@ CREATE TABLE `USR_REPORTING` `TOTAL_TIME_BY_TASK` DECIMAL(7,2) default 0, `TOTAL_CASES_IN` DECIMAL(7,2) default 0, `TOTAL_CASES_OUT` DECIMAL(7,2) default 0, + `USER_HOUR_COST` DECIMAL(7,2) default 0, `AVG_TIME` DECIMAL(7,2) default 0, `SDV_TIME` DECIMAL(7,2) default 0, `CONFIGURED_TASK_TIME` DECIMAL(7,2) default 0, `TOTAL_CASES_OVERDUE` DECIMAL(7,2) default 0, `TOTAL_CASES_ON_TIME` DECIMAL(7,2) default 0, - PRIMARY KEY (`USR_UID`, `TAS_UID`,`MONTH`,`YEAR`) + PRIMARY KEY (`USR_UID`, `TAS_UID`,`MONTH`,`YEAR`), KEY `indexApp`(`USR_UID`, `TAS_UID`, `PRO_UID`) )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Data calculated users by task'; #----------------------------------------------------------------------------- @@ -2763,16 +2764,20 @@ DROP TABLE IF EXISTS `DASHBOARD_INDICATOR`; CREATE TABLE `DASHBOARD_INDICATOR` ( - `DAS_IND_UID` VARCHAR(32) default '' NOT NULL, - `DAS_UID` VARCHAR(32) default '' NOT NULL, - `DAS_IND_TYPE` VARCHAR(32) default '' NOT NULL, - `DAS_IND_TITLE` VARCHAR(255) default '' NOT NULL, - `DAS_IND_GOAL` DECIMAL(7,2) default 0, - `DAS_UID_PROCESS` VARCHAR(32) default '' NOT NULL, - `DAS_IND_PROPERTIES` MEDIUMTEXT, - `DAS_CREATE_DATE` DATETIME NOT NULL, - `DAS_UPDATE_DATE` DATETIME, - `DAS_STATUS` TINYINT default 1 NOT NULL, + `DAS_IND_UID` VARCHAR(32) default '' NOT NULL, + `DAS_UID` VARCHAR(32) default '' NOT NULL, + `DAS_IND_TYPE` VARCHAR(32) default '' NOT NULL, + `DAS_IND_TITLE` VARCHAR(255) default '' NOT NULL, + `DAS_IND_GOAL` DECIMAL(7,2) default 0, + `DAS_IND_DIRECTION` TINYINT default 2 NOT NULL, + `DAS_UID_PROCESS` VARCHAR(32) default '' NOT NULL, + `DAS_IND_FIRST_FIGURE` VARCHAR(32) default '', + `DAS_IND_FIRST_FREQUENCY` VARCHAR(32) default '', + `DAS_IND_SECOND_FIGURE` VARCHAR(32) default '', + `DAS_IND_SECOND_FREQUENCY` VARCHAR(32) default '', + `DAS_IND_CREATE_DATE` DATETIME NOT NULL, + `DAS_IND_UPDATE_DATE` DATETIME, + `DAS_IND_STATUS` TINYINT default 1 NOT NULL, PRIMARY KEY (`DAS_UID`), KEY `indexDashboard`(`DAS_UID`, `DAS_IND_TYPE`), CONSTRAINT `fk_dashboard_indicator_dashboard` From 9e6150a2c4c82d143cf038315c59c3c460c160d1 Mon Sep 17 00:00:00 2001 From: Dante Date: Wed, 22 Apr 2015 13:30:25 -0400 Subject: [PATCH 2/8] Styles fixes --- .../classes/model/DashboardIndicator.php | 6 +- .../viewDashboardPresenter.js | 99 ++++++++++++------- .../strategicDashboard/viewDashboardView.js | 15 +-- .../BusinessModel/ReportingIndicators.php | 3 +- .../strategicDashboard/viewDashboard.html | 24 +++-- workflow/public_html/css/general.css | 4 +- workflow/public_html/css/gridstack.css | 25 ++--- workflow/public_html/css/sb-admin-2.css | 6 +- 8 files changed, 115 insertions(+), 67 deletions(-) diff --git a/workflow/engine/classes/model/DashboardIndicator.php b/workflow/engine/classes/model/DashboardIndicator.php index c33abdf7c..e0eef6b5c 100644 --- a/workflow/engine/classes/model/DashboardIndicator.php +++ b/workflow/engine/classes/model/DashboardIndicator.php @@ -27,7 +27,7 @@ class DashboardIndicator extends BaseDashboardIndicator throw $error; } } - function loadbyDasUid ($dasUid, $vmeasureDate, $vcompareDate, $userUid) + function loadbyDasUid ($dasUid, $vcompareDate, $vmeasureDate, $userUid) { G::loadClass('indicatorsCalculator'); $calculator = new \IndicatorsCalculator(); @@ -64,11 +64,15 @@ class DashboardIndicator extends BaseDashboardIndicator $value = current(reset($calculator->peiHistoric($uid, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE))); $oldValue = current(reset($calculator->peiHistoric($uid, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE))); $row['DAS_IND_VARIATION'] = $value - $oldValue; + $row['DAS_IND_OLD_VALUE'] = $oldValue; + $row['DAS_IND_PERCENT_VARIATION'] = round(($value - $oldValue) * 100 / (($oldValue == 0) ? 1 : $oldValue), 1); break; case '1030': $value = current(reset($calculator->ueiHistoric(null, $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE))); $oldValue = current(reset($calculator->ueiHistoric($uid, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE))); $row['DAS_IND_VARIATION'] = $value - $oldValue; + $row['DAS_IND_OLD_VALUE'] = $oldValue; + $row['DAS_IND_PERCENT_VARIATION'] = round(($value - $oldValue) * 100 / (($oldValue == 0) ? 1 : $oldValue), 1); break; case '1050': $value = $calculator->statusIndicatorGeneral($userUid); diff --git a/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js b/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js index b8e135391..435c4f8ba 100644 --- a/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js +++ b/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js @@ -57,6 +57,7 @@ ViewDashboardPresenter.prototype.dashboardIndicatorsViewModel = function(data) { "DAS_IND_TITLE" : "title", "DAS_IND_TYPE" : "type", "DAS_IND_VARIATION" : "comparative", + "DAS_IND_PERCENT_VARIATION" : "percentComparative", "DAS_IND_DIRECTION" : "direction", "DAS_IND_VALUE" : "value", "DAS_IND_X" : "x", @@ -76,7 +77,6 @@ ViewDashboardPresenter.prototype.dashboardIndicatorsViewModel = function(data) { newObject.toDrawY = (newObject.y == 0) ? 6 : newObject.y; newObject.toDrawHeight = (newObject.y == 0) ? 2 : newObject.height; newObject.toDrawWidth = (newObject.y == 0) ? 12 / data.length : newObject.width; - newObject.comparative = ((newObject.comparative > 0)? "+": "") + that.helper.stringIfNull(newObject.comparative); newObject.directionSymbol = (newObject.direction == "1") ? "<" : ">"; newObject.isWellDone = (newObject.direction == "1") ? parseFloat(newObject.value) <= parseFloat(newObject.comparative) @@ -86,10 +86,9 @@ ViewDashboardPresenter.prototype.dashboardIndicatorsViewModel = function(data) { ? "special" : "normal"; - //round goals for normal indicators - newObject.comparative = (newObject.category == "normal") - ? Math.round(newObject.comparative) + "" - : newObject.comparative; + //rounding + newObject.comparative = Math.round(newObject.comparative*1000)/1000; + newObject.comparative = ((newObject.comparative > 0)? "+": "") + newObject.comparative; newObject.value = (newObject.category == "normal") ? Math.round(newObject.value) + "" @@ -170,7 +169,19 @@ ViewDashboardPresenter.prototype.peiViewModel = function(data) { : newObject.datalabel.substring(0,15); newObject.datalabel = shortLabel; - graphData.push(newObject); + + //use positive values for drawing; + if (newObject.value > 0) { + newObject.value = 0; + } + if (newObject.value < 0) { + newObject.value = Math.abs(newObject.value); + } + + if (newObject.value > 0) { + graphData.push(newObject); + } + originalObject.inefficiencyCostToShow = "$ " + Math.round(originalObject.inefficiencyCost); originalObject.efficiencyIndexToShow = Math.round(originalObject.efficiencyIndex * 100) / 100; originalObject.indicatorId = data.id; @@ -186,16 +197,6 @@ ViewDashboardPresenter.prototype.peiViewModel = function(data) { }) retval.dataToDraw = graphData.splice(0,7); - //use positive values for drawing; - $.each(retval.dataToDraw, function(index, item) { - if (item.value > 0) { - item.value = 0; - } - if (item.value < 0) { - item.value = Math.abs(item.value); - } - }); - //TODO aumentar el símbolo de moneda $ retval.inefficiencyCostToShow = "$ " +Math.round(retval.inefficiencyCost); @@ -220,7 +221,17 @@ ViewDashboardPresenter.prototype.ueiViewModel = function(data) { : newObject.datalabel.substring(0,7); newObject.datalabel = shortLabel; - graphData.push(newObject); + //use positive values for drawing; + if (newObject.value > 0) { + newObject.value = 0; + } + if (newObject.value < 0) { + newObject.value = Math.abs(newObject.value); + } + + if (newObject.value > 0) { + graphData.push(newObject); + } originalObject.inefficiencyCostToShow = "$ " + Math.round(originalObject.inefficiencyCost); originalObject.efficiencyIndexToShow = Math.round(originalObject.efficiencyIndex * 100) / 100; originalObject.indicatorId = data.id; @@ -231,22 +242,11 @@ ViewDashboardPresenter.prototype.ueiViewModel = function(data) { retval = data; graphData.sort(function(a,b) { var retval = 0; - retval = ((a.value*1.0 <= b.value*1.0) ? -1 : 1); + retval = ((a.value*1.0 <= b.value*1.0) ? 1 : -1); return retval; }) retval.dataToDraw = graphData.splice(0,7); - //use positive values for drawing; - $.each(retval.dataToDraw, function(index, item) { - if (item.value > 0) { - item.value = 0; - } - if (item.value < 0) { - item.value = Math.abs(item.value); - } - }); - - //TODO aumentar el símbolo de moneda $ retval.inefficiencyCostToShow = "$ " + Math.round(retval.inefficiencyCost); retval.efficiencyIndexToShow = Math.round(retval.efficiencyIndex * 100) / 100; @@ -366,16 +366,32 @@ ViewDashboardPresenter.prototype.returnIndicatorSecondLevelPei = function(modelD $.each(modelData, function(index, originalObject) { var map = { "name" : "datalabel", - "averageTime" : "value", + "inefficiencyCost" : "value", "deviationTime" : "dispersion" }; var newObject = that.helper.merge(originalObject, {}, map); newObject.datalabel = ((newObject.datalabel == null) ? "" : newObject.datalabel.substring(0, 7)); originalObject.inefficiencyCostToShow = "$ " + Math.round(originalObject.inefficiencyCost); originalObject.efficiencyIndexToShow = Math.round(originalObject.efficiencyIndex * 100) / 100; - graphData.push(newObject); + originalObject.deviationTimeToShow = Math.round(originalObject.deviationTime); + //use positive values for drawing; + if (newObject.value > 0) { + newObject.value = 0; + } + if (newObject.value < 0) { + newObject.value = Math.abs(newObject.value); + } + + if (newObject.value > 0) { + graphData.push(newObject); + } }); var retval = {}; + graphData.sort(function(a,b) { + var retval = 0; + retval = ((a.value*1.0 <= b.value*1.0) ? 1 : -1); + return retval; + }) retval.dataToDraw = graphData.splice(0,7); retval.entityData = modelData; return retval; @@ -391,16 +407,33 @@ ViewDashboardPresenter.prototype.returnIndicatorSecondLevelUei = function(modelD $.each(modelData, function(index, originalObject) { var map = { "name" : "datalabel", - "averageTime" : "value", + "inefficiencyCost" : "value", "deviationTime" : "dispersion" }; var newObject = that.helper.merge(originalObject, {}, map); newObject.datalabel = ((newObject.datalabel == null) ? "" : newObject.datalabel.substring(0, 7)); originalObject.inefficiencyCostToShow = "$ " +Math.round(originalObject.inefficiencyCost); originalObject.efficiencyIndexToShow = Math.round(originalObject.efficiencyIndex * 100) / 100; - graphData.push(newObject); + originalObject.deviationTimeToShow = Math.round(originalObject.deviationTime); + //use positive values for drawing; + if (newObject.value > 0) { + newObject.value = 0; + } + if (newObject.value < 0) { + newObject.value = Math.abs(newObject.value); + } + + if (newObject.value > 0) { + graphData.push(newObject); + } + }); var retval = {}; + graphData.sort(function(a,b) { + var retval = 0; + retval = ((a.value*1.0 <= b.value*1.0) ? 1 : -1); + return retval; + }) retval.dataToDraw = graphData.splice(0,7); retval.entityData = modelData; return retval; diff --git a/workflow/engine/js/strategicDashboard/viewDashboardView.js b/workflow/engine/js/strategicDashboard/viewDashboardView.js index 81b7590b5..358fdf233 100644 --- a/workflow/engine/js/strategicDashboard/viewDashboardView.js +++ b/workflow/engine/js/strategicDashboard/viewDashboardView.js @@ -134,7 +134,6 @@ WidgetBuilder.prototype.buildSpecialIndicatorSecondView = function (secondViewDa $retval.find(".sind-index-selector").text(G_STRING.ID_EFFICIENCY_INDEX); $retval.find(".sind-cost-selector").text(G_STRING.ID_INEFFICIENCY_COST); - $retval.find('.breadcrumb').find('li').remove(); $retval.find('.breadcrumb').append ('
  • ' + window.currentIndicator.title + '
  • '); $retval.find('.breadcrumb').append ('
  • ' + window.currentEntityData.name + '
  • '); @@ -273,7 +272,7 @@ $(document).ready(function() { } else { favoriteData = 0; }*/ - if (typeof idWidGet != "undefined") { + if (typeof idWidGet != "undefined" && el.hasClass('ind-button-selector')) { var widgetsObj = { 'indicatorId': idWidGet, 'x': item.x, @@ -282,6 +281,7 @@ $(document).ready(function() { 'height': item.height <= 1 ? 2 : item.height } widgets.push(widgetsObj); + console.log(widgetsObj); } }); @@ -513,7 +513,7 @@ var fillStatusIndicatorFirstView = function (presenterData) { showLabels: true } }; - + var graph1 = new PieChart(presenterData.graph1Data, graphParams1, null, null); graph1.drawChart(); var graphParams2 = graphParams1; @@ -588,8 +588,8 @@ var fillSpecialIndicatorFirstView = function(presenterData) { graph: { allowDrillDown:false, allowTransition:true, - axisX:{ showAxis: true, label: G_STRING.ID_YEAR }, - axisY:{ showAxis: true, label: "Q" }, + axisX:{ showAxis: true, label: "Group" }, + axisY:{ showAxis: true, label: "Cost" }, gridLinesX:false, gridLinesY:true, showTip: true, @@ -670,8 +670,8 @@ var fillSpecialIndicatorSecondView = function(presenterData) { gridLinesX: true, gridLinesY: true, area: {visible: false, css:"area"}, - axisX:{ showAxis: true, label: G_STRING.ID_USERS }, - axisY:{ showAxis: true, label: G_STRING.ID_TIME_HOURS }, + axisX:{ showAxis: true, label: "User" }, + axisY:{ showAxis: true, label: "Cost" }, showErrorBars: true } @@ -680,6 +680,7 @@ var fillSpecialIndicatorSecondView = function(presenterData) { var indicatorPrincipalData = widgetBuilder.getIndicatorLoadedById(window.currentEntityData.indicatorId); if (window.currentIndicator.type == "1010") { + detailParams.graph.axisX.label = "Task"; var graph = new BarChart(presenterData.dataToDraw, detailParams, null, null); graph.drawChart(); } diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/ReportingIndicators.php b/workflow/engine/src/ProcessMaker/BusinessModel/ReportingIndicators.php index 2491b49cb..3eed6e796 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/ReportingIndicators.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/ReportingIndicators.php @@ -33,7 +33,7 @@ class ReportingIndicators $retval = array( "id" => $indicatorUid, "efficiencyIndex" => $peiValue, - "efficiencyIndexCompare" => $peiCompare, + "efficiencyIndexToCompare" => $peiCompare, "efficiencyVariation" => ($peiValue-$peiCompare), "inefficiencyCost" => $peiCost, "data"=>$processes); @@ -68,6 +68,7 @@ class ReportingIndicators "efficiencyIndex" => $ueiValue, "efficiencyVariation" => ($ueiValue-$ueiCompare), "inefficiencyCost" => $ueiCost, + "efficiencyIndexToCompare" => $ueiCompare, "data"=>$groups); return $retval; } diff --git a/workflow/engine/templates/strategicDashboard/viewDashboard.html b/workflow/engine/templates/strategicDashboard/viewDashboard.html index a5b164793..4bf9a6c7e 100644 --- a/workflow/engine/templates/strategicDashboard/viewDashboard.html +++ b/workflow/engine/templates/strategicDashboard/viewDashboard.html @@ -55,7 +55,9 @@
    <%- indicator.value %>
    -
    <%- indicator.comparative %>
    +
    + <%- indicator.comparative %> (<%- indicator.percentComparative %> %) +
    @@ -209,14 +211,18 @@
    -
    +
    <%- detailData.efficiencyIndexToShow%>
    -
    +
    -
    +
    <%- detailData.inefficiencyCostToShow%>
    +
    +
    <%- detailData.deviationTimeToShow%>
    +
    SDV
    +
    @@ -286,18 +292,18 @@
  • -
    +
    Overdue:
    -
    +
    At Risk:
    -
    +
    On Time:
    -
    +
    @@ -399,7 +405,7 @@

    - Sort:     + Sort by Cost:    
    diff --git a/workflow/public_html/css/general.css b/workflow/public_html/css/general.css index ea1c5f609..620198892 100644 --- a/workflow/public_html/css/general.css +++ b/workflow/public_html/css/general.css @@ -53,7 +53,7 @@ background-color: #e14333; } .status-indicator-medium { - background-color: #fada5e; + background-color: #fcb322; } .status-indicator-high { background-color: #1fbc99; @@ -87,7 +87,7 @@ .ind-title-selector { text-overflow: ellipsis; white-space: nowrap; - overflow:hidden; + /*overflow:hidden;*/ } .ellipsis { diff --git a/workflow/public_html/css/gridstack.css b/workflow/public_html/css/gridstack.css index d9178f85b..54580fedb 100644 --- a/workflow/public_html/css/gridstack.css +++ b/workflow/public_html/css/gridstack.css @@ -71,18 +71,19 @@ content: "\f065"; } -.grid-stack-item[data-gs-width="12"] { width: 100% } -.grid-stack-item[data-gs-width="11"] { width: 91.66666667% } -.grid-stack-item[data-gs-width="10"] { width: 83.33333333% } -.grid-stack-item[data-gs-width="9"] { width: 75% } -.grid-stack-item[data-gs-width="8"] { width: 66.66666667% } -.grid-stack-item[data-gs-width="7"] { width: 58.33333333% } -.grid-stack-item[data-gs-width="6"] { width: 50% } -.grid-stack-item[data-gs-width="5"] { width: 41.66666667% } -.grid-stack-item[data-gs-width="4"] { width: 33.33333333% } -.grid-stack-item[data-gs-width="3"] { width: 25% } -.grid-stack-item[data-gs-width="2"] { width: 16.66666667% } -.grid-stack-item[data-gs-width="1"] { width: 8.33333333% } +.grid-stack-item[data-gs-width="12"] { width: 100%; margin-bottom: 45px; } +.grid-stack-item[data-gs-width="11"] { width: 91.66666667%; margin-bottom: 45px; } +.grid-stack-item[data-gs-width="10"] { width: 83.33333333% ; margin-bottom: 45px; } +.grid-stack-item[data-gs-width="9"] { width: 75%; margin-bottom: 45px; } +.grid-stack-item[data-gs-width="8"] { width: 66.66666667% ; margin-bottom: 45px; } +.grid-stack-item[data-gs-width="7"] { width: 58.33333333%; margin-bottom: 45px; } +.grid-stack-item[data-gs-width="6"] { width: 50%; margin-bottom: 45px; } +.grid-stack-item[data-gs-width="5"] { width: 41.66666667%; margin-bottom: 45px; } +.grid-stack-item[data-gs-width="4"] { width: 33.33333333%; margin-bottom: 45px; } +.grid-stack-item[data-gs-width="3"] { width: 25%; margin-bottom: 45px; } +.grid-stack-item[data-gs-width="2"] { width: 16.66666667%; margin-bottom: 45px; } +.grid-stack-item[data-gs-width="1"] { width: 8.33333333%; margin-bottom: 45px; } + .grid-stack-item[data-gs-x="12"] { left: 100% } .grid-stack-item[data-gs-x="11"] { left: 91.66666667% } diff --git a/workflow/public_html/css/sb-admin-2.css b/workflow/public_html/css/sb-admin-2.css index de0be12a1..8eaba37b7 100644 --- a/workflow/public_html/css/sb-admin-2.css +++ b/workflow/public_html/css/sb-admin-2.css @@ -547,6 +547,7 @@ table.dataTable thead .sorting:after { .indicators{ margin-bottom: 20px; + margin-bottom: 45px; } .panel-green:hover, .panel-red:hover, .panel-high:hover, .panel-low:hover{ @@ -566,7 +567,7 @@ table.dataTable thead .sorting:after { } .panel-active{ - background-color: #D99058; + /*background-color: #D99058;*/ position: relative; } @@ -583,7 +584,7 @@ table.dataTable thead .sorting:after { .panel-active:after { border-color: rgba(136, 183, 213, 0); - background-color: #000; + /*background-color: #000;*/ border-top-color: #fff; border-width: 20px; margin-left: -20px; @@ -633,6 +634,7 @@ table.dataTable thead .sorting:after { .process-div .panel-heading{ color:#606368; + font-size: 20px; } .process-div .panel-heading a{ From 534d6db10de4a17a3a16ad1c05cff1818331fe42 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Wed, 22 Apr 2015 16:34:25 -0400 Subject: [PATCH 3/8] Changed value default --- workflow/engine/config/schema.xml | 44 +++++++++++++-------------- workflow/engine/data/mysql/schema.sql | 7 ++--- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index d196baf25..979ab9f1a 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -1,4 +1,4 @@ - + @@ -269,7 +269,7 @@ - +
    @@ -4844,15 +4844,15 @@ - - - - - - - - - + + + + + + + + + @@ -4891,15 +4891,15 @@ - - - - - - - - - + + + + + + + + +
    @@ -4942,7 +4942,7 @@ - + @@ -5011,7 +5011,7 @@ - + diff --git a/workflow/engine/data/mysql/schema.sql b/workflow/engine/data/mysql/schema.sql index 1de922822..33e776ae9 100755 --- a/workflow/engine/data/mysql/schema.sql +++ b/workflow/engine/data/mysql/schema.sql @@ -2712,7 +2712,7 @@ CREATE TABLE `USR_REPORTING` `TOTAL_CASES_OVERDUE` DECIMAL(7,2) default 0, `TOTAL_CASES_ON_TIME` DECIMAL(7,2) default 0, PRIMARY KEY (`USR_UID`, `TAS_UID`,`MONTH`,`YEAR`), - KEY `indexApp`(`USR_UID`, `TAS_UID`, `PRO_UID`) + KEY `indexReporting`(`USR_UID`, `TAS_UID`, `PRO_UID`) )ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Data calculated users by task'; #----------------------------------------------------------------------------- #-- PRO_REPORTING @@ -2749,7 +2749,6 @@ CREATE TABLE `DASHBOARD` `DAS_UID` VARCHAR(32) default '' NOT NULL, `DAS_TITLE` VARCHAR(255) default '' NOT NULL, `DAS_DESCRIPTION` MEDIUMTEXT, - `DAS_VERSION` VARCHAR(10) default '1.0' NOT NULL, `DAS_CREATE_DATE` DATETIME NOT NULL, `DAS_UPDATE_DATE` DATETIME, `DAS_STATUS` TINYINT default 1 NOT NULL, @@ -2778,7 +2777,7 @@ CREATE TABLE `DASHBOARD_INDICATOR` `DAS_IND_CREATE_DATE` DATETIME NOT NULL, `DAS_IND_UPDATE_DATE` DATETIME, `DAS_IND_STATUS` TINYINT default 1 NOT NULL, - PRIMARY KEY (`DAS_UID`), + PRIMARY KEY (`DAS_IND_UID`), KEY `indexDashboard`(`DAS_UID`, `DAS_IND_TYPE`), CONSTRAINT `fk_dashboard_indicator_dashboard` FOREIGN KEY (`DAS_UID`) @@ -2796,7 +2795,7 @@ CREATE TABLE `DASHBOARD_DAS_IND` `DAS_UID` VARCHAR(32) default '' NOT NULL, `OWNER_UID` VARCHAR(32) default '' NOT NULL, `OWNER_TYPE` VARCHAR(15) default '' NOT NULL, - PRIMARY KEY (`DAS_UID`), + PRIMARY KEY (`DAS_UID`,`OWNER_UID`), CONSTRAINT `fk_dashboard_indicator_dashboard_das_ind` FOREIGN KEY (`DAS_UID`) REFERENCES `DASHBOARD` (`DAS_UID`) From 0d11381fc7fbdfdd23beec194365d83901512dfb Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Thu, 23 Apr 2015 13:22:37 -0400 Subject: [PATCH 4/8] Add validation characters invalid --- .../src/ProcessMaker/BusinessModel/User.php | 2 +- .../strategicDashboard/formDashboard.js | 23 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/User.php b/workflow/engine/src/ProcessMaker/BusinessModel/User.php index 1a8e0fc51..e89a4ae7b 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/User.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/User.php @@ -363,7 +363,7 @@ class User /*----------------------------------********---------------------------------*/ $this->getFieldNameByFormatFieldName("USR_COST_BY_HOUR") => $record["USR_COST_BY_HOUR"], $this->getFieldNameByFormatFieldName("USR_UNIT_COST") => $record["USR_UNIT_COST"], - /*---------------------------------********---------------------------------*/ + /*----------------------------------********---------------------------------*/ $this->getFieldNameByFormatFieldName("USR_TOTAL_INBOX") => $record["USR_TOTAL_INBOX"], $this->getFieldNameByFormatFieldName("USR_TOTAL_DRAFT") => $record["USR_TOTAL_DRAFT"], $this->getFieldNameByFormatFieldName("USR_TOTAL_CANCELLED") => $record["USR_TOTAL_CANCELLED"], diff --git a/workflow/engine/templates/strategicDashboard/formDashboard.js b/workflow/engine/templates/strategicDashboard/formDashboard.js index ab4025611..71e5f7380 100644 --- a/workflow/engine/templates/strategicDashboard/formDashboard.js +++ b/workflow/engine/templates/strategicDashboard/formDashboard.js @@ -79,11 +79,13 @@ Ext.onReady( function() { items : [ { id : 'DAS_TITLE', - fieldLabel : _('ID_DASHBOARD_TITLE'), + fieldLabel : _('ID_DASHBOARD_TITLE')+ ' *', xtype : 'textfield', anchor : '85%', maxLength : 250, - maskRe : /([a-zA-Z0-9\s]+)$/, + maskRe : /([a-zA-Z0-9_'\s]+)$/, + regex : /([a-zA-Z0-9_'\s]+)$/, + regexText : _('ID_INVALID_VALUE', _('ID_DASHBOARD_TITLE')), allowBlank : false }, { @@ -92,7 +94,7 @@ Ext.onReady( function() { fieldLabel : _('ID_DESCRIPTION'), labelSeparator : '', anchor : '85%', - maskRe : /([a-zA-Z0-9\s]+)$/, + maskRe : /([a-zA-Z0-9_'\s]+)$/, height : 50, } ] @@ -671,7 +673,6 @@ Ext.onReady( function() { ] }); - ownerInfoGrid.store.load(); ownerInfoGrid.on("afterrender", function(component) { component.getBottomToolbar().refresh.hideParent = true; component.getBottomToolbar().refresh.hide(); @@ -698,6 +699,7 @@ Ext.onReady( function() { } dashboardOwnerFields.items.items[0].bindStore(dataUserGroup); } ); + storeUsers.on( 'load', function( store, records, options ) { for (var i=0; i< store.data.length; i++) { row = []; @@ -751,11 +753,13 @@ var addTab = function (flag) { hidden : true }, { - fieldLabel : _('ID_INDICATOR_TITLE'), + fieldLabel : _('ID_INDICATOR_TITLE')+ ' *', id : 'IND_TITLE_'+ indexTab, xtype : 'textfield', anchor : '85%', - maskRe : /([a-zA-Z0-9\s]+)$/, + maskRe : /([a-zA-Z0-9_'\s]+)$/, + regex : /([a-zA-Z0-9_'\s]+)$/, + regexText : _('ID_INVALID_VALUE', _('ID_INDICATOR_TITLE')), maxLength : 250, allowBlank : false }, @@ -763,7 +767,7 @@ var addTab = function (flag) { anchor : '85%', editable : false, id : 'IND_TYPE_'+ indexTab, - fieldLabel : _('ID_INDICATOR_TYPE'), + fieldLabel : _('ID_INDICATOR_TYPE')+ ' *', displayField : 'CAT_LABEL_ID', valueField : 'CAT_UID', forceSelection : false, @@ -874,7 +878,7 @@ var addTab = function (flag) { new Ext.form.ComboBox({ anchor : '85%', editable : false, - fieldLabel : _('ID_PROCESS'), + fieldLabel : _('ID_PROCESS')+ ' *', id : 'IND_PROCESS_'+ indexTab, displayField : 'prj_name', valueField : 'prj_uid', @@ -1086,7 +1090,6 @@ var saveDashboard = function () { }, data: JSON.stringify(data), success: function (response) { - var jsonResp = Ext.util.JSON.decode(response.responseText); saveAllDashboardOwner(DAS_UID); saveAllIndicators(DAS_UID); myMask.hide(); @@ -1113,7 +1116,7 @@ var saveAllIndicators = function (DAS_UID) { fieldsTab.push(goal.items.items[0]); fieldsTab.push(goal.items.items[1]); - data = []; + var data = []; data['DAS_UID'] = DAS_UID; for (var index in fieldsTab) { From 789c4496f522d58332c65979a2b76940e58f7176 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Thu, 23 Apr 2015 14:30:51 -0400 Subject: [PATCH 5/8] PM-2422 Cost by hour admite valores negativos - Changed validation regex. --- workflow/engine/templates/users/users.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/workflow/engine/templates/users/users.js b/workflow/engine/templates/users/users.js index 3b6997d5b..22eefe599 100755 --- a/workflow/engine/templates/users/users.js +++ b/workflow/engine/templates/users/users.js @@ -521,7 +521,11 @@ Ext.onReady(function () { id : 'USR_COST_BY_HOUR', fieldLabel : _('ID_COST_BY_HOUR'), xtype : 'numberfield', + allowNegative: false, decimalSeparator : '.', + maskRe : /^[0-9]/i, + regex : /^[0-9]/i, + regexText : _('ID_INVALID_VALUE', _('ID_COST_BY_HOUR')), maxLength : 13, width : 80 }, From a8f334b43a071701815a1c8f09d6ae2a3fac646d Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Fri, 24 Apr 2015 12:56:58 -0400 Subject: [PATCH 6/8] PM-2471 eliminar un indicardor ... - Se validaron variables que causaban conflicto con el TabPanel. --- .../strategicDashboard/formDashboard.js | 45 +++++++++---------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/workflow/engine/templates/strategicDashboard/formDashboard.js b/workflow/engine/templates/strategicDashboard/formDashboard.js index 71e5f7380..8893a9f56 100644 --- a/workflow/engine/templates/strategicDashboard/formDashboard.js +++ b/workflow/engine/templates/strategicDashboard/formDashboard.js @@ -530,13 +530,14 @@ Ext.onReady( function() { flag = true; break; case 'yes': + tabPanel.getItem(component.id).show(); flag = false; var dasIndUid = Ext.getCmp('DAS_IND_UID_'+component.id).getValue(); if (typeof dasIndUid != 'undefined' && dasIndUid != '') { removeIndicator(dasIndUid); } tabActivate.remove(component.id); - tabPanel.remove(component); + tabPanel.remove(component, true); break; } }, @@ -786,6 +787,7 @@ var addTab = function (flag) { var fields = ['DAS_IND_FIRST_FIGURE_'+index,'DAS_IND_FIRST_FREQUENCY_'+index,'DAS_IND_SECOND_FIGURE_'+index, 'DAS_IND_SECOND_FREQUENCY_'+index]; if (value == '1050') { field = Ext.getCmp('IND_PROCESS_'+index); + field.setValue('0'); field.disable(); field.hide(); } else { @@ -882,14 +884,13 @@ var addTab = function (flag) { id : 'IND_PROCESS_'+ indexTab, displayField : 'prj_name', valueField : 'prj_uid', - forceSelection : false, + forceSelection : true, emptyText : _('ID_EMPTY_PROCESSES'), selectOnFocus : true, hidden : true, typeAhead : true, autocomplete : true, triggerAction : 'all', - value : '0', store : storeProject }), new Ext.form.ComboBox({ @@ -1112,6 +1113,20 @@ var saveAllIndicators = function (DAS_UID) { tabPanel.getItem(tabActivate[tab]).show(); var fieldsTab = tabPanel.getItem(tabActivate[tab]).items.items[0].items.items[0].items.items; + if (fieldsTab[1].getValue().trim() == '') { + PMExt.warning(_('ID_DASHBOARD'), _('ID_INDICATOR_TITLE_REQUIRED', tabPanel.getItem(tabActivate[tab]).title)); + fieldsTab[1].focus(true,10); + return false; + } else if (fieldsTab[2].getValue().trim() == '') { + PMExt.warning(_('ID_DASHBOARD'), _('ID_INDICATOR_TYPE_REQUIRED', tabPanel.getItem(tabActivate[tab]).title)); + fieldsTab[2].focus(true,10); + return false; + } else if (fieldsTab[2].getValue() != '1050' && fieldsTab[4].getValue().trim() == '') { + PMExt.warning(_('ID_DASHBOARD'), _('ID_INDICATOR_PROCESS_REQUIRED', tabPanel.getItem(tabActivate[tab]).title)); + fieldsTab[4].focus(true,10); + return false; + } + var goal = fieldsTab[3]; fieldsTab.push(goal.items.items[0]); fieldsTab.push(goal.items.items[1]); @@ -1125,12 +1140,12 @@ var saveAllIndicators = function (DAS_UID) { continue; } - id = node.id; + var id = node.id; if (typeof id == 'undefined' || id.indexOf('fieldSet_') != -1 ) { continue; } id = id.split('_'); - field = ''; + var field = ''; for (var part = 0; part Date: Fri, 24 Apr 2015 13:17:02 -0400 Subject: [PATCH 7/8] getting rid of hardcoded strings --- .../classes/class.indicatorsCalculator.php | 30 +- workflow/engine/config/schema.xml | 1 + .../engine/controllers/strategicDashboard.php | 43 +- .../strategicDashboard/viewDashboardHelper.js | 12 +- .../strategicDashboard/viewDashboardView.js | 15 +- .../strategicDashboard/viewDashboardViewIE.js | 760 ++++++++++++++++++ .../strategicDashboard/viewDashboard.html | 12 +- .../strategicDashboard/viewDashboardIE.html | 447 +++++++++- 8 files changed, 1283 insertions(+), 37 deletions(-) create mode 100644 workflow/engine/js/strategicDashboard/viewDashboardViewIE.js diff --git a/workflow/engine/classes/class.indicatorsCalculator.php b/workflow/engine/classes/class.indicatorsCalculator.php index 321e1857e..badf19261 100644 --- a/workflow/engine/classes/class.indicatorsCalculator.php +++ b/workflow/engine/classes/class.indicatorsCalculator.php @@ -151,12 +151,12 @@ class indicatorsCalculator $params[":endMonth"] = $endMonth; $params[":language"] = $language; - $sqlString = " - select + $sqlString = "select i.PRO_UID as uid, tp.CON_VALUE as name, efficiencyIndex, - inefficiencyCost + inefficiencyCost, + @curRow := @curRow + 1 AS rank from ( select PRO_UID, @@ -172,12 +172,14 @@ class indicatorsCalculator AND IF(`YEAR` = :endYear, `MONTH`, `YEAR`) <= IF (`YEAR` = :endYear, :endMonth, :endYear) group by PRO_UID + order by $this->peiFormula DESC ) i left join (select * - from CONTENT - where CON_CATEGORY = 'PRO_TITLE' - and CON_LANG = :language - ) tp on i.PRO_UID = tp.CON_ID"; + from CONTENT + where CON_CATEGORY = 'PRO_TITLE' + and CON_LANG = :language + ) tp on i.PRO_UID = tp.CON_ID + join (SELECT @curRow := 0) order_table"; //$retval = $this->propelExecutor($sqlString); $retval = $this->pdoExecutor($sqlString, $params); @@ -210,7 +212,8 @@ class indicatorsCalculator efficiencyIndex, inefficiencyCost, averageTime, - deviationTime + deviationTime, + @curRow := @curRow + 1 AS rank from ( select gu.GRP_UID, @@ -224,12 +227,14 @@ class indicatorsCalculator WHERE IF(`YEAR` = :endYear, `MONTH`, `YEAR`) <= IF (`YEAR` = :endYear, :endMonth, :endYear) group by gu.GRP_UID + order by $this->ueiFormula DESC ) i left join (select * from CONTENT where CON_CATEGORY = 'GRP_TITLE' and CON_LANG = :language - ) tp on i.GRP_UID = tp.CON_ID"; + ) tp on i.GRP_UID = tp.CON_ID + join (SELECT @curRow := 0) order_table"; $retval = $this->pdoExecutor($sqlString, $params); //$retval = $this->propelExecutor($sqlString); @@ -262,7 +267,8 @@ class indicatorsCalculator efficiencyIndex, inefficiencyCost, averageTime, - deviationTime + deviationTime, + @curRow := @curRow + 1 AS rank from ( select u.USR_UID, @@ -279,7 +285,9 @@ class indicatorsCalculator AND IF(`YEAR` = :endYear, `MONTH`, `YEAR`) <= IF (`YEAR` = :endYear, :endMonth, :endYear) group by ur.USR_UID - ) i"; + order by $this->ueiFormula DESC + ) i + join (SELECT @curRow := 0) order_table"; $retval = $this->pdoExecutor($sqlString, $params); //$returnValue = $this->propelExecutor($sqlString); diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 979ab9f1a..b999c0bf5 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -4997,6 +4997,7 @@
    + diff --git a/workflow/engine/controllers/strategicDashboard.php b/workflow/engine/controllers/strategicDashboard.php index 816785102..f8ea0b7db 100644 --- a/workflow/engine/controllers/strategicDashboard.php +++ b/workflow/engine/controllers/strategicDashboard.php @@ -176,6 +176,7 @@ class StrategicDashboard extends Controller $translation = array(); + $translation['ID_MANAGERS_DASHBOARDS'] = G::LoadTranslation( 'ID_MANAGERS_DASHBOARDS'); $translation['ID_PRO_EFFICIENCY_INDEX'] = G::LoadTranslation( 'ID_PRO_EFFICIENCY_INDEX'); $translation['ID_EFFICIENCY_USER'] = G::LoadTranslation( 'ID_EFFICIENCY_USER'); @@ -193,9 +194,15 @@ class StrategicDashboard extends Controller $translation['ID_PROCESS_TASKS'] = G::LoadTranslation( 'ID_PROCESS_TASKS'); $translation['ID_TIME_HOURS'] = G::LoadTranslation( 'ID_TIME_HOURS'); $translation['ID_GROUPS'] = G::LoadTranslation( 'ID_GROUPS'); + $translation['ID_COSTS'] = G::LoadTranslation( 'ID_COSTS'); + $translation['ID_TASK'] = G::LoadTranslation( 'ID_TASK'); + $translation['ID_USER'] = G::LoadTranslation( 'ID_USER'); $translation['ID_YEAR'] = G::LoadTranslation( 'ID_YEAR'); $translation['ID_USERS'] = G::LoadTranslation( 'ID_USERS'); - + $translation['ID_USERS'] = G::LoadTranslation( 'ID_USERS'); + $translation['ID_OVERDUE'] = G::LoadTranslation( 'ID_OVERDUE'); + $translation['ID_AT_RISK'] = G::LoadTranslation( 'ID_AT_RISK'); + $translation['ID_ON_TIME'] = G::LoadTranslation( 'ID_ON_TIME'); $this->setVar('translation', $translation); $this->render(); } catch (Exception $error) { @@ -208,7 +215,41 @@ class StrategicDashboard extends Controller { try { $this->setView( 'strategicDashboard/viewDashboardIE' ); + $this->setVar('urlProxy',$this->urlProxy); + $this->setVar('usrId',$this->usrId); + $this->setVar('credentials',$this->clientToken); + + $translation = array(); + + $translation['ID_MANAGERS_DASHBOARDS'] = G::LoadTranslation( 'ID_MANAGERS_DASHBOARDS'); + $translation['ID_PRO_EFFICIENCY_INDEX'] = G::LoadTranslation( 'ID_PRO_EFFICIENCY_INDEX'); + $translation['ID_EFFICIENCY_USER'] = G::LoadTranslation( 'ID_EFFICIENCY_USER'); + $translation['ID_COMPLETED_CASES'] = G::LoadTranslation( 'ID_COMPLETED_CASES'); + $translation['ID_WELL_DONE'] = G::LoadTranslation( 'ID_WELL_DONE'); + $translation['ID_NUMBER_CASES'] = G::LoadTranslation( 'ID_NUMBER_CASES'); + $translation['ID_EFFICIENCY_INDEX'] = G::LoadTranslation( 'ID_EFFICIENCY_INDEX'); + $translation['ID_INEFFICIENCY_COST'] = G::LoadTranslation( 'ID_INEFFICIENCY_COST'); + $translation['ID_EFFICIENCY_COST'] = G::LoadTranslation( 'ID_EFFICIENCY_COST'); + $translation['ID_RELATED_PROCESS'] = G::LoadTranslation( 'ID_RELATED_PROCESS'); + $translation['ID_RELATED_GROUPS'] = G::LoadTranslation( 'ID_RELATED_GROUPS'); + $translation['ID_RELATED_TASKS'] = G::LoadTranslation( 'ID_RELATED_TASKS'); + $translation['ID_RELATED_USERS'] = G::LoadTranslation( 'ID_RELATED_USERS'); + $translation['ID_GRID_PAGE_NO_DASHBOARD_MESSAGE'] = G::LoadTranslation( 'ID_GRID_PAGE_NO_DASHBOARD_MESSAGE'); + $translation['ID_PROCESS_TASKS'] = G::LoadTranslation( 'ID_PROCESS_TASKS'); + $translation['ID_TIME_HOURS'] = G::LoadTranslation( 'ID_TIME_HOURS'); + $translation['ID_GROUPS'] = G::LoadTranslation( 'ID_GROUPS'); + $translation['ID_COSTS'] = G::LoadTranslation( 'ID_COSTS'); + $translation['ID_TASK'] = G::LoadTranslation( 'ID_TASK'); + $translation['ID_USER'] = G::LoadTranslation( 'ID_USER'); + $translation['ID_YEAR'] = G::LoadTranslation( 'ID_YEAR'); + $translation['ID_USERS'] = G::LoadTranslation( 'ID_USERS'); + $translation['ID_OVERDUE'] = G::LoadTranslation( 'ID_OVERDUE'); + $translation['ID_AT_RISK'] = G::LoadTranslation( 'ID_AT_RISK'); + $translation['ID_ON_TIME'] = G::LoadTranslation( 'ID_ON_TIME'); + + $this->setVar('translation', $translation); $this->render(); + } catch (Exception $error) { } catch (Exception $error) { $_SESSION['__DASHBOARD_ERROR__'] = $error->getMessage(); die(); diff --git a/workflow/engine/js/strategicDashboard/viewDashboardHelper.js b/workflow/engine/js/strategicDashboard/viewDashboardHelper.js index b7f47e83b..f975872bf 100644 --- a/workflow/engine/js/strategicDashboard/viewDashboardHelper.js +++ b/workflow/engine/js/strategicDashboard/viewDashboardHelper.js @@ -139,7 +139,8 @@ ViewDashboardHelper.prototype.merge = function (objFrom, objTo, propMap) { toKey = propMap[fromKey]; //force toKey to an array of toKeys - if (!Array.isArray(toKey)) { + //if (!Array.isArray(toKey)) { + if (!$.isArray(toKey)) { toKey = [toKey]; } @@ -147,14 +148,17 @@ ViewDashboardHelper.prototype.merge = function (objFrom, objTo, propMap) { def = null; transform = null; key = toKey[x]; - keyIsArray = Array.isArray(key); + //keyIsArray = Array.isArray(key); + keyIsArray = $.isArray(key); if (typeof(key) === "object" && !keyIsArray) { - def = key.default || null; + //def = (key.default || null); + def = null; transform = key.transform || null; key = key.key; //evaluate if the new key is an array - keyIsArray = Array.isArray(key); + // keyIsArray = Array.isArray(key); + keyIsArray = $.isArray(key); } if (keyIsArray) { diff --git a/workflow/engine/js/strategicDashboard/viewDashboardView.js b/workflow/engine/js/strategicDashboard/viewDashboardView.js index 358fdf233..0cec9c51e 100644 --- a/workflow/engine/js/strategicDashboard/viewDashboardView.js +++ b/workflow/engine/js/strategicDashboard/viewDashboardView.js @@ -281,7 +281,6 @@ $(document).ready(function() { 'height': item.height <= 1 ? 2 : item.height } widgets.push(widgetsObj); - console.log(widgetsObj); } }); @@ -588,8 +587,8 @@ var fillSpecialIndicatorFirstView = function(presenterData) { graph: { allowDrillDown:false, allowTransition:true, - axisX:{ showAxis: true, label: "Group" }, - axisY:{ showAxis: true, label: "Cost" }, + axisX:{ showAxis: true, label: G_STRING.ID_GROUPS}, + axisY:{ showAxis: true, label: G_STRING.ID_COSTS}, gridLinesX:false, gridLinesY:true, showTip: true, @@ -670,8 +669,8 @@ var fillSpecialIndicatorSecondView = function(presenterData) { gridLinesX: true, gridLinesY: true, area: {visible: false, css:"area"}, - axisX:{ showAxis: true, label: "User" }, - axisY:{ showAxis: true, label: "Cost" }, + axisX:{ showAxis: true, label: G_STRING.ID_USER }, + axisY:{ showAxis: true, label: G_STRING.ID_COSTS }, showErrorBars: true } @@ -680,7 +679,7 @@ var fillSpecialIndicatorSecondView = function(presenterData) { var indicatorPrincipalData = widgetBuilder.getIndicatorLoadedById(window.currentEntityData.indicatorId); if (window.currentIndicator.type == "1010") { - detailParams.graph.axisX.label = "Task"; + detailParams.graph.axisX.label = G_STRING.ID_TASK; var graph = new BarChart(presenterData.dataToDraw, detailParams, null, null); graph.drawChart(); } @@ -789,7 +788,7 @@ var fillGeneralIndicatorFirstView = function (presenterData) { allowDrillDown:false, allowTransition:true, axisX:{ showAxis: true, label: G_STRING.ID_YEAR }, - axisY:{ showAxis: true, label: "Q" }, + axisY:{ showAxis: true, label: G_STRING.ID_COSTS}, gridLinesX:false, gridLinesY:true, showTip: true, @@ -811,7 +810,7 @@ var fillGeneralIndicatorFirstView = function (presenterData) { allowDrillDown:false, allowTransition:true, axisX:{ showAxis: true, label: G_STRING.ID_YEAR }, - axisY:{ showAxis: true, label: "Q" }, + axisY:{ showAxis: true, label: G_STRING.ID_COSTS }, gridLinesX:false, gridLinesY:true, showTip: true, diff --git a/workflow/engine/js/strategicDashboard/viewDashboardViewIE.js b/workflow/engine/js/strategicDashboard/viewDashboardViewIE.js new file mode 100644 index 000000000..dad069276 --- /dev/null +++ b/workflow/engine/js/strategicDashboard/viewDashboardViewIE.js @@ -0,0 +1,760 @@ +/**************************************************************/ +var WidgetBuilder = function () { + this.helper = new ViewDashboardHelper(); +} + +WidgetBuilder.prototype.getIndicatorWidget = function (indicator) { + var retval = null; + switch(indicator.type) { + case "1010": retval = this.buildSpecialIndicatorButton(indicator); break; + case "1030": retval = this.buildSpecialIndicatorButton(indicator); break; + case "1050": retval = this.buildStatusIndicatorButton(indicator); break; + case "1020": + case "1040": + case "1060": + case "1070": + case "1080": + retval = this.buildIndicatorButton(indicator); break; + } + if(retval == null) {throw new Error(indicator.type + " has not associated a widget.");} + return retval; +}; + +WidgetBuilder.prototype.buildSpecialIndicatorButton = function (indicator) { + _.templateSettings.variable = "indicator"; + var template = _.template ($("script.specialIndicatorButtonTemplate").html()); + var $retval = $(template(indicator)); + + if(indicator.comparative < 0){ + $retval.find(".ind-container-selector").removeClass("panel-green").addClass("panel-red"); + $retval.find(".ind-symbol-selector").removeClass("fa-chevron-up").addClass("fa-chevron-down"); + } + + if(indicator.comparative > 0){ + $retval.find(".ind-container-selector").removeClass("panel-red").addClass("panel-green"); + $retval.find(".ind-symbol-selector").removeClass("fa-chevron-down").addClass("fa-chevron-up"); + } + + if(indicator.comparative == 0){ + $retval.find(".ind-symbol-selector").removeClass("fa-chevron-up"); + $retval.find(".ind-symbol-selector").removeClass("fa-chevron-down"); + $retval.find(".ind-symbol-selector").addClass("fa-circle-o"); + $retval.find(".ind-container-selector").removeClass("panel-red").addClass("panel-green"); + } + return $retval; +} + +WidgetBuilder.prototype.buildStatusIndicatorButton = function (indicator) { + _.templateSettings.variable = "indicator"; + var template = _.template ($("script.statusIndicatorButtonTemplate").html()); + var $retval = $(template(indicator)); + return $retval; +} + +WidgetBuilder.prototype.buildIndicatorButton = function (indicator) { + _.templateSettings.variable = "indicator"; + var template = _.template ($("script.statusIndicatorButtonTemplate").html()); + var $retval = $(template(indicator)); + var $comparative = $retval.find('.ind-comparative-selector'); + var $title = $retval.find('.ind-title-selector'); + if (indicator.isWellDone) { + $comparative.text("(" + indicator.directionSymbol + " " + indicator.comparative + "%)-"+ G_STRING.ID_WELL_DONE); + $retval.find(".ind-container-selector").removeClass("panel-low").addClass("panel-high"); + } + else { + $comparative.text("Goal: " + indicator.directionSymbol + " " + indicator.comparative + "%"); + $retval.find(".ind-container-selector").removeClass("panel-high").addClass("panel-low"); + } + return $retval; +} + +WidgetBuilder.prototype.buildSpecialIndicatorFirstView = function (indicatorData) { + if (indicatorData == null) { throw new Error ("indicatorData is null."); } + if (!indicatorData.hasOwnProperty("id")) { throw new Error ("indicatorData has no id."); } + + _.templateSettings.variable = "indicator"; + var template = _.template ($("script.specialIndicatorMainPanel").html()); + var $retval = $(template(indicatorData)); + var indicatorPrincipalData = this.getIndicatorLoadedById(indicatorData.id) + $retval.find('.breadcrumb').find('li').remove() + $retval.find('.breadcrumb').append ('
  • '+indicatorPrincipalData.title+'
  • ') + $retval.find(".sind-index-selector").text(G_STRING.ID_EFFICIENCY_INDEX); + $retval.find(".sind-cost-selector").text(G_STRING.ID_INEFFICIENCY_COST); + this.setColorForInefficiency($retval.find(".sind-cost-number-selector"), indicatorData); + return $retval; +} + +WidgetBuilder.prototype.buildSpecialIndicatorFirstViewDetail = function (oneItemDetail) { + //detailData = {indicatorId, uid, name, averateTime...} + if (oneItemDetail == null){throw new Error("oneItemDetail is null ");} + if (!typeof(oneItemDetail) === 'object'){throw new Error( "detailData is not and object ->" + oneItemDetail);} + if (!oneItemDetail.hasOwnProperty("name")){throw new Error("buildSpecialIndicatorFirstViewDetail -> detailData has not the name param. Has it the correct Type? ->" + oneItemDetail);} + + _.templateSettings.variable = "detailData"; + var template = _.template ($("script.specialIndicatorDetail").html()); + var $retval = $(template(oneItemDetail)); + $retval.find(".detail-efficiency-selector").text(G_STRING.ID_EFFICIENCY_INDEX); + $retval.find(".detail-cost-selector").text(G_STRING.ID_INEFFICIENCY_COST); + this.setColorForInefficiency($retval.find(".detail-cost-number-selector"), oneItemDetail); + return $retval; +} + +WidgetBuilder.prototype.buildStatusIndicatorFirstView = function (indicatorData) { + if (indicatorData == null) { throw new Error ("indicatorData is null."); } + if (!indicatorData.hasOwnProperty("id")) { throw new Error ("indicatorData has no id."); } + + _.templateSettings.variable = "indicator"; + var template = _.template ($("script.statusIndicatorMainPanel").html()); + var $retval = $(template(indicatorData)); + var indicatorPrincipalData = this.getIndicatorLoadedById(indicatorData.id) + $retval.find('.breadcrumb').find('li').remove() + $retval.find('.breadcrumb').append ('
  • '+indicatorPrincipalData.title+'
  • ') + return $retval; +} + +WidgetBuilder.prototype.buildStatusIndicatorFirstViewDetail = function (oneItemDetail) { + //detailData = {indicatorId, uid, name, averateTime...} + if (oneItemDetail == null){throw new Error("oneItemDetail is null ");} + if (!typeof(oneItemDetail) === 'object'){throw new Error( "detailData is not and object ->" + oneItemDetail);} + if (!oneItemDetail.hasOwnProperty("taskTitle")){throw new Error("detailData has not the name param. Has it the correct Type? ->" + oneItemDetail);} + + _.templateSettings.variable = "detailData"; + var template = _.template ($("script.statusDetail").html()); + var $retval = $(template(oneItemDetail)); + return $retval; +} + +WidgetBuilder.prototype.buildSpecialIndicatorSecondView = function (secondViewData) { + //presenterData= object {dataToDraw[], entityData[] //user/tasks data} + _.templateSettings.variable = "indicator"; + var template = _.template ($("script.specialIndicatorMainPanel").html()); + var $retval = $(template(window.currentEntityData)); + //var indicatorPrincipalData = this.getIndicatorLoadedById(indicatorId); + //$retval.find(".sind-title-selector").text(indicatorPrincipalData.title); + $retval.find(".sind-index-selector").text(G_STRING.ID_EFFICIENCY_INDEX); + $retval.find(".sind-cost-selector").text(G_STRING.ID_INEFFICIENCY_COST); + + $retval.find('.breadcrumb').find('li').remove(); + $retval.find('.breadcrumb').append ('
  • ' + window.currentIndicator.title + '
  • '); + $retval.find('.breadcrumb').append ('
  • ' + window.currentEntityData.name + '
  • '); + this.setColorForInefficiency($retval.find(".sind-cost-number-selector"), window.currentEntityData); + return $retval; +}; + +WidgetBuilder.prototype.buildSpecialIndicatorSecondViewDetailPei = function (oneItemDetail) { + if (oneItemDetail == null){throw new Error("oneItemDetail is null ");} + if (!typeof(oneItemDetail) === 'object'){throw new Error( "detailData is not and object ->" + oneItemDetail);} + if (!oneItemDetail.hasOwnProperty("name")){throw new Error("buildSpecialIndicatorFirstViewDetail -> detailData has not the name param. Has it the correct Type? ->" + oneItemDetail);} + + _.templateSettings.variable = "detailData"; + var template = _.template ($("script.specialIndicatorSencondViewDetailPei").html()); + var $retval = $(template(oneItemDetail)); + $retval.find(".detail-efficiency-selector").text(G_STRING.ID_EFFICIENCY_INDEX); + $retval.find(".detail-cost-selector").text(G_STRING.ID_INEFFICIENCY_COST); + this.setColorForInefficiency($retval.find(".detail-cost-number-selector"), oneItemDetail); + return $retval; +} + +WidgetBuilder.prototype.buildSpecialIndicatorSecondViewDetailUei = function (oneItemDetail) { + if (oneItemDetail == null){throw new Error("oneItemDetail is null ");} + if (!typeof(oneItemDetail) === 'object'){throw new Error( "detailData is not and object ->" + oneItemDetail);} + if (!oneItemDetail.hasOwnProperty("name")){throw new Error("buildSpecialIndicatorFirstViewDetail -> detailData has not the name param. Has it the correct Type? ->" + oneItemDetail);} + + _.templateSettings.variable = "detailData"; + var template = _.template ($("script.specialIndicatorSencondViewDetailUei").html()); + var $retval = $(template(oneItemDetail)); + $retval.find(".detail-efficiency-selector").text(G_STRING.ID_EFFICIENCY_INDEX); + $retval.find(".detail-cost-selector").text(G_STRING.ID_INEFFICIENCY_COST); + this.setColorForInefficiency($retval.find(".detail-cost-number-selector"), oneItemDetail); + return $retval; +} + +WidgetBuilder.prototype.buildSpecialIndicatorSecondViewDetaiUei = function (oneItemDetail) { + if (oneItemDetail == null){throw new Error("oneItemDetail is null ");} + if (!typeof(oneItemDetail) === 'object'){throw new Error( "detailData is not and object ->" + oneItemDetail);} + if (!oneItemDetail.hasOwnProperty("name")){throw new Error("buildSpecialIndicatorFirstViewDetail -> detailData has not the name param. Has it the correct Type? ->" + oneItemDetail);} + + _.templateSettings.variable = "detailData"; + var template = _.template ($("script.specialIndicatorSencondViewDetailUei").html()); + var $retval = $(template(oneItemDetail)); + $retval.find(".detail-efficiency-selector").text(G_STRING.ID_EFFICIENCY_INDEX); + $retval.find(".detail-cost-selector").text(G_STRING.ID_INEFFICIENCY_COST); + this.setColorForInefficiency($retval.find(".detail-cost-number-selector"), oneItemDetail); + return $retval; +} + +WidgetBuilder.prototype.getIndicatorLoadedById = function (searchedIndicatorId) { + var retval = null; + for (key in window.loadedIndicators) { + var indicator = window.loadedIndicators[key]; + if (indicator.id == searchedIndicatorId) { + retval = indicator; + } + } + if (retval == null) { throw new Error(searchedIndicatorId + " was not found in the loaded indicators.");} + return retval; +} + +WidgetBuilder.prototype.buildGeneralIndicatorFirstView = function (indicatorData) { + _.templateSettings.variable = "indicator"; + var template = _.template ($("script.generalIndicatorMainPanel").html()); + var $retval = $(template(indicatorData)); + $retval.find(".ind-title-selector").text(window.currentIndicator.title); + return $retval; +} + + +WidgetBuilder.prototype.setColorForInefficiency = function ($widget, indicatorData) { + //turn red/gree the font according if is positive or negative: var $widget = $retval.find(".sind-cost-number-selector"); + $widget.removeClass("red"); + $widget.removeClass("green"); + if (indicatorData.inefficiencyCost >= 0) { + $widget.addClass("green"); + } + else { + $widget.addClass("red"); + } +} + +/**********************************************************************/ +helper = new ViewDashboardHelper(); +var ws = urlProxy.split('/'); +model = new ViewDashboardModel(token, urlProxy, ws[3]); +presenter = new ViewDashboardPresenter(model); + +window.loadedIndicators = []; //updated in das-title-selector.click->fillIndicatorWidgets, ready->fillIndicatorWidgets +window.currentEntityData = null; +window.currentIndicator = null;//updated in ind-button-selector.click ->loadIndicator, ready->loadIndicator +window.currentDashboardId = null; +window.currentDetailFunction = null; +window.currentDetailList = null; + +$(document).ready(function() { + initialDraw(); +}); + + +var initialDraw = function () { + presenter.getUserDashboards(pageUserId) + .then(function(dashboardsVM) { + fillDashboardsList(dashboardsVM); + if (window.currentDashboardId == null) {return;} + /**** window initialization with favorite dashboard*****/ + presenter.getDashboardIndicators(window.currentDashboardId, defaultInitDate(), defaultEndDate()) + .done(function(indicatorsVM) { + fillIndicatorWidgets(indicatorsVM); + }); + }); +} + +var loadIndicator = function (indicatorId, initDate, endDate) { + if (indicatorId == null || indicatorId === undefined) {return;} + var builder = new WidgetBuilder(); + window.currentIndicator = builder.getIndicatorLoadedById(indicatorId); + presenter.getIndicatorData(indicatorId, window.currentIndicator.type, initDate, endDate) + .done(function (viewModel) { + switch (window.currentIndicator.type) { + case "1010": + case "1030": + fillSpecialIndicatorFirstView(viewModel); + break; + case "1050": + fillStatusIndicatorFirstView(viewModel); + break; + default: + fillGeneralIndicatorFirstView(viewModel); + break; + } + }); +} + +var setIndicatorActiveMarker = function () { + $('.panel-footer').each (function () { + $(this).removeClass('panel-active'); + var indicatorId = $(this).parents('.ind-button-selector').data('indicator-id'); + if (window.currentIndicator.id == indicatorId) { + $(this).addClass('panel-active'); + } + }); +} + +var getFavoriteIndicator = function() { + var retval = (window.loadedIndicators.length > 0) + ? window.loadedIndicators[0] + : null; + for (key in window.loadedIndicators) { + var indicator = window.loadedIndicators[key]; + if (indicator.favorite == 1) { + retval = indicator; + } + } + if (retval==null) {throw new Error ('No favorites found.');} + return retval; +} + +var defaultInitDate = function() { + var date = new Date(); + var dateMonth = date.getMonth(); + var dateYear = date.getFullYear(); + var initDate = $('#year').val() + '-' + $('#month').val() + '-' + '01'; + return initDate; +} + +var defaultEndDate = function () { + var date = new Date(); + var dateMonth = date.getMonth(); + var dateYear = date.getFullYear(); + return dateYear + "-" + (dateMonth + 1) + "-30"; +} + +var fillDashboardsList = function (presenterData) { + if (presenterData == null || presenterData.length == 0) { + $('#dashboardsList').append(G_STRING['ID_NO_DATA_TO_DISPLAY']); + } + _.templateSettings.variable = "dashboard"; + var template = _.template ($("script.dashboardButtonTemplate").html()) + for (key in presenterData) { + var dashboard = presenterData[key]; + $('#dashboardsList').append(template(dashboard)); + if (dashboard.isFavorite == 1) { + window.currentDashboardId = dashboard.id; + $('#dashboardButton-' + dashboard.id) + .find('.das-icon-selector') + .addClass('selected'); + } + } + +}; + +var fillIndicatorWidgets = function (presenterData) { + if (presenterData == null || presenterData === undefined) {return;} + var widgetBuilder = new WidgetBuilder(); + var grid = $('#indicatorsGridStack'); + window.loadedIndicators = presenterData; + $.each(presenterData, function(key, indicator) { + var $widget = widgetBuilder.getIndicatorWidget(indicator); + grid.append($widget, indicator.toDrawX, indicator.toDrawY, indicator.toDrawWidth, indicator.toDrawHeight, true); + }); +} + +var fillStatusIndicatorFirstView = function (presenterData) { + var widgetBuilder = new WidgetBuilder(); + var panel = $('#indicatorsDataGridStack').data('gridstack'); + panel.remove_all(); + $('#relatedDetailGridStack').data('gridstack').remove_all(); + + var $widget = widgetBuilder.buildStatusIndicatorFirstView(presenterData); + panel.add_widget($widget, 0, 15, 20, 4.7, true); + + var graphParams1 = { + canvas : { + containerId:'graph1', + width:300, + height:300, + stretch:true + }, + graph: { + + allowDrillDown:true, + allowTransition:true, + showTip: true, + allowZoom: false, + showLabels: true + } + }; + + var graph1 = new PieChart(presenterData.graph1Data, graphParams1, null, null); + graph1.drawChart(); + var graphParams2 = graphParams1; + graphParams2.canvas.containerId = "graph2"; + var graph2 = new PieChart(presenterData.graph2Data, graphParams2, null, null); + graph2.drawChart(); + var graphParams3 = graphParams1; + graphParams3.canvas.containerId = "graph3"; + var graph3 = new PieChart(presenterData.graph3Data, graphParams3, null, null); + graph3.drawChart(); + + var indicatorPrincipalData = widgetBuilder.getIndicatorLoadedById(presenterData.id) + setIndicatorActiveMarker(); + $('#relatedLabel').hide(); +} + +var fillStatusIndicatorFirstViewDetail = function(presenterData) { + var widgetBuilder = new WidgetBuilder(); + var gridDetail = $('#relatedDetailGridStack').data('gridstack'); + //gridDetail.remove_all(); + $.each(presenterData.dataList, function(index, dataItem) { + var $widget = widgetBuilder.buildStatusIndicatorFirstViewDetail(dataItem); + var x = (index % 2 == 0) ? 6 : 0; + gridDetail.add_widget($widget, x, 15, 6, 2, true); + }); + if (window.currentIndicator.type == "1010") { + $('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_PROCESS']); + } + if (window.currentIndicator.type == "1030") { + $('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_GROUPS']); + } + if (window.currentIndicator.type == "1050") { + $('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_PROCESS']); + } +} + +var fillSpecialIndicatorFirstView = function(presenterData) { + $('#relatedLabel').show(); + var widgetBuilder = new WidgetBuilder(); + var panel = $('#indicatorsDataGridStack').data('gridstack'); + panel.remove_all(); + $('#relatedDetailGridStack').data('gridstack').remove_all(); + + var $widget = widgetBuilder.buildSpecialIndicatorFirstView(presenterData); + panel.add_widget($widget, 0, 15, 20, 4.7, true); + var peiParams = { + canvas : { + containerId:'specialIndicatorGraph', + width:300, + height:300, + stretch:true + }, + graph: { + allowDrillDown:false, + allowTransition:true, + showTip: true, + allowZoom: false, + gapWidth:0.3, + useShadows: true, + thickness: 30, + showLabels: true + } + }; + + var ueiParams = { + canvas : { + containerId:'specialIndicatorGraph', + width:500, + height:300, + stretch:true + }, + graph: { + allowDrillDown:false, + allowTransition:true, + axisX:{ showAxis: true, label: "Group" }, + axisY:{ showAxis: true, label: "Cost" }, + gridLinesX:false, + gridLinesY:true, + showTip: true, + allowZoom: false, + useShadows: true, + paddingTop: 50 + } + }; + + var indicatorPrincipalData = widgetBuilder.getIndicatorLoadedById(presenterData.id) + + if (indicatorPrincipalData.type == "1010") { + var graph = new Pie3DChart(presenterData.dataToDraw, peiParams, null, null); + graph.drawChart(); + //the pie chart goes to much upwards,so a margin is added: + $('#specialIndicatorGraph').css('margin-top','60px'); + } + + if (indicatorPrincipalData.type == "1030") { + var graph = new BarChart(presenterData.dataToDraw, ueiParams, null, null); + graph.drawChart(); + } + + + this.fillSpecialIndicatorFirstViewDetail(presenter.orderDataList(presenterData.data, selectedOrderOfDetailList())); + setIndicatorActiveMarker(); +} + +var fillSpecialIndicatorFirstViewDetail = function (list) { + //presenterData = { id: "indId", efficiencyIndex: "0.11764706", efficiencyVariation: -0.08235294, + // inefficiencyCost: "-127.5000", inefficiencyCostToShow: -127, efficiencyIndexToShow: 0.12 + // data: {indicatorId, uid, name, averateTime...}, dataToDraw: [{datalabe, value}] } + var widgetBuilder = new WidgetBuilder(); + var gridDetail = $('#relatedDetailGridStack').data('gridstack'); + gridDetail.remove_all(); + + window.currentDetailList = list; + window.currentDetailFunction = fillSpecialIndicatorFirstViewDetail; + + $.each(list, function(index, dataItem) { + var $widget = widgetBuilder.buildSpecialIndicatorFirstViewDetail(dataItem); + var x = (index % 2 == 0) ? 6 : 0; + //the first 2 elements are not hidden + if (index < 2) { + $widget.removeClass("hideme"); + } + gridDetail.add_widget($widget, x, 15, 6, 2, true); + }); + if (window.currentIndicator.type == "1010") { + $('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_PROCESS']); + } + if (window.currentIndicator.type == "1030") { + $('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_GROUPS']); + } + hideScrollIfAllDivsAreVisible(); +} + +var fillSpecialIndicatorSecondView = function(presenterData) { + //presenterData= object {dataToDraw[], entityData[] //user/tasks data} + var widgetBuilder = new WidgetBuilder(); + var panel = $('#indicatorsDataGridStack').data('gridstack'); + panel.remove_all(); + var $widget = widgetBuilder.buildSpecialIndicatorSecondView(presenterData); + panel.add_widget($widget, 0, 15, 20, 4.7, true); + var detailParams = { + canvas : { + containerId:'specialIndicatorGraph', + width:300, + height:300, + stretch:true + }, + graph: { + allowTransition: false, + allowDrillDown: true, + showTip: true, + allowZoom: false, + useShadows: false, + gridLinesX: true, + gridLinesY: true, + area: {visible: false, css:"area"}, + axisX:{ showAxis: true, label: "User" }, + axisY:{ showAxis: true, label: "Cost" }, + showErrorBars: true + + } + }; + + var indicatorPrincipalData = widgetBuilder.getIndicatorLoadedById(window.currentEntityData.indicatorId); + + if (window.currentIndicator.type == "1010") { + detailParams.graph.axisX.label = "Task"; + var graph = new BarChart(presenterData.dataToDraw, detailParams, null, null); + graph.drawChart(); + } + + if (window.currentIndicator.type == "1030") { + var graph = new BarChart(presenterData.dataToDraw, detailParams, null, null); + graph.drawChart(); + } + this.fillSpecialIndicatorSecondViewDetail(presenter.orderDataList(presenterData.entityData, selectedOrderOfDetailList())); +} + +var fillSpecialIndicatorSecondViewDetail = function (list) { + //presenterData = { entityData: Array[{name,uid,inefficiencyCost, + // inefficiencyIndex, deviationTime, + // averageTime}], + // dataToDraw: Array[{datalabel, value}] } + var widgetBuilder = new WidgetBuilder(); + var gridDetail = $('#relatedDetailGridStack').data('gridstack'); + gridDetail.remove_all(); + + window.currentDetailList = list; + window.currentDetailFunction = fillSpecialIndicatorSecondViewDetail; + + $.each(list, function(index, dataItem) { + if (window.currentIndicator.type == "1010") { + var $widget = widgetBuilder.buildSpecialIndicatorSecondViewDetailPei(dataItem); + } + + if (window.currentIndicator.type == "1030") { + var $widget = widgetBuilder.buildSpecialIndicatorSecondViewDetailUei(dataItem); + } + + var x = (index % 2 == 0) ? 6 : 0; + //the first 2 elements are not hidden + if (index < 2) { + $widget.removeClass("hideme"); + } + gridDetail.add_widget($widget, x, 15, 6, 2, true); + }); + + if (window.currentIndicator.type == "1010") { + $('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_TASKS']); + } + if (window.currentIndicator.type == "1030") { + $('#relatedLabel').find('h3').text(G_STRING['ID_RELATED_USERS']); + } + hideScrollIfAllDivsAreVisible(); +} + +var fillGeneralIndicatorFirstView = function (presenterData) { + var widgetBuilder = new WidgetBuilder(); + var panel = $('#indicatorsDataGridStack').data('gridstack'); + panel.remove_all(); + $('#relatedDetailGridStack').data('gridstack').remove_all(); + + var $widget = widgetBuilder.buildGeneralIndicatorFirstView(presenterData); + panel.add_widget($widget, 0, 15, 20, 4.7, true); + + $('#relatedLabel').find('h3').text(''); + + var generalLineParams1 = { + canvas : { + containerId:'generalGraph1', + width:300, + height:300, + stretch:true + }, + graph: { + allowTransition: false, + allowDrillDown: true, + showTip: true, + allowZoom: false, + useShadows: false, + gridLinesX: true, + gridLinesY: true, + area: {visible: false, css:"area"}, + axisX:{ showAxis: true, label: G_STRING.ID_PROCESS_TASKS }, + axisY:{ showAxis: true, label: G_STRING.ID_TIME_HOURS }, + showErrorBars: false + } + }; + + var generalLineParams2 = { + canvas : { + containerId:'generalGraph2', + width:300, + height:300, + stretch:true + }, + graph: { + allowTransition: false, + allowDrillDown: true, + showTip: true, + allowZoom: false, + useShadows: false, + gridLinesX: true, + gridLinesY: true, + area: {visible: false, css:"area"}, + axisX:{ showAxis: true, label: G_STRING.ID_PROCESS_TASKS }, + axisY:{ showAxis: true, label: G_STRING.ID_TIME_HOURS }, + showErrorBars: false + } + }; + + var generalBarParams1 = { + canvas : { + containerId:'generalGraph1', + width:300, + height:300, + stretch:true + }, + graph: { + allowDrillDown:false, + allowTransition:true, + axisX:{ showAxis: true, label: G_STRING.ID_YEAR }, + axisY:{ showAxis: true, label: "Q" }, + gridLinesX:false, + gridLinesY:true, + showTip: true, + allowZoom: false, + useShadows: true, + paddingTop: 50, + colorPalette: ['#5486bf','#bf8d54','#acb30c','#7a0c0c','#bc0000','#906090','#007efb','#62284a','#0c7a7a','#74a9a9'] + } + }; + + var generalBarParams2 = { + canvas : { + containerId:'generalGraph2', + width:300, + height:300, + stretch:true + }, + graph: { + allowDrillDown:false, + allowTransition:true, + axisX:{ showAxis: true, label: G_STRING.ID_YEAR }, + axisY:{ showAxis: true, label: "Q" }, + gridLinesX:false, + gridLinesY:true, + showTip: true, + allowZoom: false, + useShadows: true, + paddingTop: 50, + colorPalette: ['#5486bf','#bf8d54','#acb30c','#7a0c0c','#bc0000','#906090','#007efb','#62284a','#0c7a7a','#74a9a9'] + } + }; + + var graph1 = null; + if (presenterData.graph1Type == '10') { + generalBarParams1.graph.axisX.label = presenterData.graph1XLabel; + generalBarParams1.graph.axisY.label = presenterData.graph1YLabel; + graph1 = new BarChart(presenterData.graph1Data, generalBarParams1, null, null); + } else { + generalLineParams1.graph.axisX.label = presenterData.graph1XLabel; + generalLineParams1.graph.axisY.label = presenterData.graph1YLabel; + graph1 = new LineChart(presenterData.graph1Data, generalLineParams1, null, null); + } + graph1.drawChart(); + + var graph2 = null; + if (presenterData.graph2Type == '10') { + generalBarParams2.graph.axisX.label = presenterData.graph2XLabel; + generalBarParams2.graph.axisY.label = presenterData.graph2YLabel; + graph2 = new BarChart(presenterData.graph2Data, generalBarParams2, null, null); + } else { + generalLineParams2.graph.axisX.label = presenterData.graph2XLabel; + generalLineParams2.graph.axisY.label = presenterData.graph2YLabel; + graph2 = new LineChart(presenterData.graph2Data, generalLineParams2, null, null); + } + graph2.drawChart(); + + setIndicatorActiveMarker(); +} + +var animateProgress = function (indicatorItem, widget){ + var getRequestAnimationFrame = function () { + return window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function ( callback ){ + window.setTimeout(enroute, 1 / 60 * 1000); + }; + }; + + var fpAnimationFrame = getRequestAnimationFrame(); + var i = 0; + var j = 0; + + var indicator = indicatorItem; + var animacion = function () { + var intComparative = parseInt(indicator.comparative); + var divId = "#indicatorButton" + indicator.id; + var $valueLabel = widget + .find('.ind-value-selector'); + var $progressBar = widget + .find('.ind-progress-selector'); + + if (!($valueLabel.length > 0)) {throw new Error ('"No ind-value-selector found for " + divId');} + this.helper.assert($progressBar.length > 0, "No ind-progress-selector found for " + divId); + $progressBar.attr('aria-valuemax', intComparative); + var indexToPaint = Math.min(indicator.value * 100 / intComparative, 100); + + if (i <= indexToPaint) { + $progressBar.css('width', i+'%').attr('aria-valuenow', i); + i++; + fpAnimationFrame(animacion); + } + + if(j <= indicator.value){ + $valueLabel.text(j + "%"); + j++; + fpAnimationFrame(animacion); + } + + } + fpAnimationFrame(animacion); +}; + +/*var dashboardButtonTemplate = '
    \ + \ + \ +
    ';*/ + + + diff --git a/workflow/engine/templates/strategicDashboard/viewDashboard.html b/workflow/engine/templates/strategicDashboard/viewDashboard.html index 4bf9a6c7e..b40783007 100644 --- a/workflow/engine/templates/strategicDashboard/viewDashboard.html +++ b/workflow/engine/templates/strategicDashboard/viewDashboard.html @@ -242,15 +242,15 @@
    <%- detailData.percentageOverdue%> %
    -
    Overdue
    +
    {translate label="ID_OVERDUE"}
    <%- detailData.percentageAtRisk%> %
    -
    At Risk
    +
    {translate label="ID_AT_RISK"}
    <%- detailData.percentageOnTime%> %
    -
    On Time
    +
    {translate label="ID_ON_TIME"}
    @@ -294,15 +294,15 @@
    -
    Overdue:
    +
    {translate label="ID_OVERDUE"}:
    -
    At Risk:
    +
    {translate label="ID_AT_RISK"}:
    -
    On Time:
    +
    {translate label="ID_ON_TIME"}:
    diff --git a/workflow/engine/templates/strategicDashboard/viewDashboardIE.html b/workflow/engine/templates/strategicDashboard/viewDashboardIE.html index 0029658b1..469c58ade 100644 --- a/workflow/engine/templates/strategicDashboard/viewDashboardIE.html +++ b/workflow/engine/templates/strategicDashboard/viewDashboardIE.html @@ -1,17 +1,450 @@ - + + + + Dashboards + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - -
    - For better compatibility with Internet Explorer, a new tab with the KPIs has been opened. Please select this tab on the tab list above to see all the KPI's functionality. -
    + + +
    +
    +
    +
    + This is just a basic view of your indexes. For better compatibility with Internet Explorer, a new tab with the KPIs has been opened. Please select this new tab on the tab list above to see all our KPIs functionality. +
    + + + +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + + + +
    +
    +
    +
    +
    +
    +
    - From 8754c5243862eab37ef8533e9eee681ec6d477c5 Mon Sep 17 00:00:00 2001 From: Marco Antonio Nina Mena Date: Fri, 24 Apr 2015 13:25:56 -0400 Subject: [PATCH 8/8] schema xml --- workflow/engine/config/schema.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index b999c0bf5..4245350f7 100755 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -1,4 +1,4 @@ - +