%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
$('i.glyphicon-refresh-animate').hide();
function updateItems(r) {
_opts.items.available = r.available;
_opts.items.assigned = r.assigned;
search('available');
search('assigned');
}
$('.btn-assign').click(function () {
var $this = $(this);
var target = $this.data('target');
var items = $('select.list[data-target="' + target + '"]').val();
if (items && items.length) {
$this.children('i.glyphicon-refresh-animate').show();
$.post($this.attr('href'), {items: items}, function (r) {
updateItems(r);
}).always(function () {
$this.children('i.glyphicon-refresh-animate').hide();
});
}
return false;
});
$('.search[data-target]').keyup(function () {
search($(this).data('target'));
});
function search(target) {
var $list = $('select.list[data-target="' + target + '"]');
$list.html('');
var q = $('.search[data-target="' + target + '"]').val();
var groups = {
role: [$('<optgroup label="Roles">'), false],
permission: [$('<optgroup label="Permission">'), false],
route: [$('<optgroup label="Routes">'), false],
};
$.each(_opts.items[target], function (name, group) {
if (name.indexOf(q) >= 0) {
$('<option>').text(name).val(name).appendTo(groups[group][0]);
groups[group][1] = true;
}
});
$.each(groups, function () {
if (this[1]) {
$list.append(this[0]);
}
});
}
// initial
search('available');
search('assigned');