From 9e73a2f70110d2de2ed8f7812336b25d14a92d25 Mon Sep 17 00:00:00 2001 From: Ronald Quenta Date: Fri, 10 Apr 2015 11:13:04 -0400 Subject: [PATCH 1/9] file uploaded for mobile dynaform and notes methods GET and Post --- .../methods/cases/casesStreamingFile.php | 16 ++++ .../src/ProcessMaker/Services/Api/Light.php | 89 +++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/workflow/engine/methods/cases/casesStreamingFile.php b/workflow/engine/methods/cases/casesStreamingFile.php index 66dc2bc17..77116077d 100644 --- a/workflow/engine/methods/cases/casesStreamingFile.php +++ b/workflow/engine/methods/cases/casesStreamingFile.php @@ -50,6 +50,22 @@ if ($actionAjax == "streaming") { exit(0); } +if ($actionAjax == "fileMobile") { + $app_uid = isset( $_REQUEST['a'] ) ? $_REQUEST['a'] : null; + $inp_doc_uid = isset( $_REQUEST['d'] ) ? $_REQUEST['d'] : null; + + $structure = file_get_contents(PATH_HTML ."/mobile/index.json"); + $structure = json_decode($structure); + foreach($structure as $build){ + foreach($build as $file){ + $file->lastModified = date ("D, d M Y H:i:s \G\M\T", filemtime(PATH_HTML ."/mobile/".$file->file)); + } + } + G::header( 'Content-Type: application/json' ); + echo G::json_encode($structure); + exit(0); +} + exit; function rangeDownload($location,$mimeType) diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Light.php b/workflow/engine/src/ProcessMaker/Services/Api/Light.php index 5ae04b00a..20ca37c50 100644 --- a/workflow/engine/src/ProcessMaker/Services/Api/Light.php +++ b/workflow/engine/src/ProcessMaker/Services/Api/Light.php @@ -810,4 +810,93 @@ class Light extends Api } return $response; } + + /** + * Get Case Notes + * + * @param string $app_uid {@min 1}{@max 32} + * @param string $start {@from path} + * @param string $limit {@from path} + * @param string $sort {@from path} + * @param string $dir {@from path} + * @param string $usr_uid {@from path} + * @param string $date_from {@from path} + * @param string $date_to {@from path} + * @param string $search {@from path} + * @return array + * + * @copyright Colosa - Bolivia + * + * @url GET /case/:app_uid/notes + */ + public function doGetCaseNotes( + $app_uid, + $start = 0, + $limit = 25, + $sort = 'APP_CACHE_VIEW.APP_NUMBER', + $dir = 'DESC', + $usr_uid = '', + $date_from = '', + $date_to = '', + $search = '' + ) { + try { + $dataList['start'] = $start; + $dataList['limit'] = $limit; + $dataList['sort'] = $sort; + $dataList['dir'] = $dir; + $dataList['user'] = $usr_uid; + $dataList['dateFrom'] = $date_from; + $dataList['dateTo'] = $date_to; + $dataList['search'] = $search; + + $usr_uid = $this->getUserId(); + $cases = new \ProcessMaker\BusinessModel\Cases(); + $response = $cases->getCaseNotes($app_uid, $usr_uid, $dataList); + $result = $this->parserDataNotes($response['data']); + return $result; + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + + public function parserDataNotes ($data) + { + $structure = array( + 'app_uid' => 'caseId', + 'usr_uid' => 'userId', + 'notes' => array( + 'note_date' => 'date', + 'note_content' => 'content' + ) + ); + + $response = $this->replaceFields($data, $structure); + return $response; + } + + /** + * Post Case Notes + * + * @param string $app_uid {@min 1}{@max 32} + * @param string $noteContent {@min 1}{@max 500} + * @param int $sendMail {@choice 1,0} + * + * @copyright Colosa - Bolivia + * + * @url POST /case/:app_uid/note + */ + public function doPostCaseNote($app_uid, $noteContent, $sendMail = 0) + { + try { + $usr_uid = $this->getUserId(); + $cases = new \ProcessMaker\BusinessModel\Cases(); + $sendMail = ($sendMail == 0) ? false : true; + $cases->saveCaseNote($app_uid, $usr_uid, $noteContent, $sendMail); + $result = array("status" => 'ok'); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + return $result; + } } From ea7e63188f824023520fdb303360f199eb1c7b21 Mon Sep 17 00:00:00 2001 From: Dante Date: Wed, 29 Apr 2015 08:52:32 -0400 Subject: [PATCH 2/9] Default compare month[C --- .../classes/model/DashboardIndicator.php | 8 +++- .../strategicDashboard/viewDashboardModel.js | 1 - .../viewDashboardPresenter.js | 24 ++++++++-- .../strategicDashboard/viewDashboardView.js | 29 +++++++---- .../strategicDashboard/viewDashboard.html | 48 ++++++++++--------- 5 files changed, 71 insertions(+), 39 deletions(-) diff --git a/workflow/engine/classes/model/DashboardIndicator.php b/workflow/engine/classes/model/DashboardIndicator.php index e0eef6b5c..baa10cc79 100644 --- a/workflow/engine/classes/model/DashboardIndicator.php +++ b/workflow/engine/classes/model/DashboardIndicator.php @@ -65,14 +65,18 @@ class DashboardIndicator extends BaseDashboardIndicator $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); + $row['DAS_IND_PERCENT_VARIATION'] = $oldValue != 0 + ? round(($value - $oldValue) * 100 / $oldValue) + : "--"; 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); + $row['DAS_IND_PERCENT_VARIATION'] = $oldValue != 0 + ? round(($value - $oldValue) * 100 / $oldValue) + : "--"; break; case '1050': $value = $calculator->statusIndicatorGeneral($userUid); diff --git a/workflow/engine/js/strategicDashboard/viewDashboardModel.js b/workflow/engine/js/strategicDashboard/viewDashboardModel.js index c2b63eca1..6a96e1c3f 100644 --- a/workflow/engine/js/strategicDashboard/viewDashboardModel.js +++ b/workflow/engine/js/strategicDashboard/viewDashboardModel.js @@ -78,7 +78,6 @@ ViewDashboardModel.prototype.getPositionIndicator = function(callBack) { "y" : originalObject.y, "width" : originalObject.width, "height" : originalObject.height - }; graphData.push(map); }); diff --git a/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js b/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js index 1890c651e..4472f14d2 100644 --- a/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js +++ b/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js @@ -90,15 +90,31 @@ ViewDashboardPresenter.prototype.dashboardIndicatorsViewModel = function(data) { newObject.comparative = Math.round(newObject.comparative*1000)/1000; newObject.comparative = ((newObject.comparative > 0)? "+": "") + newObject.comparative; + newObject.percentComparative = (newObject.percentComparative != '--') + ? '(' + newObject.percentComparative + '%)' + : ""; + + newObject.value = (newObject.category == "normal") ? Math.round(newObject.value) + "" : Math.round(newObject.value*100)/100 + "" newObject.favorite = 0; - newObject.percentageOverdue = Math.round(newObject.percentageOverdue); - newObject.percentageAtRisk = Math.round(newObject.percentageAtRisk); - //to be sure that percentages sum up to 100 (the rounding will lost decimals)% - newObject.percentageOnTime = 100 - newObject.percentageOverdue - newObject.percentageAtRisk; + + newObject.percentageOverdueWidth = Math.round(newObject.percentageOverdue); + newObject.percentageAtRiskWidth = Math.round(newObject.percentageAtRisk); + //to be sure that percentages sum up to 100 (the rounding will lose decimals)% + newObject.percentageOnTimeWidth = 100 - newObject.percentageOverdueWidth - newObject.percentageAtRiskWidth; + + newObject.percentageOverdueToShow = ((newObject.percentageOverdue == 0 ||newObject.percentageOverdue == null ) ? "" : newObject.percentageOverdueWidth + "%"); + newObject.percentageAtRiskToShow = ((newObject.percentageAtRisk == 0 || newObject.percentageAtRisk == null) ? "" : newObject.percentageAtRiskWidth + "%"); + newObject.percentageOnTimeToShow = ((newObject.percentageOnTime == 0 || newObject.percentageOnTime == 0) + ? G_STRING['ID_INBOX'] + ' ' + G_STRING['ID_EMPTY'] + : newObject.percentageOnTimeWidth + "%"); + + + + newObject.overdueVisibility = (newObject.percentageOverdue > 0)? "visible" : "hidden"; newObject.atRiskVisibility = (newObject.percentageAtRisk > 0)? "visible" : "hidden"; newObject.onTimeVisibility = (newObject.percentageOnTime > 0)? "visible" : "hidden"; diff --git a/workflow/engine/js/strategicDashboard/viewDashboardView.js b/workflow/engine/js/strategicDashboard/viewDashboardView.js index d62c6fc20..18da14656 100644 --- a/workflow/engine/js/strategicDashboard/viewDashboardView.js +++ b/workflow/engine/js/strategicDashboard/viewDashboardView.js @@ -353,20 +353,17 @@ $(document).ready(function() { presenter.getDashboardIndicators(dashboardId, defaultInitDate(), defaultEndDate()) .done(function(indicatorsVM) { fillIndicatorWidgets(indicatorsVM); - //TODO use real data loadIndicator(getFavoriteIndicator().id, defaultInitDate(), defaultEndDate()); }); }); $('#indicatorsGridStack').on('click','.ind-button-selector', function() { var indicatorId = $(this).data('indicator-id'); - //TODO use real data loadIndicator(indicatorId, defaultInitDate(), defaultEndDate()); }); $('body').on('click','.bread-back-selector', function() { var indicatorId = window.currentIndicator.id; - //TODO use real data loadIndicator(indicatorId, defaultInitDate(), defaultEndDate()); return false; }); @@ -380,7 +377,6 @@ $(document).ready(function() { "inefficiencyCost":$(this).data('detail-cost'), "name":$(this).data('detail-name') }; - //TODO PASS REAL VALUES presenter.getSpecialIndicatorSecondLevel(detailId, window.currentIndicator.type, defaultInitDate(), defaultEndDate()) .done(function (viewModel) { fillSpecialIndicatorSecondView(viewModel); @@ -406,8 +402,15 @@ var hideTitleAndSortDiv = function(){ switch (window.currentIndicator.type) { case "1010": case "1030": - $('#relatedLabel').css('visibility', 'visible'); - $('#relatedLabel').show(); + if($('.detail-button-selector').length == 0) { + $('#relatedLabel').hide(); + //$('#relatedLabel').find('h3').text(G_STRING['ID_NO_DATA_TO_DISPLAY']); + } + else { + $('#relatedLabel').css('visibility', 'visible'); + $('#relatedLabel').show(); + } + break; default: $('#relatedLabel').hide(); @@ -419,6 +422,15 @@ var selectedOrderOfDetailList = function () { return ($('#sortListButton').hasClass('fa-chevron-up') ? "up" : "down"); } +var selectDefaultMonthAndYear = function () { + var compareDate = new Date(); + compareDate.setMonth(compareDate.getMonth() - 1); + var compareMonth = compareDate.getMonth() + 1; + var compareYear = compareDate.getYear(); + $('#month').val(compareMonth); + $('#year').val(compareYear); +} + var initialDraw = function () { presenter.getUserDashboards(pageUserId) .then(function(dashboardsVM) { @@ -427,6 +439,7 @@ var initialDraw = function () { /**** window initialization with favorite dashboard*****/ presenter.getDashboardIndicators(window.currentDashboardId, defaultInitDate(), defaultEndDate()) .done(function(indicatorsVM) { + selectDefaultMonthAndYear(); fillIndicatorWidgets(indicatorsVM); loadIndicator(getFavoriteIndicator().id, defaultInitDate(), defaultEndDate()); }); @@ -523,10 +536,6 @@ var fillIndicatorWidgets = function (presenterData) { $.each(presenterData, function(key, indicator) { var $widget = widgetBuilder.getIndicatorWidget(indicator); grid.add_widget($widget, indicator.toDrawX, indicator.toDrawY, indicator.toDrawWidth, indicator.toDrawHeight, true); - //TODO will exist animation? - /*if (indicator.category == "normal") { - animateProgress(indicator, $widget); - }*/ var $title = $widget.find('.ind-title-selector'); if (indicator.favorite == "1") { $title.addClass("panel-active"); diff --git a/workflow/engine/templates/strategicDashboard/viewDashboard.html b/workflow/engine/templates/strategicDashboard/viewDashboard.html index fcc046823..71b126834 100644 --- a/workflow/engine/templates/strategicDashboard/viewDashboard.html +++ b/workflow/engine/templates/strategicDashboard/viewDashboard.html @@ -59,7 +59,7 @@
- <%- indicator.comparative %> (<%- indicator.percentComparative %> %) + <%- indicator.comparative %> <%- indicator.percentComparative %>
@@ -81,29 +81,29 @@