From 07d4f6422271b1a618c2af8c47068d09b6d29662 Mon Sep 17 00:00:00 2001 From: patrick Date: Sun, 7 Jul 2019 02:34:06 +1000 Subject: [PATCH] all data input is ready --- css/bts_timesheet.css | 12 +++++++++++- html/job.html | 15 +++++++++++++-- js/bts_timesheet.js | 7 ++++++- ts.php | 32 ++++++++++++++++++++++++++++++-- 4 files changed, 60 insertions(+), 6 deletions(-) diff --git a/css/bts_timesheet.css b/css/bts_timesheet.css index 1936a7f..25b6b3b 100644 --- a/css/bts_timesheet.css +++ b/css/bts_timesheet.css @@ -658,9 +658,19 @@ div.bdelete { } div.btos { - width: 30%; + width: 20%; } +div.bhours{ + width: 20%; + max-width: 20px; +} +.divTable div > select{ + width: 100%; + height: 100%; +} + + div.bdelete, div.bconfirmed { text-align:center; diff --git a/html/job.html b/html/job.html index 6f0ebbb..fd2dad5 100644 --- a/html/job.html +++ b/html/job.html @@ -1,10 +1,21 @@
-
[bts_tos_options]
+
+ +
-
hours
+
[bts_hours_options]
[bts_select_staff]
[bts_select_client]
diff --git a/js/bts_timesheet.js b/js/bts_timesheet.js index 3b07657..ff8781c 100644 --- a/js/bts_timesheet.js +++ b/js/bts_timesheet.js @@ -228,9 +228,14 @@ var html = jQuery("#job_item").html(); jQuery('div.workspace').append(html); } - dtp_init(); + reset_date_time_picker(); }); + function reset_date_time_picker(){ + //$('div.xdsoft_datetimepicker.xdsoft_noselect.xdsoft_default').remove(); + dtp_init(); + } + $(document).on('click', 'div.divTableCell.bdelete', function(){ $(this).closest('div.divTable').remove(); }); diff --git a/ts.php b/ts.php index 5f0eb20..2273564 100644 --- a/ts.php +++ b/ts.php @@ -34,7 +34,9 @@ class AcareOffice{ 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_shortcode( 'bts_tos_options', array($this, 'bts_tos_options')); + add_shortcode( 'bts_hours_options', array($this, 'bts_hours_options')); + add_shortcode( 'bts_select_staff', array($this, 'bts_select_staff')); + add_shortcode( 'bts_select_client', array($this, 'bts_select_client')); add_action('wp_ajax_list_staff', array($this,'list_staff' )); add_action('wp_ajax_list_client', array($this,'list_client' )); @@ -138,7 +140,7 @@ class AcareOffice{ return $html; } - public function bts_tos_options($attr){ + public function bts_hours_options($attr){ $result = " \n"; + $staff = $this->get_people_by_role('staff'); + foreach ($staff as $u){ + $result .= sprintf("", $u->user_login, $u->first_name . " " . $u->last_name); + } + $result .=""; + return $result; + } + + public function bts_select_client($attr){ + $result = ""; + return $result; + } //generate template based on html file private function template($id, $file) @@ -201,6 +222,13 @@ class AcareOffice{ wp_die(); } + private function get_people_by_role($role){ + //search all users that are staff + $staffq = new \WP_User_Query(array('role'=>$role)); + $staff = $staffq->get_results(); + return $staff; + } + //ajax get earnings rates function get_payitem_earnings_rate() {