Files
EasySoft-ZenTaoPMS/module/task/js/common.js
T
2018-05-28 17:40:40 +08:00

70 lines
1.7 KiB
JavaScript

/* If left = 0, warning. */
function checkLeft()
{
value = $("#left").val();
if(isNaN(parseInt(value)) || value == 0)
{
if(confirm(confirmFinish))
{
return true;
}
else
{
return false;
}
}
}
$(document).on('click', '.btn-move-up, .btn-move-down', function()
{
var $this = $(this);
if($this.hasClass('btn-move-up'))
{
$(this).parents('tr').prev().before($(this).parents('tr'));
}
else
{
$this.parents('tr').next().after($(this).parents('tr'));
}
$('.btn-move-up, .btn-move-down').removeClass('disabled').removeAttr('disabled');
adjustSortBtn();
});
function adjustSortBtn()
{
$('.btn-move-up:first').addClass('disabled').attr('disabled', 'disabled');
$('.btn-move-down:last').addClass('disabled').attr('disabled', 'disabled');
}
$('#modalTeam .btn').click(function()
{
var team = '';
var time = 0;
$('[name*=team]').each(function()
{
if($(this).find('option:selected').text() != '')
{
team += ' ' + $(this).find('option:selected').text();
}
estimate = parseFloat($(this).parents('td').next('td').find('[name*=teamEstimate]').val());
if(!isNaN(estimate))
{
time += estimate;
}
$('#teamMember').val(team).attr('title', team);
$('#estimate').val(time);
})
});
$(document).on('click', 'a.btn-move-add', function()
{
var html = $("#modalTeam table.table tbody tr:last").html();
$("#modalTeam table.table tbody tr:last").after('<tr>' + html + '</tr>');
$("#modalTeam table.table tbody tr:last").prev().find('.btn-move-down').removeClass('disabled').removeAttr('disabled');
adjustSortBtn();
});