| @@ -148,11 +148,34 @@ | |||
| } | |||
| function init_user_search(){ | |||
| $('div.b_search input').keyup(debounce(function(){ | |||
| console.log('key pressed'); | |||
| $('div.b_search input').keyup(debounce(function(e){ | |||
| filter_user(e.target); | |||
| }, 500)); | |||
| } | |||
| function filter_user(input){ | |||
| var value = $(input).attr('value'); | |||
| var selector = get_selector_for_filter_people(input); | |||
| $.each( $(selector).find('div.peopleitem'), function(index, e){ | |||
| var html = $(e).find('div[name="title"] a').html(); | |||
| if (-1 != html.indexOf(value)){//we find it; | |||
| $(e).show(); | |||
| }else{ | |||
| $(e).hide(); | |||
| } | |||
| }); | |||
| } | |||
| function get_selector_for_filter_people(input){ | |||
| var selector=''; | |||
| var role = $(input).attr('placeholder'); | |||
| if (role == 'staff') //we filter staff | |||
| selector = 'div.stafflist'; | |||
| else if (role = 'client') | |||
| selector = 'div.clientlist'; | |||
| return selector; | |||
| } | |||
| function init_ts(){ | |||
| list_staff(); | |||
| list_clients(); | |||