Merge branch 'sprint/sunhao/task56391'
This commit is contained in:
@@ -1,3 +1,23 @@
|
||||
/* Update other picker on change */
|
||||
$.zui.Picker.DEFAULTS.onChange = function(event)
|
||||
{
|
||||
var picker = event.picker;
|
||||
if(!picker.$formItem.is('[name^=accounts]')) return;
|
||||
|
||||
var select = picker.$formItem[0];
|
||||
var newItem = event.value.length ? $.extend({}, picker.getListItem(event.value), {disabled: true}) : $.extend({}, picker.getListItem(event.oldValue), {disabled: false});
|
||||
|
||||
$('.picker-select[name^=accounts]').each(function()
|
||||
{
|
||||
if(this === select) return;
|
||||
|
||||
var $select = $(this);
|
||||
var selectPicker = $select.data('zui.picker');
|
||||
|
||||
if(selectPicker) selectPicker.updateOptionList([newItem]);
|
||||
});
|
||||
}
|
||||
|
||||
$(function()
|
||||
{
|
||||
$('#execution_chosen, #execution + .picker').click(function()
|
||||
@@ -18,7 +38,7 @@ $(function()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
|
||||
/**
|
||||
@@ -51,15 +71,27 @@ function addItem(obj)
|
||||
|
||||
if($accounts.attr('data-pickertype') != 'remote')
|
||||
{
|
||||
$accounts.picker({type: 'user'});
|
||||
$accounts.addClass('picker-select').picker({chosenMode: true});
|
||||
}
|
||||
else
|
||||
{
|
||||
$accounts.parent().find('.picker.picker-ready').remove();
|
||||
var pickerremote = $accounts.attr('data-pickerremote');
|
||||
$accounts.picker({chosenMode: true, remote: pickerremote});
|
||||
$accounts.addClass('picker-select').picker({chosenMode: true, remote: pickerremote});
|
||||
}
|
||||
itemIndex ++;
|
||||
|
||||
var disabledItems = [];
|
||||
$('.picker-select[name^=accounts]').each(function()
|
||||
{
|
||||
if(this === $accounts[0]) return;
|
||||
var $select = $(this);
|
||||
var picker = $select.data('zui.picker');
|
||||
if(!picker) return;
|
||||
var selectItem = picker.getListItem(picker.getValue());
|
||||
if(selectItem) disabledItems.push($.extend({}, selectItem, {disabled: true}));
|
||||
});
|
||||
if(disabledItems.length) $accounts.data('zui.picker').updateOptionList(disabledItems);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
|
||||
<?php foreach($members2Import as $member2Import):?>
|
||||
<tr class='addedItem'>
|
||||
<td><?php echo html::select("accounts[]", $users, $member2Import->account, "class='form-control user-picker' onchange='setRole(this.value, $i)' data-max-list-count=" . $config->maxCount);?></td>
|
||||
<td><?php echo html::select("accounts[]", $users, $member2Import->account, "class='form-control picker-select' onchange='setRole(this.value, $i)'");?></td>
|
||||
<td><input type='text' name='roles[]' id='role<?php echo $i;?>' class='form-control' value='<?php echo $member2Import->role;?>' /></td>
|
||||
<td><input type='text' name='days[]' id='days<?php echo $i;?>' class='form-control' value='<?php echo $execution->days?>'/></td>
|
||||
<td>
|
||||
@@ -87,7 +87,11 @@
|
||||
<?php if(!isset($users[$deptAccount])) continue;?>
|
||||
<?php if(isset($members2Import[$deptAccount])) continue;?>
|
||||
<tr class='addedItem'>
|
||||
<<<<<<< HEAD
|
||||
<td><?php echo html::select("accounts[]", $users, $deptAccount, "class='form-control user-picker' onchange='setRole(this.value, $i)' data-max-list-count=" . $config->maxCount);?></td>
|
||||
=======
|
||||
<td><?php echo html::select("accounts[]", $users, $deptAccount, "class='form-control picker-select' onchange='setRole(this.value, $i)'");?></td>
|
||||
>>>>>>> sprint/sunhao/task56391
|
||||
<td><input type='text' name='roles[]' id='role<?php echo $i;?>' class='form-control' value='<?php echo $roles[$deptAccount]?>'/></td>
|
||||
<td><input type='text' name='days[]' id='days<?php echo $i;?>' class='form-control' value='<?php echo $execution->days?>'/></td>
|
||||
<td>
|
||||
@@ -105,7 +109,11 @@
|
||||
|
||||
<?php for($j = 0; $j < 5; $j ++):?>
|
||||
<tr class='addedItem'>
|
||||
<<<<<<< HEAD
|
||||
<td><?php echo html::select("accounts[]", $users, '', "class='form-control user-picker' onchange='setRole(this.value, $i)' data-max-list-count=" . $config->maxCount);?></td>
|
||||
=======
|
||||
<td><?php echo html::select("accounts[]", $users, '', "class='form-control picker-select' onchange='setRole(this.value, $i)'");?></td>
|
||||
>>>>>>> sprint/sunhao/task56391
|
||||
<td><input type='text' name='roles[]' id='role<?php echo ($i);?>' class='form-control' /></td>
|
||||
<td><input type='text' name='days[]' id='days<?php echo ($i);?>' class='form-control' value='<?php echo $execution->days?>'/></td>
|
||||
<td>
|
||||
|
||||
@@ -1,3 +1,24 @@
|
||||
/* Update other picker on change */
|
||||
$.zui.Picker.DEFAULTS.onChange = function(event)
|
||||
{
|
||||
var picker = event.picker;
|
||||
if(!picker.$formItem.is('[name^=accounts]')) return;
|
||||
|
||||
var select = picker.$formItem[0];
|
||||
var newItem = event.value.length ? $.extend({}, picker.getListItem(event.value), {disabled: true}) : $.extend({}, picker.getListItem(event.oldValue), {disabled: false});
|
||||
|
||||
$('.user-picker[name^=accounts]').each(function()
|
||||
{
|
||||
if(this === select) return;
|
||||
|
||||
var $select = $(this);
|
||||
var selectPicker = $select.data('zui.picker');
|
||||
|
||||
if(selectPicker) selectPicker.updateOptionList([newItem]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save team members.
|
||||
*
|
||||
@@ -64,10 +85,20 @@ function addItem(obj)
|
||||
{
|
||||
var item = $('#addItem').html().replace(/%i%/g, itemIndex);
|
||||
var $tr = $('<tr class="addedItem">' + item + '</tr>').insertAfter($(obj).closest('tr'));
|
||||
$tr.find('select:first')
|
||||
.trigger('liszt:updated')
|
||||
.picker({type: 'user'});
|
||||
var $accounts = $tr.find('select:first').addClass('user-picker').trigger('list:updated').picker({type: 'user'});
|
||||
itemIndex++;
|
||||
|
||||
var disabledItems = [];
|
||||
$('.user-picker[name^=accounts]').each(function()
|
||||
{
|
||||
if(this === $accounts[0]) return;
|
||||
var $select = $(this);
|
||||
var picker = $select.data('zui.picker');
|
||||
if(!picker) return;
|
||||
var selectItem = picker.getListItem(picker.getValue());
|
||||
if(selectItem) disabledItems.push($.extend({}, selectItem, {disabled: true}));
|
||||
});
|
||||
if(disabledItems.length) $accounts.data('zui.picker').updateOptionList(disabledItems);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<?php foreach($deptUsers as $deptAccount => $userName):?>
|
||||
<?php if(!isset($users[$deptAccount])) continue;?>
|
||||
<tr class='addedItem'>
|
||||
<td><?php echo html::select("accounts[$i]", $users, $deptAccount, "class='form-control user-picker' onchange='setRole(this.value, $i)' data-max-list-count=" . $config->maxCount);?></td>
|
||||
<td><?php echo html::select("accounts[$i]", $users, $deptAccount, "class='form-control user-picker' onchange='setRole(this.value, $i)'");?></td>
|
||||
<td><?php echo html::input("roles[$i]", $roles[$deptAccount], "class='form-control'");?></td>
|
||||
<td><?php echo html::input("days[$i]", $project->days, "class='form-control'");?></td>
|
||||
<td><?php echo html::input("hours[$i]", $config->execution->defaultWorkhours, "class='form-control'");?></td>
|
||||
|
||||
+4
-4
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user