mirror of
https://github.com/Karaka-Management/oms-Organization.git
synced 2026-02-13 14:58:41 +00:00
improve organigram rendering
This commit is contained in:
parent
b61debfd13
commit
f531c694c9
|
|
@ -19,7 +19,7 @@ use Modules\Organization\Models\DepartmentMapper;
|
||||||
use Modules\Organization\Models\Position;
|
use Modules\Organization\Models\Position;
|
||||||
use Modules\Organization\Models\PositionMapper;
|
use Modules\Organization\Models\PositionMapper;
|
||||||
use Modules\Organization\Models\UnitMapper;
|
use Modules\Organization\Models\UnitMapper;
|
||||||
|
use phpOMS\Asset\AssetType;
|
||||||
use phpOMS\Contract\RenderableInterface;
|
use phpOMS\Contract\RenderableInterface;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
use phpOMS\Message\ResponseAbstract;
|
use phpOMS\Message\ResponseAbstract;
|
||||||
|
|
@ -106,6 +106,10 @@ final class BackendController extends Controller
|
||||||
*/
|
*/
|
||||||
public function viewOrganigram(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
|
public function viewOrganigram(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
|
||||||
{
|
{
|
||||||
|
$response->get('Content')
|
||||||
|
->getData('head')
|
||||||
|
->addAsset(AssetType::CSS, 'Modules/Organization/Theme/Backend/css/styles.css');
|
||||||
|
|
||||||
$view = new View($this->app->l11nManager, $request, $response);
|
$view = new View($this->app->l11nManager, $request, $response);
|
||||||
|
|
||||||
$view->setTemplate('/Modules/Organization/Theme/Backend/organigram');
|
$view->setTemplate('/Modules/Organization/Theme/Backend/organigram');
|
||||||
|
|
|
||||||
15
Theme/Backend/css/styles.css
Normal file
15
Theme/Backend/css/styles.css
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
.organigram .portlet {
|
||||||
|
margin: 0 auto; }
|
||||||
|
.organigram .unit {
|
||||||
|
margin: 1rem auto; }
|
||||||
|
.organigram .departments {
|
||||||
|
margin: .5rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
border: 1px solid #ebedf2; }
|
||||||
|
.organigram .position {
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 1rem; }
|
||||||
25
Theme/Backend/css/styles.scss
Normal file
25
Theme/Backend/css/styles.scss
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
.organigram {
|
||||||
|
.portlet {
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.unit {
|
||||||
|
margin: 1rem auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.departments {
|
||||||
|
margin: .5rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
|
||||||
|
border: 1px solid #ebedf2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.position {
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -24,16 +24,16 @@ $unitRoot = $unitTree[null][0]['children'];
|
||||||
// departments
|
// departments
|
||||||
// positions
|
// positions
|
||||||
?>
|
?>
|
||||||
<div class="row">
|
<div class="row organigram">
|
||||||
<?php foreach ($unitRoot as $unitEle) : ?>
|
<?php foreach ($unitRoot as $unitEle) : ?>
|
||||||
<div class="row" style="margin: 0 auto;">
|
<div class="row">
|
||||||
<?php while (!empty($unitEle) && $unitEle['obj'] !== null) {
|
<?php while (!empty($unitEle) && $unitEle['obj'] !== null) {
|
||||||
$unitTree[null][$unitEle['obj']->getParent()->getId()]['index'] = $unitTree[null][$unitEle['obj']->getParent()->getId()]['index'] + 1;
|
$unitTree[null][$unitEle['obj']->getParent()->getId()]['index'] = $unitTree[null][$unitEle['obj']->getParent()->getId()]['index'] + 1;
|
||||||
?>
|
?>
|
||||||
<?php while (!empty($unitEle)) {
|
<?php while (!empty($unitEle)) {
|
||||||
$unitId = $unitEle['obj']->getId(); ?>
|
$unitId = $unitEle['obj']->getId(); ?>
|
||||||
<div class="col" style="margin: 0 auto; background: #00f; padding: 1rem;">
|
<div class="col">
|
||||||
<div style="margin: 0 auto; background: #f00; padding: 1rem;"><?= $unitEle['obj']->getName(); ?></div>
|
<div class="portlet unit"><div class="portlet-body"><?= $unitEle['obj']->getName(); ?></div></div>
|
||||||
|
|
||||||
<?php if (isset($depTree[$unitId]) && !empty($depTree[$unitId])) : ?>
|
<?php if (isset($depTree[$unitId]) && !empty($depTree[$unitId])) : ?>
|
||||||
<!-- departments -->
|
<!-- departments -->
|
||||||
|
|
@ -45,11 +45,12 @@ $unitRoot = $unitTree[null][0]['children'];
|
||||||
$depTree[$unitId][$depEle['obj']->getParent()->getId()]['index'] = $depTree[$unitId][$depEle['obj']->getParent()->getId()]['index'] + 1;
|
$depTree[$unitId][$depEle['obj']->getParent()->getId()]['index'] = $depTree[$unitId][$depEle['obj']->getParent()->getId()]['index'] + 1;
|
||||||
?>
|
?>
|
||||||
<?php while (!empty($depEle)) { ?>
|
<?php while (!empty($depEle)) { ?>
|
||||||
<div class="col" style="margin: 0 auto; background: #0f0; padding: 1rem;">
|
<div class="departments">
|
||||||
<div style="margin: 0 auto; background: #ff0; padding: 1rem;"><?= $depEle['obj']->getName(); ?></div>
|
<div class="portlet">
|
||||||
|
<div class="portlet-head"><?= $depEle['obj']->getName(); ?></div>
|
||||||
|
|
||||||
<!-- positions -->
|
<!-- positions -->
|
||||||
<div style="margin: 0 auto; background: #fff; padding: 1rem;">
|
<div class="portlet-body">
|
||||||
<ul>
|
<ul>
|
||||||
<?php
|
<?php
|
||||||
$depId = $depEle['obj']->getId();
|
$depId = $depEle['obj']->getId();
|
||||||
|
|
@ -74,8 +75,9 @@ $unitRoot = $unitTree[null][0]['children'];
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row" class="childdepartment">
|
<div class="row">
|
||||||
<?php
|
<?php
|
||||||
// find the closest parent who has un-rendered children
|
// find the closest parent who has un-rendered children
|
||||||
$toCloseDep = 0;
|
$toCloseDep = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user