* [task#130232,done,5h] add story field for batch edit task.
This commit is contained in:
@@ -58,6 +58,14 @@ window.renderRowData = function($row, index, row)
|
||||
$module.$.setValue(row.module);
|
||||
});
|
||||
}
|
||||
|
||||
$row.find('[data-name="story"]').find('.picker-box').on('inited', function(e, info)
|
||||
{
|
||||
const storyItems = stories[row.module] != undefined ? stories[row.module] : [];
|
||||
const $storyPicker = info[0];
|
||||
$storyPicker.render({items: storyItems});
|
||||
$storyPicker.$.setValue(row.story);
|
||||
});
|
||||
}
|
||||
|
||||
window.clickSubmit = async function(e)
|
||||
@@ -191,3 +199,64 @@ function checkBatchEstStartedAndDeadline(event)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get select of stories.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setStories(event)
|
||||
{
|
||||
const $module = $(event.target);
|
||||
const $currentRow = $module.closest('tr');
|
||||
const moduleID = $module.val();
|
||||
const getStoryLink = $.createLink('task', 'ajaxGetStories', 'executionID=' + executionID + '&moduleID=' + moduleID);
|
||||
|
||||
let $row = $currentRow;
|
||||
while($row.length)
|
||||
{
|
||||
const $storyPicker = $row.find('[name^=story]').zui('picker');
|
||||
const storyID = $row.find('[name^=story]').val();
|
||||
$.getJSON(getStoryLink, function(stories)
|
||||
{
|
||||
$storyPicker.render({items: stories})
|
||||
$storyPicker.$.setValue(storyID);
|
||||
});
|
||||
|
||||
$row = $row.next('tr');
|
||||
if(!$row.find('td[data-name="module"][data-ditto="on"]').length) break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set preview.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setStoryRelated(event)
|
||||
{
|
||||
let $story = $(event.target).closest('td').find('input[name^=story]');
|
||||
let $currentRow = $(event.target).closest('tr');
|
||||
let storyID = $story.val();
|
||||
let link = $.createLink('story', 'ajaxGetInfo', 'storyID=' + storyID + '&pageType=batch');
|
||||
let $row = $currentRow;
|
||||
|
||||
while($row.length)
|
||||
{
|
||||
const $module = $row.find('input[name^="module"]');
|
||||
|
||||
if(storyID > 0)
|
||||
{
|
||||
$.getJSON(link, function(data)
|
||||
{
|
||||
const storyInfo = data['storyInfo'];
|
||||
$module.zui('picker').$.setValue(parseInt(storyInfo.moduleID), true);
|
||||
});
|
||||
}
|
||||
|
||||
$row = $row.next('tr');
|
||||
if(!$row.find('td[data-name="story"][data-ditto="on"]').length) break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1273,9 +1273,6 @@ class taskModel extends model
|
||||
$task->closedDate = !empty($task->closedDate) ? substr($task->closedDate, 0, 19) : null;
|
||||
$task->lastEditedDate = !empty($task->lastEditedDate) ? substr($task->lastEditedDate, 0, 19) : null;
|
||||
$task->realStarted = !empty($task->realStarted) ? substr($task->realStarted, 0, 19) : null;
|
||||
$task->estimate = helper::formatHours($task->estimate);
|
||||
$task->left = helper::formatHours($task->left);
|
||||
$task->consumed = helper::formatHours($task->consumed);
|
||||
|
||||
/* Get the child tasks of the parent task. */
|
||||
$children = $this->dao->select('*')->from(TABLE_TASK)->where('parent')->eq($taskID)->andWhere('deleted')->eq(0)->fetchAll('id');
|
||||
@@ -2588,6 +2585,11 @@ class taskModel extends model
|
||||
$task->teamMembers = implode(',', array_keys($teamMembers));
|
||||
}
|
||||
|
||||
/* Format task hours. */
|
||||
$task->estimate = helper::formatHours($task->estimate);
|
||||
$task->consumed = helper::formatHours($task->consumed);
|
||||
$task->left = helper::formatHours($task->left);
|
||||
|
||||
foreach($task as $field => $value)
|
||||
{
|
||||
if(in_array($field, $this->config->task->dateFields) && helper::isZeroDate($value)) $task->$field = '';
|
||||
|
||||
+1
-1
@@ -259,7 +259,7 @@ class taskTao extends taskModel
|
||||
*/
|
||||
protected function computeTaskProgress(object $task): float
|
||||
{
|
||||
if($task->left > 0) return round($task->consumed / ($task->consumed + (float)$task->left), 2) * 100;
|
||||
if($task->left > 0) return round($task->consumed / ((float)$task->consumed + (float)$task->left), 2) * 100;
|
||||
if($task->consumed == 0) return 0;
|
||||
return 100;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ jsVar('executionID', $executionID);
|
||||
jsVar('childTasks', $childTasks);
|
||||
jsVar('nonStoryChildTasks', $nonStoryChildTasks);
|
||||
jsVar('tasks', $tasks);
|
||||
jsVar('stories', $stories);
|
||||
jsVar('syncStoryToAllChildrenTip', $lang->task->syncStoryToAllChildrenTip);
|
||||
jsVar('syncStoryToChildrenTip', $lang->task->syncStoryToChildrenTip);
|
||||
jsVar('parentTasks', $parentTasks);
|
||||
@@ -39,6 +40,9 @@ formBatchPanel
|
||||
set::ajax(array('beforeSubmit' => jsRaw('clickSubmit'))),
|
||||
on::change('[data-name="status"]', 'statusChange'),
|
||||
on::change('[data-name="estStarted"], [data-name="deadline"]', 'checkBatchEstStartedAndDeadline'),
|
||||
on::change('[data-name="module"]', 'setStories'),
|
||||
on::change('input[name^=story]', 'setStoryRelated'),
|
||||
on::click('[data-name=story] [data-type=ditto]', 'setStoryRelated'),
|
||||
set::formID('taskBatchEditForm' . $executionID),
|
||||
formBatchItem
|
||||
(
|
||||
@@ -76,7 +80,7 @@ formBatchPanel
|
||||
set::name('story'),
|
||||
set::label($lang->task->story),
|
||||
set::control('picker'),
|
||||
set::items($stories),
|
||||
set::items(array()),
|
||||
set::width('200px'),
|
||||
set::ditto(true),
|
||||
set::defaultDitto('off')
|
||||
|
||||
+9
-1
@@ -237,6 +237,14 @@ class taskZen extends task
|
||||
}
|
||||
|
||||
list($childTasks, $nonStoryChildTasks) = $this->task->getChildTasksByList(array_keys($tasks));
|
||||
$storyPairs = $this->story->getExecutionStoryPairs($executionID, 0, 'all', '', 'full', 'active', 'story', false);;
|
||||
$storyList = $this->story->getByList(array_keys($storyPairs));
|
||||
$stories = array();
|
||||
foreach($storyList as $story)
|
||||
{
|
||||
$stories[0][] = array('value' => $story->id, 'text' => $storyPairs[$story->id]);
|
||||
if($story->module) $stories[$story->module][] = array('value' => $story->id, 'text' => $storyPairs[$story->id]);
|
||||
}
|
||||
|
||||
/* Assign. */
|
||||
$this->view->executionID = $executionID;
|
||||
@@ -247,7 +255,7 @@ class taskZen extends task
|
||||
$this->view->moduleGroup = $moduleGroup;
|
||||
$this->view->childTasks = $childTasks;
|
||||
$this->view->nonStoryChildTasks = $nonStoryChildTasks;
|
||||
$this->view->stories = $this->story->getExecutionStoryPairs($executionID, 0, 'all', '', 'full', 'active', 'story', false);
|
||||
$this->view->stories = $stories;
|
||||
$this->view->parentTasks = $this->task->getByIdList($parentTaskIdList);
|
||||
|
||||
$this->display();
|
||||
|
||||
Reference in New Issue
Block a user