Przeglądaj źródła

all data input is ready

master
patrick 6 lat temu
rodzic
commit
07d4f64222
4 zmienionych plików z 60 dodań i 6 usunięć
  1. +11
    -1
      css/bts_timesheet.css
  2. +13
    -2
      html/job.html
  3. +6
    -1
      js/bts_timesheet.js
  4. +30
    -2
      ts.php

+ 11
- 1
css/bts_timesheet.css Wyświetl plik

} }


div.btos { div.btos {
width: 30%;
width: 20%;
} }


div.bhours{
width: 20%;
max-width: 20px;
}
.divTable div > select{
width: 100%;
height: 100%;
}


div.bdelete, div.bdelete,
div.bconfirmed { div.bconfirmed {
text-align:center; text-align:center;

+ 13
- 2
html/job.html Wyświetl plik

<div class="divTable blueTable"> <div class="divTable blueTable">
<div class="divTableBody"> <div class="divTableBody">
<div class="divTableRow"> <div class="divTableRow">
<div class="divTableCell btos">[bts_tos_options]</div>
<div class="divTableCell btos">
<select>
<option value="personalcare">Personal Care (stanard)</option>
<option value="personalcare_h">Personal Care(Complex)</option>
<option value="lunch">Lunch (stanard)</option>
<option value="lunch_h">Lunch(Complex)</option>
<option value="community">Community(stanard)</option>
<option value="community_h">Community(Complex)</option>
<option value="turn">Turn(stanard)</option>
<option value="turn_h">Turn(Complex)</option>
</select>
</div>
<div class="divTableCell bstart"><input class="datepicker" placeholder="2019:03-02-11:30am"></input></div> <div class="divTableCell bstart"><input class="datepicker" placeholder="2019:03-02-11:30am"></input></div>
<div class="divTableCell bfinish"><input class="datepicker" placeholder="2019:03-02-11:30am"></input></div> <div class="divTableCell bfinish"><input class="datepicker" placeholder="2019:03-02-11:30am"></input></div>
<div class="divTableCell bhours">hours</div>
<div class="divTableCell bhours">[bts_hours_options]</div>
<div class="divTableCell bstaff">[bts_select_staff]</div> <div class="divTableCell bstaff">[bts_select_staff]</div>
<div class="divTableCell bclient">[bts_select_client]</div> <div class="divTableCell bclient">[bts_select_client]</div>
<div class="divTableCell bconfirmed"><input type=checkbox checked></div> <div class="divTableCell bconfirmed"><input type=checkbox checked></div>

+ 6
- 1
js/bts_timesheet.js Wyświetl plik

var html = jQuery("#job_item").html(); var html = jQuery("#job_item").html();
jQuery('div.workspace').append(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(){ $(document).on('click', 'div.divTableCell.bdelete', function(){
$(this).closest('div.divTable').remove(); $(this).closest('div.divTable').remove();
}); });

+ 30
- 2
ts.php Wyświetl plik

add_shortcode( 'bts_staff_item', array($this, 'bts_staff_item')); add_shortcode( 'bts_staff_item', array($this, 'bts_staff_item'));
add_shortcode( 'bts_client_item', array($this, 'bts_client_item')); add_shortcode( 'bts_client_item', array($this, 'bts_client_item'));
add_shortcode( 'bts_job_item', array($this, 'bts_job_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_staff', array($this,'list_staff' ));
add_action('wp_ajax_list_client', array($this,'list_client' )); add_action('wp_ajax_list_client', array($this,'list_client' ));
return $html; return $html;
} }
public function bts_tos_options($attr){
public function bts_hours_options($attr){
$result = "<select> \n"; $result = "<select> \n";
$options = get_option('bts_payitem_earnings_rate'); $options = get_option('bts_payitem_earnings_rate');
foreach($options as $o){ foreach($options as $o){
return $result; return $result;
} }
public function bts_select_staff($attr){
$result = "<select> \n";
$staff = $this->get_people_by_role('staff');
foreach ($staff as $u){
$result .= sprintf("<option value=%s> %s</option>", $u->user_login, $u->first_name . " " . $u->last_name);
}
$result .="</select>";
return $result;
}

public function bts_select_client($attr){
$result = "<select> \n";
$staff = $this->get_people_by_role('client');
foreach ($staff as $u){
$result .= sprintf("<option value=%s> %s</option>", $u->user_login, $u->first_name . " " . $u->last_name);
}
$result .="</select>";
return $result;
}
//generate template based on html file //generate template based on html file
private function template($id, $file) private function template($id, $file)
wp_die(); 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 //ajax get earnings rates
function get_payitem_earnings_rate() function get_payitem_earnings_rate()
{ {

Ładowanie…
Anuluj
Zapisz