* adjust for task #67404.

This commit is contained in:
wangyidong
2022-09-02 16:20:15 +08:00
parent f1ce6c51a6
commit c94a577c96
9 changed files with 197 additions and 53 deletions
+1 -1
View File
@@ -1181,9 +1181,9 @@ class task extends control
$orderBy = 'date,id';
if(!empty($task->team) and $task->mode == 'linear') $orderBy = 'order,date,id';
$this->view->title = $this->lang->task->record;
$this->view->task = $task;
$this->view->estimates = $this->task->getTaskEstimate($taskID, '', '', $orderBy);
$this->view->title = $this->lang->task->record;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
$this->display();
}
+2 -2
View File
@@ -6,9 +6,9 @@ $(function()
{
$('#recordForm .left').each(function()
{
if($(this).val() !== '') left = $(this).val();
if($(this).val() !== '' && !$(this).prop('readonly')) left = $(this).val();
});
if(left == '0')
if(typeof(left) != 'undefined' && left == '0')
{
var confirmMsg = confirm(confirmRecord);
if(confirmMsg == false)
+3
View File
@@ -56,6 +56,9 @@ $lang->task->copy = 'Aufgabe kopieren';
$lang->task->waitTask = 'Waiting Task';
$lang->task->allModule = 'All Module';
$lang->task->replace = 'Replace';
$lang->task->myEffort = 'My Effort';
$lang->task->allEffort = 'All Effort';
$lang->task->teamOrder = 'Order';
$lang->task->common = 'Aufgabe';
$lang->task->id = 'ID';
+3
View File
@@ -56,6 +56,9 @@ $lang->task->copy = 'Copy Task';
$lang->task->waitTask = 'Waiting Task';
$lang->task->allModule = 'All Module';
$lang->task->replace = 'Replace';
$lang->task->myEffort = 'My Effort';
$lang->task->allEffort = 'All Effort';
$lang->task->teamOrder = 'Order';
$lang->task->common = 'Task';
$lang->task->id = 'ID';
+3
View File
@@ -56,6 +56,9 @@ $lang->task->copy = 'Copier Tâche';
$lang->task->waitTask = 'Tâche en attente';
$lang->task->allModule = 'Tous Modules';
$lang->task->replace = 'Replace';
$lang->task->myEffort = 'My Effort';
$lang->task->allEffort = 'All Effort';
$lang->task->teamOrder = 'Order';
$lang->task->common = 'Tâche';
$lang->task->id = 'ID';
+3
View File
@@ -56,6 +56,9 @@ $lang->task->copy = '复制任务';
$lang->task->waitTask = '未开始的任务';
$lang->task->allModule = '所有模块';
$lang->task->replace = '替换';
$lang->task->myEffort = '我的日志';
$lang->task->allEffort = '所有日志';
$lang->task->teamOrder = '工序';
$lang->task->common = '任务';
$lang->task->id = '编号';
+1 -1
View File
@@ -1907,7 +1907,7 @@ class taskModel extends model
{
$teamStatus = $estimate->left == 0 ? 'done' : 'doing';
$this->dao->update(TABLE_TASKTEAM)->set('left')->eq($estimate->left)->set("consumed = consumed + {$estimate->consumed}")->set('status')->eq($teamStatus)->where('id')->eq($currentTeam->id)->exec();
if($task->mode == 'linear') $this->updateEstimateOrder($estimateID, $currentTeam->order);
if($task->mode == 'linear' and empty($estimate->order)) $this->updateEstimateOrder($estimateID, $currentTeam->order);
$currentTeam->consumed += $estimate->consumed;
$currentTeam->left = $estimate->left;
$currentTeam->status = $teamStatus;
+111
View File
@@ -0,0 +1,111 @@
<?php if(!empty($task) and !empty($task->team) and $task->mode == 'linear'):?>
<style>
#linearefforts .nav-tabs{margin-bottom:20px;}
#linearefforts div.caption {height:25px; margin:10px 0px;}
#linearefforts div.caption .account{font-weight: bolder;}
</style>
<?php
$teamOrders = array();
foreach($task->team as $team) $teamOrders[$team->order] = $team->account;
$myOrders = array();
$allEfforts = array();
$recorders = array();
foreach($estimates as $estimate)
{
$order = $estimate->order;
$account = $estimate->account;
$allEfforts[$order][] = $estimate;
$recorders[$order][$account] = $account;
if($app->user->account == $account) $myOrders[$order] = $order;
}
?>
<?php if($myOrders):?>
<div class='tabs' id='linearefforts'>
<ul class='nav nav-tabs'>
<li class='active'><a href='#legendMyEffort' data-toggle='tab'><?php echo $lang->task->myEffort;?></a></li>
<li><a href='#legendAllEffort' data-toggle='tab'><?php echo $lang->task->allEffort;?></a></li>
</ul>
<div class='tab-content'>
<div class='tab-pane active' id='legendMyEffort'>
<?php foreach($myOrders as $order):?>
<div class='caption'>
<span class='label label-badge'><?php echo $order + 1;?></span>
<span class='account'><?php echo zget($users, $app->user->account);?></span>
</div>
<table class='table table-bordered table-fixed table-recorded'>
<thead>
<tr class='text-center'>
<th class="w-120px"><?php echo $lang->task->date;?></th>
<th class="w-120px"><?php echo $lang->task->recordedBy;?></th>
<th><?php echo $lang->comment;?></th>
<th class="thWidth"><?php echo $lang->task->consumed;?></th>
<th class="thWidth"><?php echo $lang->task->left;?></th>
<th class='c-actions-2'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php foreach($allEfforts[$order] as $estimate):?>
<tr class="text-center">
<td><?php echo $estimate->date;?></td>
<td><?php echo zget($users, $estimate->account);?></td>
<td class="text-left" title="<?php echo $estimate->work;?>"><?php echo $estimate->work;?></td>
<td title="<?php echo $estimate->consumed . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->consumed . ' ' . $lang->execution->workHourUnit;?></td>
<td title="<?php echo $estimate->left . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->left . ' ' . $lang->execution->workHourUnit;?></td>
<td align='center' class='c-actions'>
<?php
$canOperateEffort = $this->task->canOperateEffort($task, $estimate);
common::printIcon('task', 'editEstimate', "estimateID=$estimate->id", '', 'list', 'edit', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled');
common::printIcon('task', 'deleteEstimate', "estimateID=$estimate->id", '', 'list', 'trash', 'hiddenwin', 'showinonlybody', false, ($canOperateEffort and $estimate->left > 0) ? '' : 'disabled');
?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php endforeach;?>
</div>
<div class='tab-pane' id='legendAllEffort'>
<?php endif;?>
<?php foreach($recorders as $order => $accounts):?>
<div class='caption'>
<span class='label label-badge'><?php echo $order + 1;?></span>
<span class='account'><?php foreach($accounts as $account) echo zget($users, $account) . ' ';?></span>
</div>
<table class='table table-bordered table-fixed table-recorded'>
<thead>
<tr class='text-center'>
<th class="w-120px"><?php echo $lang->task->date;?></th>
<th class="w-120px"><?php echo $lang->task->recordedBy;?></th>
<th><?php echo $lang->comment;?></th>
<th class="thWidth"><?php echo $lang->task->consumed;?></th>
<th class="thWidth"><?php echo $lang->task->left;?></th>
<th class='c-actions-2'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php foreach($allEfforts[$order] as $estimate):?>
<tr class="text-center">
<td><?php echo $estimate->date;?></td>
<td><?php echo zget($users, $estimate->account);?></td>
<td class="text-left" title="<?php echo $estimate->work;?>"><?php echo $estimate->work;?></td>
<td title="<?php echo $estimate->consumed . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->consumed . ' ' . $lang->execution->workHourUnit;?></td>
<td title="<?php echo $estimate->left . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->left . ' ' . $lang->execution->workHourUnit;?></td>
<td align='center' class='c-actions'>
<?php
$canOperateEffort = $this->task->canOperateEffort($task, $estimate);
common::printIcon('task', 'editEstimate', "estimateID=$estimate->id", '', 'list', 'edit', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled');
common::printIcon('task', 'deleteEstimate', "estimateID=$estimate->id", '', 'list', 'trash', 'hiddenwin', 'showinonlybody', false, ($canOperateEffort and $estimate->left > 0) ? '' : 'disabled');
?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php endforeach;?>
<?php if($myOrders):?>
</div>
</div>
</div>
<?php endif;?>
<?php endif;?>
+70 -49
View File
@@ -34,57 +34,73 @@
<small><?php echo $lang->arrow . $lang->task->logEfforts;?></small>
<?php endif;?>
</div>
<form id="recordForm" method='post' target='hiddenwin'>
<?php if(count($estimates)):?>
<table class='table table-bordered table-fixed table-recorded'>
<thead>
<tr class='text-center'>
<th class="w-120px"><?php echo $lang->task->date;?></th>
<th class="w-120px"><?php echo $lang->task->recordedBy;?></th>
<th><?php echo $lang->comment;?></th>
<th class="thWidth"><?php echo $lang->task->consumed;?></th>
<th class="thWidth"><?php echo $lang->task->left;?></th>
<th class='c-actions-2'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php foreach($estimates as $estimate):?>
<tr class="text-center">
<td><?php echo $estimate->date;?></td>
<td><?php echo zget($users, $estimate->account);?></td>
<td class="text-left" title="<?php echo $estimate->work;?>"><?php echo $estimate->work;?></td>
<td title="<?php echo $estimate->consumed . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->consumed . ' ' . $lang->execution->workHourUnit;?></td>
<td title="<?php echo $estimate->left . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->left . ' ' . $lang->execution->workHourUnit;?></td>
<td align='center' class='c-actions'>
<?php
$canOperateEffort = $this->task->canOperateEffort($task, $estimate);
common::printIcon('task', 'editEstimate', "estimateID=$estimate->id", '', 'list', 'edit', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled');
common::printIcon('task', 'deleteEstimate', "estimateID=$estimate->id", '', 'list', 'trash', 'hiddenwin', 'showinonlybody', false, ($canOperateEffort and ($task->mode != 'linear' or ($task->mode == 'linear' and $estimate->left > 0))) ? '' : 'disabled');
?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php endif;?>
<?php if(!$this->task->canOperateEffort($task)):?>
<div class="alert with-icon">
<i class="icon-exclamation-sign"></i>
<div class="content">
<?php if(strpos('|done|closed|cancel|pause|', $task->status) !== false):?>
<p><?php echo sprintf($lang->task->deniedStatusNotice, '<strong>' . zget($this->lang->task->statusList, $task->status) . '</strong>');?></p>
<?php elseif($task->assignedTo != $app->user->account and $task->mode == 'linear'):?>
<p><?php echo sprintf($lang->task->deniedNotice, '<strong>' . $task->assignedToRealName . '</strong>', $lang->task->logEfforts);?></p>
<?php else:?>
<p><?php echo sprintf($lang->task->deniedNotice, '<strong>' . $lang->task->teamMember . '</strong>', $lang->task->logEfforts);?></p>
<?php endif;?>
</div>
<?php if(count($estimates)):?>
<?php if(!empty($task->team) and $task->mode == 'linear'):?>
<?php include __DIR__ . '/lineareffort.html.php';?>
<?php else:?>
<table class='table table-bordered table-fixed table-recorded'>
<thead>
<tr class='text-center'>
<th class="w-120px"><?php echo $lang->task->date;?></th>
<th class="w-120px"><?php echo $lang->task->recordedBy;?></th>
<th><?php echo $lang->comment;?></th>
<th class="thWidth"><?php echo $lang->task->consumed;?></th>
<th class="thWidth"><?php echo $lang->task->left;?></th>
<th class='c-actions-2'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php foreach($estimates as $estimate):?>
<tr class="text-center">
<td><?php echo $estimate->date;?></td>
<td><?php echo zget($users, $estimate->account);?></td>
<td class="text-left" title="<?php echo $estimate->work;?>"><?php echo $estimate->work;?></td>
<td title="<?php echo $estimate->consumed . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->consumed . ' ' . $lang->execution->workHourUnit;?></td>
<td title="<?php echo $estimate->left . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->left . ' ' . $lang->execution->workHourUnit;?></td>
<td align='center' class='c-actions'>
<?php
$canOperateEffort = $this->task->canOperateEffort($task, $estimate);
common::printIcon('task', 'editEstimate', "estimateID=$estimate->id", '', 'list', 'edit', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled');
common::printIcon('task', 'deleteEstimate', "estimateID=$estimate->id", '', 'list', 'trash', 'hiddenwin', 'showinonlybody', false, $canOperateEffort ? '' : 'disabled');
?>
</td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php endif;?>
<?php endif;?>
<?php if(!$this->task->canOperateEffort($task) and empty($myOrders)):?>
<div class="alert with-icon">
<i class="icon-exclamation-sign"></i>
<div class="content">
<?php if($task->assignedTo != $app->user->account and $task->mode == 'linear'):?>
<p><?php echo sprintf($lang->task->deniedNotice, '<strong>' . $task->assignedToRealName . '</strong>', $lang->task->logEfforts);?></p>
<?php elseif(!isset($task->members[$app->user->account])):?>
<p><?php echo sprintf($lang->task->deniedNotice, '<strong>' . $lang->task->teamMember . '</strong>', $lang->task->logEfforts);?></p>
<?php endif;?>
</div>
<?php else:?>
</div>
<?php else:?>
<form id="recordForm" method='post' target='hiddenwin'>
<?php
$readonly = '';
$left = '';
if($task->assignedTo != $app->user->account and !empty($task->team) and $task->mode == 'linear' and !empty($myOrders))
{
$readonly = ' readonly';
$left = 0;
$reverseOrders = array_reverse($myOrders, true);
foreach($reverseOrders as $order) $reverseOrders[$order] = $order + 1;
}
?>
<table class='table table-form table-fixed table-record'>
<thead>
<tr class='text-center'>
<th class="w-120px"><?php echo $lang->task->date;?></th>
<?php if($readonly):?>
<th class="w-60px"><?php echo $lang->task->teamOrder;?></th>
<?php endif;?>
<th><?php echo $lang->comment;?></th>
<th class="w-100px"><?php echo $lang->task->consumedAB;?></th>
<th class="w-100px"><?php echo $lang->task->leftAB;?></th>
@@ -93,8 +109,13 @@
<tbody>
<?php for($i = 1; $i <= 5; $i++):?>
<tr class="text-center">
<?php echo html::hidden("id[$i]", $i);?>
<td><?php echo html::input("dates[$i]", helper::today(), "class='form-control text-center form-date'");?></td>
<td>
<?php echo html::input("dates[$i]", helper::today(), "class='form-control text-center form-date'");?>
<?php echo html::hidden("id[$i]", $i);?>
</td>
<?php if($readonly):?>
<td><?php echo html::select("order[$i]", $reverseOrders, '', "class='form-control'")?></td>
<?php endif;?>
<td class="text-left"><?php echo html::textarea("work[$i]", '', "class='form-control' rows=1");?></td>
<td>
<div class='input-group'>
@@ -104,7 +125,7 @@
</td>
<td>
<div class='input-group'>
<?php echo html::input("left[$i]", '', "class='form-control text-center left'");?>
<?php echo html::input("left[$i]", $left, "class='form-control text-center left' {$readonly}");?>
<span class='input-group-addon'>h</span>
</div>
</td>