diff --git a/lib/zin/func.php b/lib/zin/func.php index 7262867470..f55288336e 100644 --- a/lib/zin/func.php +++ b/lib/zin/func.php @@ -210,6 +210,7 @@ function thinkStepDetail(): thinkStepDetail {return createWg('thinkStepDetail', function thinkTableInputDetail(): thinkTableInputDetail {return createWg('thinkTableInputDetail', func_get_args());} function thinkNodeMenu(): thinkNodeMenu {return createWg('thinkNodeMenu', func_get_args());} function thinkCover(): thinkCover {return createWg('thinkCover', func_get_args());} +function affected(): affected {return createWg('affected', func_get_args());} if(is_dir(__DIR__ . DS . 'wg' . DS . 'boardeditor')) { diff --git a/lib/zin/wg/affected/v1.php b/lib/zin/wg/affected/v1.php new file mode 100644 index 0000000000..15b7cd3fa8 --- /dev/null +++ b/lib/zin/wg/affected/v1.php @@ -0,0 +1,119 @@ +prop(array('tasks', 'executions', 'teams', 'bugs', 'cases', 'twins', 'stories')); + + $affectedProjects = array(); + $affectedTaskCount = 0; + foreach($executions as $executionID => $execution) + { + $teamAccounts = ''; + if(isset($teams[$executionID])) + { + foreach($teams[$executionID] as $member) $teamAccounts .= zget(data('users'), $member->account) . ' '; + } + + $executionTasks = array_values(zget($tasks, $executionID, array())); + $affectedTaskCount += count($executionTasks); + $affectedProjects[] = h6 + ( + $execution->name, + $teamAccounts ? h::small(icon('group'), $teamAccounts) : null + ); + $affectedProjects[] = empty($executionTasks) ? div(setClass('dtable-empty-tip'), div(setClass('text-gray'), $lang->noData)) : dtable + ( + set::cols($config->story->affect->projects->fields), + set::data($executionTasks) + ); + } + + return formGroup + ( + setClass('w-full'), + set::label($lang->story->checkAffection), + tabs + ( + setClass('w-full'), + tabPane + ( + to::suffix(label($affectedTaskCount)), + set::key('affectedProjects'), + set::title($lang->story->affectedProjects), + set::active(true), + empty($affectedProjects) ? div(setClass('dtable-empty-tip'), div(setClass('text-gray'), $lang->noData)) : $affectedProjects + ), + empty($stories) ? null : tabPane + ( + to::suffix(label(count($stories))), + set::key('affectedBugs'), + set::title($lang->story->affectedStories), + empty($stories) ? div(setClass('dtable-empty-tip'), div(setClass('text-gray'), $lang->noData)) : dtable + ( + set::cols($config->story->affect->stories->fields), + set::data(array_values($stories)), + set::style(array('min-width' => '100%')) + ) + ), + tabPane + ( + to::suffix(label(count($bugs))), + set::key('affectedBugs'), + set::title($lang->story->affectedBugs), + empty($bugs) ? div(setClass('dtable-empty-tip'), div(setClass('text-gray'), $lang->noData)) : dtable + ( + set::cols($config->story->affect->bugs->fields), + set::data(array_values($bugs)), + set::style(array('min-width' => '100%')) + ) + ), + tabPane + ( + to::suffix(label(count($cases))), + set::key('affectedCases'), + set::title($lang->story->affectedCases), + empty($cases) ? div(setClass('dtable-empty-tip'), div(setClass('text-gray'), $lang->noData)) : dtable + ( + set::cols($config->story->affect->cases->fields), + set::data(array_values($cases)), + set::style(array('min-width' => '100%')) + ) + ), + empty($twins) ? null : tabPane + ( + to::suffix(label(count($twins))), + set::key('affectedTwins'), + set::title($lang->story->affectedTwins), + empty($twins) ? div(setClass('dtable-empty-tip'), div(setClass('text-gray'), $lang->noData)) : dtable + ( + set::cols($config->story->affect->twins->fields), + set::data(array_values($twins)), + set::style(array('min-width' => '100%')) + ) + ) + ) + ); + } +}