* 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
+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>