* fix UI of tree edit view.
This commit is contained in:
@@ -37,6 +37,10 @@ class dept extends control
|
||||
$parentDepts = $this->dept->getParents($deptID);
|
||||
$this->view->title = $this->lang->dept->manage . $this->lang->colon . $this->app->company->name;
|
||||
$this->view->position[] = $this->lang->dept->manage;
|
||||
$this->view->deptID = $deptID;
|
||||
$this->view->depts = $this->dept->getTreeMenu($rootDeptID = 0, array('deptmodel', 'createManageLink'));
|
||||
$this->view->parentDepts = $parentDepts;
|
||||
$this->view->sons = $this->dept->getSons($deptID);
|
||||
$this->view->tree = $this->dept->getFullTree(0);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -14,14 +14,63 @@
|
||||
<div id='titlebar'>
|
||||
<div class='heading'><?php echo html::icon($lang->icons['dept']);?> <?php echo $lang->dept->common;?></div>
|
||||
</div>
|
||||
<div class='main'>
|
||||
<div class='panel'>
|
||||
<div class='panel-heading'>
|
||||
<?php echo html::icon($lang->icons['dept']);?> <strong><?php echo $title;?></strong>
|
||||
<div class='row'>
|
||||
<div class='col-sm-4'>
|
||||
<div class='panel'>
|
||||
<div class='panel-heading'>
|
||||
<?php echo html::icon($lang->icons['dept']);?> <strong><?php echo $title;?></strong>
|
||||
</div>
|
||||
<div class='panel-body'>
|
||||
<div class='container'>
|
||||
<ul class='tree-lines' id='deptTree'></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='panel-body'>
|
||||
<div class='container'>
|
||||
<ul class='tree-lines' id='deptTree'></ul>
|
||||
</div>
|
||||
<div class='col-sm-8'>
|
||||
<div class='panel panel-sm'>
|
||||
<div class='panel-heading'>
|
||||
<i class='icon-sitemap'></i> <strong><?php echo $lang->dept->manageChild;?></strong>
|
||||
</div>
|
||||
<div class='panel-body'>
|
||||
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('dept', 'manageChild');?>' class='form-condensed'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<td>
|
||||
<nobr>
|
||||
<?php
|
||||
echo html::a($this->createLink('dept', 'browse'), $this->app->company->name);
|
||||
echo $lang->arrow;
|
||||
foreach($parentDepts as $dept)
|
||||
{
|
||||
echo html::a($this->createLink('dept', 'browse', "deptID=$dept->id"), $dept->name);
|
||||
echo $lang->arrow;
|
||||
}
|
||||
?>
|
||||
</nobr>
|
||||
</td>
|
||||
<td class='w-300px'>
|
||||
<?php
|
||||
$maxOrder = 0;
|
||||
foreach($sons as $sonDept)
|
||||
{
|
||||
if($sonDept->order > $maxOrder) $maxOrder = $sonDept->order;
|
||||
echo html::input("depts[id$sonDept->id]", $sonDept->name, "class='form-control'");
|
||||
}
|
||||
for($i = 0; $i < DEPT::NEW_CHILD_COUNT ; $i ++) echo html::input("depts[]", '', "class='form-control'");
|
||||
?>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<?php echo html::submitButton() . html::backButton() . html::hidden('maxOrder', $maxOrder);?>
|
||||
<input type='hidden' value='<?php echo $deptID;?>' name='parentDeptID' />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -46,13 +95,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(function()
|
||||
{
|
||||
var data = $.parseJSON('<?php echo json_encode($tree);?>');
|
||||
var $tree = $('#deptTree').tree(
|
||||
{
|
||||
name: 'deptTree',
|
||||
initialState: 'preserve',
|
||||
data: data,
|
||||
itemCreator: function($li, item)
|
||||
@@ -80,9 +130,10 @@ $(function()
|
||||
},
|
||||
add:
|
||||
{
|
||||
title: '<?php echo $lang->dept->add ?>',
|
||||
template: '<a data-toggle="tooltip" href="javascript:;"><i class="icon icon-plus"></i>',
|
||||
templateInList: '<a href="javascript:;"><i class="icon icon-plus"></i> <?php echo $lang->dept->add ?></a>'
|
||||
title: '<?php echo $lang->dept->manageChild ?>',
|
||||
linkTemplate: '<?php echo helper::createLink('dept', 'browse', "deptID={0}"); ?>',
|
||||
template: '<a data-toggle="tooltip" href="javascript:;"><i class="icon icon-sitemap"></i>',
|
||||
templateInList: false
|
||||
},
|
||||
"delete":
|
||||
{
|
||||
@@ -108,10 +159,7 @@ $(function()
|
||||
}
|
||||
else if(action.type === 'add')
|
||||
{
|
||||
var $modal = $('#addChildModal');
|
||||
$modal.find('input[name="parentDeptID"]').val(item ? item.id : 0);
|
||||
$modal.find('.dept-name').text(item ? item.name : '<?php echo $this->app->company->name ?>');
|
||||
$modal.modal('show');
|
||||
window.location.href = action.linkTemplate.format(item.id);
|
||||
}
|
||||
else if(action.type === 'sort')
|
||||
{
|
||||
|
||||
@@ -112,6 +112,7 @@ $(function()
|
||||
{
|
||||
var data = $.parseJSON('<?php echo json_encode($tree);?>');
|
||||
var options = {
|
||||
name: 'tree-<?php echo $viewType ?>-edit',
|
||||
initialState: 'preserve',
|
||||
data: data,
|
||||
itemCreator: function($li, item)
|
||||
|
||||
@@ -104,6 +104,7 @@ $(function()
|
||||
var data = $.parseJSON('<?php echo json_encode($tree);?>');
|
||||
var $tree = $('#modulesTree').tree(
|
||||
{
|
||||
name: 'tree-project-edit',
|
||||
initialState: 'preserve',
|
||||
data: data,
|
||||
itemCreator: function($li, item)
|
||||
|
||||
Reference in New Issue
Block a user