* [perf story #73251] Disable child task estStarted and deadline fields when this parent field is empty.
This commit is contained in:
@@ -34,6 +34,19 @@ window.renderRowData = function($row, index, row)
|
||||
if(row.assignedTo && taskMembers[row.assignedTo] == undefined) taskMembers[row.assignedTo] = users[row.assignedTo];
|
||||
for(let account in taskMembers) taskUsers.push({value: account, text: taskMembers[account]});
|
||||
|
||||
if(parentTasks[row.parent] != undefined)
|
||||
{
|
||||
const parentTask = parentTasks[row.parent];
|
||||
$row.find('[id^="estStarted"]').on('inited', function(e, info)
|
||||
{
|
||||
if(parentTask.estStarted == '') info[0].render({disabled: true});
|
||||
});
|
||||
$row.find('[id^="deadline"]').on('inited', function(e, info)
|
||||
{
|
||||
if(parentTask.deadline == '') info[0].render({disabled: true});
|
||||
});
|
||||
}
|
||||
|
||||
$row.find('[data-name="assignedTo"]').find('.picker-box').on('inited', function(e, info)
|
||||
{
|
||||
const $assignedTo = info[0];
|
||||
@@ -45,13 +58,7 @@ window.renderRowData = function($row, index, row)
|
||||
$assignedTo.render({items: taskUsers, disabled: disabled, toolbar: pickerToolbar});
|
||||
});
|
||||
|
||||
if(row.status == 'wait')
|
||||
{
|
||||
$row.find('[data-name="status"]').find('.picker-box').on('inited', function(e, info)
|
||||
{
|
||||
info[0].render({items: noPauseStatusList});
|
||||
});
|
||||
}
|
||||
if(row.status == 'wait') $row.find('[data-name="status"]').find('.picker-box').on('inited', function(e, info) { info[0].render({items: noPauseStatusList}); });
|
||||
|
||||
if(teams[row.id] != undefined || row.isParent > 0)
|
||||
{
|
||||
@@ -186,6 +193,8 @@ function checkBatchEstStartedAndDeadline(event)
|
||||
const $estStartedTd = $currentRow.find('td[data-name=estStarted]');
|
||||
$estStartedTd.find('.date-tip').remove();
|
||||
|
||||
const $childrenEstStarted = $(event.target).closest('tbody').find('tr[data-parent="' + taskID + '"]').find('[name^=estStarted]');
|
||||
$childrenEstStarted.each(function(){$(this).zui('datePicker').render({disabled: estStarted.length == 0});});
|
||||
if(estStarted.length > 0)
|
||||
{
|
||||
let $datetip = $('<div class="date-tip"></div>');
|
||||
@@ -197,7 +206,7 @@ function checkBatchEstStartedAndDeadline(event)
|
||||
}
|
||||
|
||||
let childEstStarted = childrenDateLimit[taskID] ? childrenDateLimit[taskID].estStarted : '';
|
||||
$(event.target).closest('tbody').find('tr[data-parent="' + taskID + '"]').find('[name^=estStarted]').each(function()
|
||||
$childrenEstStarted.each(function()
|
||||
{
|
||||
if(childEstStarted.length == 0 || ($(this).val().length > 0 && $(this).val() < childEstStarted)) childEstStarted = $(this).val();
|
||||
});
|
||||
@@ -215,6 +224,8 @@ function checkBatchEstStartedAndDeadline(event)
|
||||
const $deadlineTd = $currentRow.find('td[data-name=deadline]');
|
||||
$deadlineTd.find('.date-tip').remove();
|
||||
|
||||
const $childrenDeadline = $(event.target).closest('tbody').find('tr[data-parent="' + taskID + '"]').find('[name^=deadline]');
|
||||
$childrenDeadline.each(function(){$(this).zui('datePicker').render({disabled: deadline.length == 0});});
|
||||
if(deadline.length > 0)
|
||||
{
|
||||
let $datetip = $('<div class="date-tip"></div>');
|
||||
@@ -227,7 +238,7 @@ function checkBatchEstStartedAndDeadline(event)
|
||||
}
|
||||
|
||||
let childDeadline = childrenDateLimit[taskID] ? childrenDateLimit[taskID].deadline : '';
|
||||
$(event.target).closest('tbody').find('tr[data-parent="' + taskID + '"]').find('[name^=deadline]').each(function()
|
||||
$childrenDeadline.each(function()
|
||||
{
|
||||
if(childDeadline.length == 0 || ($(this).val().length > 0 && $(this).val() > childDeadline)) childDeadline = $(this).val();
|
||||
});
|
||||
|
||||
@@ -644,8 +644,15 @@ overParentEstStartedLang = '';
|
||||
overParentDeadlineLang = '';
|
||||
window.getParentEstStartedAndDeadline = function()
|
||||
{
|
||||
const parent = $('[name=parent]').val();
|
||||
if(!parent) return;
|
||||
const $parent = $('[name=parent]');
|
||||
const parent = $parent.val();
|
||||
if(!parent)
|
||||
{
|
||||
const $form = $parent.closest('form');
|
||||
$form.find('[name=estStarted]').zui('datePicker').render({disabled: false});
|
||||
$form.find('[name=deadline]').zui('datePicker').render({disabled: false});
|
||||
return;
|
||||
}
|
||||
|
||||
const link = $.createLink('task', 'ajaxGetTaskEstStartedAndDeadline', 'taskID=' + parent);
|
||||
$.getJSON(link, function(data)
|
||||
|
||||
@@ -407,8 +407,15 @@ window.setStoryModule = function()
|
||||
|
||||
getParentEstStartedAndDeadline = function()
|
||||
{
|
||||
const parent = $('[name=parent]').val();
|
||||
if(!parent) return;
|
||||
const $parent = $('[name=parent]');
|
||||
const parent = $parent.val();
|
||||
if(!parent)
|
||||
{
|
||||
const $form = $parent.closest('form');
|
||||
$form.find('[name=estStarted]').zui('datePicker').render({disabled: false});
|
||||
$form.find('[name=deadline]').zui('datePicker').render({disabled: false});
|
||||
return;
|
||||
}
|
||||
|
||||
const link = $.createLink('task', 'ajaxGetTaskEstStartedAndDeadline', 'taskID=' + parent);
|
||||
$.getJSON(link, function(data)
|
||||
@@ -467,4 +474,11 @@ function checkEstStartedAndDeadline(event)
|
||||
}
|
||||
$deadlineDiv.append($datetip);
|
||||
}
|
||||
|
||||
let $estStartedPicker = $estStarted.zui('datePicker');
|
||||
let $deadlinePicker = $deadline.zui('datePicker');
|
||||
$estStartedPicker.render({disabled: parentEstStarted == ''});
|
||||
$deadlinePicker.render({disabled: parentDeadline == ''});
|
||||
if(parentEstStarted == '') $estStartedPicker.$.setValue('');
|
||||
if(parentDeadline == '') $deadlinePicker.$.setValue('');
|
||||
}
|
||||
|
||||
@@ -465,6 +465,7 @@ detailBody
|
||||
datePicker
|
||||
(
|
||||
set::name('estStarted'),
|
||||
set::disabled(!empty($parentTask) && helper::isZeroDate($parentTask->estStarted) ? true : false),
|
||||
on::change('checkEstStartedAndDeadline'),
|
||||
helper::isZeroDate($task->estStarted) ? null : set::value($task->estStarted)
|
||||
)
|
||||
@@ -479,6 +480,7 @@ detailBody
|
||||
datePicker
|
||||
(
|
||||
set::name('deadline'),
|
||||
set::disabled(!empty($parentTask) && helper::isZeroDate($parentTask->deadline) ? true : false),
|
||||
on::change('checkEstStartedAndDeadline'),
|
||||
helper::isZeroDate($task->deadline) ? null : set::value($task->deadline)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user