* Fix bug#11308,#20582.
This commit is contained in:
@@ -156,3 +156,57 @@ $(document).ready(function()
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('#confirmButton').click(function()
|
||||
{
|
||||
/* Unique team. */
|
||||
$('select[name^=team]').each(function(i)
|
||||
{
|
||||
value = $(this).val();
|
||||
if(value == '') return;
|
||||
$('select[name^=team]').each(function(j)
|
||||
{
|
||||
if(i <= j) return;
|
||||
if(value == $(this).val()) $(this).closest('tr').addClass('hidden');
|
||||
})
|
||||
})
|
||||
$('select[name^=team]').closest('tr.hidden').remove();
|
||||
|
||||
var memberCount = '';
|
||||
var assignedTo = '';
|
||||
var totalEstimate = 0;
|
||||
var totalConsumed = 0;
|
||||
var totalLeft = 0;
|
||||
$('select[name^=team]').each(function()
|
||||
{
|
||||
if($(this).find('option:selected').text() == '') return;
|
||||
|
||||
var account = $(this).find('option:selected').val();
|
||||
var realName = $(this).find('option:selected').text();
|
||||
assignedTo += "<option value='" + account + "' title='" + realName + "'>" + realName + "</option>";
|
||||
memberCount++;
|
||||
|
||||
estimate = parseFloat($(this).parents('td').next('td').find('[name^=teamEstimate]').val());
|
||||
if(!isNaN(estimate)) totalEstimate += estimate;
|
||||
|
||||
consumed = parseFloat($(this).parents('td').next('td').find('[name^=teamConsumed]').val());
|
||||
if(!isNaN(consumed)) totalConsumed += consumed;
|
||||
|
||||
left = parseFloat($(this).parents('td').next('td').find('[name^=teamLeft]').val());
|
||||
if(!isNaN(left)) totalLeft += left;
|
||||
})
|
||||
$('#estimate').val(totalEstimate);
|
||||
$('#consumedSpan').html(totalConsumed);
|
||||
$('#left').val(totalLeft);
|
||||
$('#assignedTo').html(assignedTo);
|
||||
$('#assignedTo').trigger('chosen:updated');
|
||||
|
||||
if(memberCount < 2)
|
||||
{
|
||||
alert(teamMemberError);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('.close').click();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
<?php js::set('confirmChangeExecution', $lang->task->confirmChangeExecution);?>
|
||||
<?php js::set('changeExecutionConfirmed', false);?>
|
||||
<?php js::set('newRowCount', count($task->team) < 6 ? 6 - count($task->team) : 1);?>
|
||||
<?php js::set('teamMemberError', $lang->task->error->teamMember);?>
|
||||
<div class='main-content' id='mainContent'>
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin' id='dataform'>
|
||||
<div class='main-header'>
|
||||
@@ -191,7 +192,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->consumed;?></th>
|
||||
<td><?php echo $task->consumed . ' '; common::printIcon('task', 'recordEstimate', "taskID=$task->id", $task, 'list', '', '', 'record-estimate-toggle btn-link', true);?></td>
|
||||
<td><?php echo '<span id=consumedSpan>' . $task->consumed . '</span> '; common::printIcon('task', 'recordEstimate', "taskID=$task->id", $task, 'list', '', '', 'record-estimate-toggle btn-link', true);?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->task->left;?></th>
|
||||
@@ -298,7 +299,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><td colspan='3' class='text-center form-actions'><?php echo html::a('javascript:void(0)', $lang->confirm, '', "class='btn btn-primary btn-wide' data-dismiss='modal'");?></td></tr>
|
||||
<tr><td colspan='3' class='text-center form-actions'><?php echo html::a('javascript:void(0)', $lang->confirm, '', "id='confirmButton' class='btn btn-primary btn-wide'");?></td></tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user