diff --git a/module/project/css/view.ui.css b/module/project/css/view.ui.css index e82f6fd456..6fc7b243ca 100644 --- a/module/project/css/view.ui.css +++ b/module/project/css/view.ui.css @@ -6,6 +6,7 @@ .pie-chart .pie-chart-title {position: absolute; top: 50%; left: 50%; margin-top: -20px; margin-left: -16px} .m-project-view #mainContent {display: flex;} .m-project-view #mainContent .main {flex: 1 0 65%;} -.m-project-view #mainContent .side {flex: 1 1 35%; overflow-x: hidden;} +.m-project-view #mainContent .side {flex: 1 1 35%; overflow: hidden;} #dynamicBlock {height: 50vh; display: flex; flex-direction: column; box-shadow: none;} #dynamicBlock .panel-body {flex: 1 1 auto; overflow-y: auto;} +#historyBlock {height: 30vh; overflow-y: auto;} diff --git a/module/project/ui/browsebycard.html.php b/module/project/ui/browsebycard.html.php index 96a0843fbc..9dc40663a1 100644 --- a/module/project/ui/browsebycard.html.php +++ b/module/project/ui/browsebycard.html.php @@ -75,7 +75,7 @@ toolbar $projectCards = null; if(!empty($projectStats)) { - foreach ($projectStats as $projectID => $project) + foreach($projectStats as $project) { $status = isset($project->delay) ? 'delay' : $project->status; $statusLabel = $config->project->statusLabelList[$status]; @@ -133,7 +133,7 @@ if(!empty($projectStats)) $projectCards[] = div ( setClass('col'), - set('data-id', $projectID), + set('data-id', $project->id), div ( setClass('panel'), @@ -149,7 +149,7 @@ if(!empty($projectStats)) a ( setClass('project-name'), - set::href(createLink('project', 'index', "projectID={$projectID}")), + set::href(createLink('project', 'index', "projectID={$project->id}")), set::title($project->name), h::strong($project->name) ), @@ -263,7 +263,7 @@ if(!empty($projectStats)) a ( setClass('project-members-total pl-2 mt-1'), - set::href(createLink('project', 'team', "projectID={$projectID}")), + set::href(createLink('project', 'team', "projectID={$project->id}")), sprintf($lang->project->teamSumCount, $project->teamCount), ) ), diff --git a/module/project/ui/view.html.php b/module/project/ui/view.html.php index cc817c4fe3..540d08331d 100644 --- a/module/project/ui/view.html.php +++ b/module/project/ui/view.html.php @@ -45,6 +45,61 @@ elseif($totalEstimate > 0) $status = $this->processStatus('project', $project); +$relatedProducts = null; +if($project->hasProduct) +{ + foreach($products as $productID => $product) + { + $productDom = null; + foreach($product->branches as $branchID) + { + $branchName = isset($branchGroups[$productID][$branchID]) ? '/' . $branchGroups[$productID][$branchID] : ''; + $productDom = h::td + ( + icon('product mr-2'), + a + ( + hasPriv('product', 'browse') ? set::href(createLink('product', 'browse', "productID={$productID}&branch={$branchID}")) : null, + span($product->name . $branchName) + ) + ); + } + + $plans = array(); + $planDom = null; + foreach($product->plans as $planIDList) + { + $planIDList = explode(',', $planIDList); + foreach($planIDList as $planID) + { + if(!isset($planGroup[$productID][$planID])) continue; + + $planClass = count($plans) > 2 ? 'mt-2' : ''; + $planClass .= count($plans) % 3 != 0 ? 'pl-4' : ''; + $plans[] = div + ( + setClass("flex-none w-1/3 clip {$planClass}"), + icon('calendar mr-2 '), + a + ( + hasPriv('productplan', 'view') ? set::href(createLink('productplan', 'view', "planID={$planID}")) : null, + span($planGroup[$productID][$planID]) + ) + ); + } + } + $planDom[] = h::td + ( + div + ( + setClass('flex flex-wrap'), + $plans + ) + ); + $relatedProducts[] = h::tr(setClass('border-r'), $productDom, $planDom); + } +} + div ( setClass('main'), @@ -216,7 +271,53 @@ div ), div ( - setClass('flex-auto canvas flex p-4 mt-4'), + setClass('flex flex-auto p-4 mt-4'), + div + ( + setClass('w-full'), + /* Linked product and plan. */ + h::table + ( + setClass('table condensed bordered'), + h::thead + ( + h::tr + ( + $project->hasProduct ? h::th + ( + setClass('w-1/3'), + div + ( + setClass('flex items-center justify-between'), + span + ( + setClass('leading-8 flex'), + img(set('src', 'static/svg/product.svg'), setClass('mr-2')), + $lang->project->manageProducts + ), + common::hasPriv('project', 'manageproducts') ? btn + ( + setClass('ghost text-gray'), + set::url(createLink('project', 'manageproducts', "projectID={$project->id}")), + icon('link', setClass('text-primary')), + span($lang->more, setClass('font-normal')) + ) : null, + ) + ) : null, + h::th + ( + span + ( + setClass('flex'), + img(set('src', 'static/svg/productplan.svg'), setClass('mr-2')), + $lang->execution->linkPlan + ) + ) + ) + ), + h::tbody($relatedProducts) + ) + ), ) ); @@ -245,6 +346,12 @@ div ), set::bodyClass('pt-0'), dynamic() + ), + div + ( + setID('historyBlock'), + setClass('mt-4'), + history() ) ); @@ -268,6 +375,7 @@ foreach($config->project->view->operateList['common'] as $operate) $settings = $config->project->actionList[$operate]; $settings['text'] = ''; + if($operate == 'edit') $settings['url'] = createLink('project', 'edit', "projectID={$project->id}"); $commonActions[] = $settings; }