From 7bca3676a591901dec0e28faee4ef108dc10c76e Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Mon, 17 Jul 2023 09:40:47 +0800 Subject: [PATCH] + Add execution dynamic page. --- module/execution/css/dynamic.ui.css | 4 ++ module/execution/js/dynamic.ui.js | 12 ++++ module/execution/ui/dynamic.html.php | 89 ++++++++++++++++++++++++++++ module/index/config.php | 1 - 4 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 module/execution/css/dynamic.ui.css create mode 100644 module/execution/js/dynamic.ui.js create mode 100644 module/execution/ui/dynamic.html.php diff --git a/module/execution/css/dynamic.ui.css b/module/execution/css/dynamic.ui.css new file mode 100644 index 0000000000..4052f39b98 --- /dev/null +++ b/module/execution/css/dynamic.ui.css @@ -0,0 +1,4 @@ +.date-block {max-height: 60px;} +.date-block .btn-link {background-color: var(--nav-active-bg); width: 28px; height: 28px;} + +.dynamic.collapsed {max-height: 28px; overflow: hidden;} diff --git a/module/execution/js/dynamic.ui.js b/module/execution/js/dynamic.ui.js new file mode 100644 index 0000000000..ec42d497f9 --- /dev/null +++ b/module/execution/js/dynamic.ui.js @@ -0,0 +1,12 @@ +window.changeUser = function() +{ + const picker = $('#user').zui('picker'); + const user = picker ? picker.$.value : ''; + const type = user ? 'account' : 'today'; + loadPage($.createLink('execution', 'dynamic', `productID=${executionID}&type=${type}¶m=${user}`)); +} + +window.toggleActions = function() +{ + $(this).closest('.flex-col').find('.dynamic').toggleClass('collapsed'); +} diff --git a/module/execution/ui/dynamic.html.php b/module/execution/ui/dynamic.html.php new file mode 100644 index 0000000000..17caa5e9f4 --- /dev/null +++ b/module/execution/ui/dynamic.html.php @@ -0,0 +1,89 @@ + + * @package execution + * @link https://www.zentao.net + */ +namespace zin; + +jsVar('executionID', $executionID); +/* zin: Define the feature bar on main menu. */ +featureBar +( + set::current($type), + set::linkParams("executionID={$executionID}&type={key}"), + li + ( + setClass('w-40'), + picker + ( + setID('user'), + set::name('user'), + set::placeholder($lang->execution->viewByUser), + set::items($userIdPairs), + set::value($param), + on::change('changeUser'), + ), + ), +); + +$content = null; +if(empty($dateGroups)) +{ + $content = div + ( + setClass('flex items-center justify-center h-64'), + span + ( + setClass('text-gray'), + $lang->action->noDynamic + ), + ); +} +else +{ + $content = array(); + $firstAction = ''; + foreach($dateGroups as $date => $actions) + { + $isToday = date(DT_DATE4) == $date; + $content[] = div + ( + setClass('flex flex-col mt-4'), + div + ( + setClass('flex items-center justify-between w-30 p-2 border-2 rounded-md date-block'), + span + ( + setClass('text-gray'), + $isToday ? $lang->action->dynamic->today : $date, + ), + btn + ( + setClass('ml-4 btn-link nav-feature'), + set::type('link'), + icon('caret-down btn-caret'), + on::click('toggleActions'), + ) + ), + div + ( + setClass('flex-auto p-2 ml-4 border-2 rounded-md px-4'), + dynamic + ( + set::dynamics($actions), + set::users($accountPairs), + ) + ) + ); + } +} + +panel +( + $content +); diff --git a/module/index/config.php b/module/index/config.php index 39a7cd533f..3d72ddd9c6 100644 --- a/module/index/config.php +++ b/module/index/config.php @@ -31,7 +31,6 @@ $config->index->oldPages[] = 'program-kanban'; $config->index->oldPages[] = 'project-kanban'; $config->index->oldPages[] = 'project-dynamic'; $config->index->oldPages[] = 'execution-taskkanban'; -$config->index->oldPages[] = 'execution-dynamic'; $config->index->oldPages[] = 'execution-grouptask'; $config->index->oldPages[] = 'execution-testtask'; $config->index->oldPages[] = 'kanban-space';