From 0911d16112929fd5c3674497acd976934cc9e404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=BB=B6=E4=B9=89?= Date: Tue, 27 Sep 2022 09:59:14 +0800 Subject: [PATCH] * Code for task #70495. --- module/task/control.php | 11 ++++--- module/task/css/recordestimate.css | 3 ++ module/task/js/recordestimate.js | 20 ++++++++++++- module/task/view/lineareffort.html.php | 38 ++++++++++++++++-------- module/task/view/recordestimate.html.php | 7 +++-- 5 files changed, 58 insertions(+), 21 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index 2f077c93b0..f3efbc6931 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -1112,10 +1112,11 @@ class task extends control * * @param int $taskID * @param string $from + * @param string $orderBy * @access public * @return void */ - public function recordEstimate($taskID, $from = '') + public function recordEstimate($taskID, $from = '', $orderBy = '') { $this->commonAction($taskID); @@ -1174,12 +1175,14 @@ class task extends control $this->session->set('estimateList', $uri, 'execution'); if(isonlybody()) $this->session->set('estimateList', $uri . (strpos($uri, '?') === false ? '?' : '&') . 'onlybody=yes', 'execution'); - $task = $this->task->getById($taskID); - $orderBy = 'date,id'; - if(!empty($task->team) and $task->mode == 'linear') $orderBy = 'order,date,id'; + $task = $this->task->getById($taskID); + if(!empty($task->team) and $task->mode == 'linear' and !$orderBy) $orderBy = 'order_asc'; + if(!$orderBy) $orderBy = 'date_asc'; $this->view->title = $this->lang->task->record; $this->view->task = $task; + $this->view->from = $from; + $this->view->orderBy = $orderBy; $this->view->efforts = $this->task->getTaskEstimate($taskID, '', '', $orderBy); $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); $this->display(); diff --git a/module/task/css/recordestimate.css b/module/task/css/recordestimate.css index 1bf2b838aa..df6eb85fc4 100644 --- a/module/task/css/recordestimate.css +++ b/module/task/css/recordestimate.css @@ -18,3 +18,6 @@ .main-header ul.hours:after{content:")"} .body-modal .main-header>h2 { max-width: 70% !important; margin-right:0px;} .table-record .form-date {border-right: none;} + +.table.has-sort-head thead>tr>th>a:after, .table.has-sort-head thead>tr>th>a:before {top: -7px;} +.table.has-sort-head thead>tr>th>a:hover, .table.has-sort-head thead>tr>th>a:hover:after, .table.has-sort-head thead>tr>th>a:hover:before {color: #000;} diff --git a/module/task/js/recordestimate.js b/module/task/js/recordestimate.js index 0ae15d69f2..e10c2adf66 100644 --- a/module/task/js/recordestimate.js +++ b/module/task/js/recordestimate.js @@ -1,5 +1,24 @@ $(function() { + /* Set default tab. */ + if($.cookie('recordEstimateType') == 'all') + { + $('#recordForm').addClass('hidden'); + $('.my-effort, #legendMyEffort').removeClass('active'); + $('.all-effort, #legendAllEffort').addClass('active'); + } + else + { + $('.my-effort, #legendMyEffort').addClass('active'); + $('#recordForm').removeClass('hidden'); + } + $.cookie('recordEstimateType', null); + + $('.order-btn').on('click', function() + { + $.cookie('recordEstimateType', 'all'); + }); + /* Hide creation logs when displaying team logs. */ $('#linearefforts .tabs ul > li').click(function() { @@ -7,7 +26,6 @@ $(function() $('#recordForm').toggleClass('hidden', tab == '#legendAllEffort'); }); - $('.form-date').datetimepicker('setEndDate', today); $("#recordForm #submit").click(function(e, confirmed) diff --git a/module/task/view/lineareffort.html.php b/module/task/view/lineareffort.html.php index f9f6ad8aaf..9dc02d3971 100644 --- a/module/task/view/lineareffort.html.php +++ b/module/task/view/lineareffort.html.php @@ -16,9 +16,13 @@ foreach($task->team as $team) $teamOrders[$team->order] = $team->account; $myOrders = array(); $allEfforts = array(); $recorders = array(); -foreach($efforts as $effort) +$index = 0; +$allOrders = array(); +$efforts = array_values($efforts); +foreach($efforts as $key => $effort) { - $order = $effort->order; + $prevEffort = $key > 0 ? $efforts[$key - 1] : null; + $order = (!$prevEffort or $prevEffort->order == $effort->order) ? $index : ++$index; $account = $effort->account; $allEfforts[$order][] = $effort; $recorders[$order][$account] = $account; @@ -27,22 +31,29 @@ foreach($efforts as $effort) if(!isset($myOrders[$order])) $myOrders[$order] = 0; $myOrders[$order] += 1; } + $allOrders[$order] = $effort->order + 1; } ?>
-
+
- +
- - + id&from=$from&orderBy=%s"; + $sort = explode(',', $orderBy); + $orderBy = zget($sort, '0', ''); + if(!strpos($orderBy, '_')) $orderBy .= '_asc'; + ?> + + @@ -58,7 +69,7 @@ foreach($efforts as $effort) account != $this->app->user->account) continue;?> - + @@ -84,11 +95,12 @@ foreach($efforts as $effort)
-
task->teamOrder;?>task->date;?>task->teamOrder);?>task->date);?> task->recordedBy;?> task->work;?> task->consumedAB;?>
date;?>
+
- - + id&from=$from&orderBy=%s";?> + + @@ -103,7 +115,7 @@ foreach($efforts as $effort) - + diff --git a/module/task/view/recordestimate.html.php b/module/task/view/recordestimate.html.php index 88be99f99e..4c00a762ac 100644 --- a/module/task/view/recordestimate.html.php +++ b/module/task/view/recordestimate.html.php @@ -56,10 +56,11 @@ if(!empty($members) && $task->mode == 'linear') team) and $task->mode == 'linear'):?> -
task->teamOrder;?>task->date;?>task->teamOrder);?>task->date);?> task->recordedBy;?> task->work;?> task->consumedAB;?>
date;?>
+
- + id&from=$from&orderBy=%s";?> + @@ -100,7 +101,7 @@ if(!empty($members) && $task->mode == 'linear') - +
task->date;?>task->date);?> task->recordedBy;?> task->work;?> task->consumed;?>