diff --git a/css/bts_timesheet.css b/css/bts_timesheet.css index b4a826a..5bd8bbb 100644 --- a/css/bts_timesheet.css +++ b/css/bts_timesheet.css @@ -355,6 +355,11 @@ div.weekly div.weekname { border-radius: 10px; text-align: center; background-color: white; + cursor: pointer; +} + +div.weekly div.weekname:hover { + box-shadow:1px 1px 10px black; } div.weekly div.weekname.prev { @@ -441,6 +446,12 @@ div.week2 > div { color: white; margin-top: 5px; font-weight: bolder; + cursor: pointer; +} + +div.week1 > div:hover, +div.week2 > div:Hover { + box-shadow: 1px 1px 10px black; } div.week1 > div { @@ -494,7 +505,10 @@ div.btos { width: 20%; } + div.assignment > div { + display:inline; + height:auto; color: navy; background-color: white; font-size: 20px; @@ -502,6 +516,15 @@ div.assignment > div { border: 1px dotted lightgrey; } +div.assignment > div:hover{ + border: 1px double black; + background-color: white; + color: black; + font-weight: bolder; + box-shadow: 1px 1px 2px black inset; + z-index: 1; +} + /* peple item card*/ .peopleitem div span.checked { color:orange; diff --git a/html/peopleitem.html b/html/client.html similarity index 100% rename from html/peopleitem.html rename to html/client.html diff --git a/html/job.html b/html/job.html new file mode 100644 index 0000000..e585cc1 --- /dev/null +++ b/html/job.html @@ -0,0 +1,14 @@ +
+
Day
+
Date
+
Type of Service
+
Start
+
Finish
+
Hours
+
Staff
+
Client
+
Ack
+
+ +
+
\ No newline at end of file diff --git a/html/staff.html b/html/staff.html new file mode 100644 index 0000000..0fceb48 --- /dev/null +++ b/html/staff.html @@ -0,0 +1,25 @@ + + \ No newline at end of file diff --git a/img/loading_user.gif b/img/loading_user.gif new file mode 100644 index 0000000..3702170 Binary files /dev/null and b/img/loading_user.gif differ diff --git a/js/bts_timesheet.js b/js/bts_timesheet.js index 04743e0..eb39895 100644 --- a/js/bts_timesheet.js +++ b/js/bts_timesheet.js @@ -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 = '
'; r = head + '
' ; return r; } - + + function bts_client_html(data){ + var template = $('#client_item').html(); + var head = '
'; + r = head + '
' ; + 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); + }); + +}); + + diff --git a/ts.php b/ts.php index 595b9c7..ce80e1c 100644 --- a/ts.php +++ b/ts.php @@ -28,8 +28,12 @@ class AcareOffice{ add_filter('show_admin_bar', '__return_false'); + //ts-xx for sync single user add_shortcode( 'ts-sync-users', array($this, 'sync_users')); - add_shortcode( 'bts_people_item', array($this, 'bts_people_item')); + //bts-xx for webpage + add_shortcode( 'bts_staff_item', array($this, 'bts_staff_item')); + add_shortcode( 'bts_client_item', array($this, 'bts_client_item')); + add_shortcode( 'bts_job_item', array($this, 'bts_job_item')); add_action('wp_ajax_list_staff', array($this,'list_staff' )); add_action('wp_ajax_list_client', array($this,'list_client' )); @@ -84,6 +88,7 @@ class AcareOffice{ 'anonymous' => !is_user_logged_in(), 'me'=> get_current_user_id(), 'userid'=> $this->acaresydney_userid, + 'load_user_img'=> plugins_url('img/loading_user.gif', __FILE__), ) ); } @@ -113,10 +118,19 @@ class AcareOffice{ } - public function bts_people_item($attr){ - return $this->template('people_template', 'peopleitem.html'); + public function bts_staff_item($attr){ + return $this->template('staff_item', 'staff.html'); } + public function bts_client_item($attr){ + return $this->template('client_item', 'client.html'); + } + + public function bts_job_item($attr){ + return $this->template('job_item', 'job.html'); + } + + //generate template based on html file private function template($id, $file) {