|
|
|
@@ -19,10 +19,10 @@ |
|
|
|
}; |
|
|
|
/*____________________________________________________________________________________*/ |
|
|
|
class People{ |
|
|
|
constructor(selector, data){ |
|
|
|
constructor(selector, template, data){ |
|
|
|
this.selector = selector; |
|
|
|
this.data = data; |
|
|
|
this.template = '#people_template'; |
|
|
|
this.template = template; |
|
|
|
// this.sample_people = { |
|
|
|
// login: '01515b52-6936-46b2-a000-9ad4cd7a5b50', |
|
|
|
// firstname: "first", |
|
|
|
@@ -70,13 +70,20 @@ |
|
|
|
|
|
|
|
}//end of class People |
|
|
|
|
|
|
|
function bts_people_html(data){ |
|
|
|
var template = $('#people_template').html(); |
|
|
|
function bts_staff_html(data){ |
|
|
|
var template = $('#staff_item').html(); |
|
|
|
var head = '<div class="peopleitem" id="p'+ data.login +'">'; |
|
|
|
r = head + '</div>' ; |
|
|
|
return r; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function bts_client_html(data){ |
|
|
|
var template = $('#client_item').html(); |
|
|
|
var head = '<div class="peopleitem" id="p'+ data.login +'">'; |
|
|
|
r = head + '</div>' ; |
|
|
|
return r; |
|
|
|
} |
|
|
|
|
|
|
|
function sample_staff(){ |
|
|
|
for (var i=1; i<100; i++){ |
|
|
|
var sample_people = { |
|
|
|
@@ -92,22 +99,24 @@ |
|
|
|
rating: Math.floor(Math.random() * Math.floor(5)), |
|
|
|
unconfirmedjob: Math.floor(Math.random() * Math.floor(30)), |
|
|
|
}; |
|
|
|
var html = bts_people_html(sample_people); |
|
|
|
var html = bts_staff_html(sample_people); |
|
|
|
jQuery('div.stafflist').append(html); |
|
|
|
new People("#p" + sample_people.login, sample_people); |
|
|
|
} |
|
|
|
} |
|
|
|
function list_staff() { |
|
|
|
show_loading_staff(); |
|
|
|
$('div.stafflist div.peopleitem').remove(); |
|
|
|
$.post(bts().ajax_url, { // POST request |
|
|
|
_ajax_nonce: bts().nonce, // nonce |
|
|
|
action: "list_staff", // action |
|
|
|
}, function(response, status, xhr){ |
|
|
|
if (response.status =='success'){ |
|
|
|
hide_loading_staff(); |
|
|
|
response.users.forEach(function(u){ |
|
|
|
var html = bts_people_html(u); |
|
|
|
var html = bts_staff_html(u); |
|
|
|
jQuery('div.stafflist').append(html); |
|
|
|
new People("#p" + u.login, u); |
|
|
|
new People("#p" + u.login,'#staff_item', u); |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
alert('error getting staff list'); |
|
|
|
@@ -116,6 +125,7 @@ |
|
|
|
} |
|
|
|
|
|
|
|
function list_clients() { |
|
|
|
show_loading_client(); |
|
|
|
$('div.clientlist div.peopleitem').remove(); //clear it |
|
|
|
$.post(bts().ajax_url, { // POST request |
|
|
|
_ajax_nonce: bts().nonce, // nonce |
|
|
|
@@ -123,9 +133,10 @@ |
|
|
|
}, function(response, status, xhr){ |
|
|
|
if (response.status =='success'){ |
|
|
|
response.users.forEach(function(u){ |
|
|
|
var html = bts_people_html(u); |
|
|
|
hide_loading_client(); |
|
|
|
var html = bts_client_html(u); |
|
|
|
jQuery('div.clientlist').append(html); |
|
|
|
new People("#p" + u.login, u); |
|
|
|
new People("#p" + u.login, '#client_item' ,u); |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
alert('error getting Client list'); |
|
|
|
@@ -133,6 +144,20 @@ |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function show_loading_staff(){ |
|
|
|
jQuery('div.stafflist img').attr('src', bts().load_user_img).show(); |
|
|
|
} |
|
|
|
function show_loading_client(){ |
|
|
|
jQuery('div.clientlist img').attr('src', bts().load_user_img).show(); |
|
|
|
} |
|
|
|
function hide_loading_staff(){ |
|
|
|
jQuery('div.stafflist img').hide();; |
|
|
|
} |
|
|
|
function hide_loading_client(){ |
|
|
|
jQuery('div.clientlist img').hide(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function xero(t){ |
|
|
|
if (t) |
|
|
|
$('div.xero i').show(); |
|
|
|
@@ -186,11 +211,44 @@ |
|
|
|
init_user_search(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init_ts(); |
|
|
|
|
|
|
|
|
|
|
|
for (var i=1; i<100; i++){ |
|
|
|
var html = jQuery("#job_item").html(); |
|
|
|
jQuery('div.workspace').append(html); |
|
|
|
} |
|
|
|
/*________________________________________________________________________*/ |
|
|
|
}); |
|
|
|
})(jQuery); |
|
|
|
|
|
|
|
|
|
|
|
/*______________scrolling______________________________________________*/ |
|
|
|
jQuery(document).ready(function(){ |
|
|
|
var timeoutid =0; |
|
|
|
|
|
|
|
jQuery('button.peoplelist[name="down"]').mousedown(function(){ |
|
|
|
var button = this; |
|
|
|
timeoutid = setInterval(function(){ |
|
|
|
console.log("down scrotop %d ", jQuery(button).parent().find(".userlist").get(0).scrollTop ); |
|
|
|
jQuery(button).parent().find(".userlist").get(0).scrollTop +=240; |
|
|
|
}, 100); |
|
|
|
}).on('mouseup mouseleave', function(){ |
|
|
|
clearTimeout(timeoutid); |
|
|
|
}); |
|
|
|
|
|
|
|
jQuery('button.peoplelist[name="up"]').mousedown(function(){ |
|
|
|
var button = this; |
|
|
|
timeoutid = setInterval(function(){ |
|
|
|
console.log("up scrotop %d ", jQuery(button).parent().find(".userlist").get(0).scrollTop ); |
|
|
|
jQuery(button).parent().find(".userlist").get(0).scrollTop -=240; |
|
|
|
}, 100); |
|
|
|
}).on('mouseup mouseleave', function(){ |
|
|
|
clearTimeout(timeoutid); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|