Przeglądaj źródła

for 2000 job test performance

master
patrick 6 lat temu
rodzic
commit
428ae85bea
4 zmienionych plików z 37 dodań i 61 usunięć
  1. +1
    -1
      Apiv1.php
  2. +1
    -1
      html/jobv1.html
  3. +31
    -58
      js/bts_office.js
  4. +4
    -1
      ts.php

+ 1
- 1
Apiv1.php Wyświetl plik

); );
$sql = "SELECT * FROM $this->job_table WHERE start>='%s' and start <='%s' order by start ASC ,staff ASC"; $sql = "SELECT * FROM $this->job_table WHERE start>='%s' and start <='%s' order by start ASC ,staff ASC";
//$sql = "SELECT * FROM $this->job_table order by start ASC ,staff ASC";
$sql = "SELECT * FROM $this->job_table order by start ASC ,staff ASC";
$query = $wpdb->prepare ($sql, array($start, $finish)); $query = $wpdb->prepare ($sql, array($start, $finish));
$response['sql'] = $query; $response['sql'] = $query;
$jobs = $wpdb->get_results($query); $jobs = $wpdb->get_results($query);

+ 1
- 1
html/jobv1.html Wyświetl plik

</div> </div>
<div class="divTableCell bstart {{#start_err}} error {{/start_err}}">{{start}}</div> <div class="divTableCell bstart {{#start_err}} error {{/start_err}}">{{start}}</div>
<div class="divTableCell bfinish {{#finish_err}} error {{/finish_err}}">{{finish}}</div> <div class="divTableCell bfinish {{#finish_err}} error {{/finish_err}}">{{finish}}</div>
<div class="divTableCell brate {{#rate_err}} error {{/rate_err}}" {{#non_hour}} title="{{rate_err}}" {{/non_hour}} >{{rate_name}}</div>
<div class="divTableCell brate {{#rate_err}} error {{/rate_err}}" {{#rate_err}} title="{{rate_err}}" {{/rate_err}} >{{rate_name}}</div>
<div class="divTableCell bstaff {{#staff_err}} error {{/staff_err}}" title="{{staff_err}}">{{staff_name}}</div> <div class="divTableCell bstaff {{#staff_err}} error {{/staff_err}}" title="{{staff_err}}">{{staff_name}}</div>
<div class="divTableCell bclient {{#client_err}} error {{/client_err}} {{#is_week1}}week1color{{/is_week1}} {{#is_week2}}week2color{{/is_week2}}">{{client_name}}</div> <div class="divTableCell bclient {{#client_err}} error {{/client_err}} {{#is_week1}}week1color{{/is_week1}} {{#is_week2}}week2color{{/is_week2}}">{{client_name}}</div>
<div class="divTableCell bconfirmed"><input name="ack" type=checkbox {{#is_confirmed}}checked{{/is_confirmed}} onclick="return false;"></div> <div class="divTableCell bconfirmed"><input name="ack" type=checkbox {{#is_confirmed}}checked{{/is_confirmed}} onclick="return false;"></div>

+ 31
- 58
js/bts_office.js Wyświetl plik

el.addClass('Editing'); el.addClass('Editing');
var newjob_id = el.attr('data-newjob_id'); var newjob_id = el.attr('data-newjob_id');
if (newjob_id != ''){
if (typeof newjob_id != 'undefined' && newjob_id != ''){
do_edit_new_job(newjob_id); do_edit_new_job(newjob_id);
}else{ }else{
var id = el.attr('data-id'); var id = el.attr('data-id');
var job = data.job; var job = data.job;
//console.log('close_editor event %o, %o', editor, job); //console.log('close_editor event %o, %o', editor, job);
editor.off_event_handler();//remove all events handler;
var templ = $("#jobv1_item").html(); var templ = $("#jobv1_item").html();
var html = Mustache.render(templ, {jobs:job}); //job id should be available; var html = Mustache.render(templ, {jobs:job}); //job id should be available;
if ( $('div.jobTable.Editing').length == 0){ if ( $('div.jobTable.Editing').length == 0){
job.is_new = true; job.is_new = true;
title = "Create New Job "; title = "Create New Job ";
}else if (job instanceof Job){ }else if (job instanceof Job){
tile = "Create new Job by Copy Existing one";
title = "Create new Job by Copy Existing one";
} }
job.editorid = Math.floor(Math.random() * Math.floor(99999)); // a random number; job.editorid = Math.floor(Math.random() * Math.floor(99999)); // a random number;
if (typeof bts().earnings_rate[e.rate] != 'undefined') { if (typeof bts().earnings_rate[e.rate] != 'undefined') {
e.rate_name = bts().earnings_rate[e.rate].RatePerUnit + "-" + bts().earnings_rate[e.rate].Name; e.rate_name = bts().earnings_rate[e.rate].RatePerUnit + "-" + bts().earnings_rate[e.rate].Name;
if (! has_txt_hour( bts().earnings_rate[e.rate].TypeOfUnits )){ if (! has_txt_hour( bts().earnings_rate[e.rate].TypeOfUnits )){
e.rate_non_hour = true;
e.rate_err = `Rate unit must be ⟦ Hours ⟧ e.rate_err = `Rate unit must be ⟦ Hours ⟧
Possible solution: Possible solution:
1. Change it in Xero 1. Change it in Xero
off_event_handler(){ off_event_handler(){
this.el.off('change',"div.btos select"); this.el.off('change',"div.btos select");
//TODO
this.el.find("div.bstart input").change(function(){
if (self.validate_start()){
self.data.start = self.get_start();
self.set_err_msg_start('');
self.validate_start_and_finish();
}
});
this.el.find("div.bfinish input").change(function(){
if (self.validate_finish()){
self.data.finish = self.get_finish();
self.set_err_msg_finish('');
self.validate_start_and_finish();
}
});
this.el.find("div.bstaff select").change(function(){
if (self.validate_staff()){
self.data.staff = self.get_staff();
self.set_err_msg_staff('');
}
});
this.el.find("div.bclient select").change(function(){
if (self.validate_client()){
self.data.client = self.get_client();
self.set_err_msg_client('');
}
});
this.el.find("div.brate select").change(function(){
if (self.validate_rate()){
self.data.rate = self.get_rate();
self.set_err_msg_rate('');
}
});
this.el.find("div.bconfirmed input").change(function(){
if(self.validate_ack()){
self.data.ack = self.get_ack();
}
});
this.el.find("div.brating select").change(function(){
if( self.validate_rating()){
self.data.rating =self.get_rating();
}
});
this.el.find("div.bsave span.ticon-save").click(function(e){
if ( self.validate() ){
self.do_save_record();
}else{
self.set_err_msg_save('Data Error');
}
});
this.el.off('change',"div.bstart input");
this.el.off('change',"div.bfinish input");
this.el.off('change',"div.bstaff select");
this.el.off('change',"div.bclient select");
this.el.off('change',"div.brate select");
this.el.off('change',"div.bconfirmed input");
this.el.off('change',"div.brating select");
this.el.off('change',"div.bsave span.ticon-save");
} }


get_job_id(){ get_job_id(){


function has_txt_hour(str){ function has_txt_hour(str){
if (str == null){
console.warn('null');
return;
}
var s = str.toLowerCase(); var s = str.toLowerCase();
return s.indexOf('hour') != -1; return s.indexOf('hour') != -1;
} }
$('div.bts_message_button').trigger('click'); $('div.bts_message_button').trigger('click');
}); });
function check_workspace_error(){
var els = $('div.workspace').find('.error');
if(els.length >0){
els.get(0).scrollIntoView();
return true;
}
return false;
}
$('button[name="confirmschedule"]').click(function(){//TODO: check error before confirm $('button[name="confirmschedule"]').click(function(){//TODO: check error before confirm
if( check_workspace_error() ){
return;
}
if (!confirm('sending email to each staff for their job arrangement?')) if (!confirm('sending email to each staff for their job arrangement?'))
return; return;
$('div.bts_message .ult-overlay-close-inside').hide(); $('div.bts_message .ult-overlay-close-inside').hide();


} }
var debounced_calculate = debounce(calculate_total_hour_and_money, 500);
var debounced_calculate = debounce(calculate_total_hour_and_money, 2000);
function calculate_total_hour_and_money() function calculate_total_hour_and_money()
{ {
people.reset_summary(); people.reset_summary();
}); });
$('div.workspace > .divTable.jobTable').each(function(i,e){
if (! $(e).is(':visible'))
return;
$('div.workspace > .divTable.jobTable:visible').each(function(i,e){
var id = $(e).attr('data-id'); var id = $(e).attr('data-id');
var job = bts().job_map[id]; var job = bts().job_map[id];

+ 4
- 1
ts.php Wyświetl plik

foreach($options as $o){ foreach($options as $o){
if ($o['CurrentRecord'] !='true') if ($o['CurrentRecord'] !='true')
continue; continue;
if ($o['RateType'] != 'RATEPERUNIT')
continue;
if (stripos($o['TypeOfUnits'],'hour') != false) //unit contains hour Hour
continue;
$result.=sprintf("<option value='%s'> $%3.2f-%s</option>", $result.=sprintf("<option value='%s'> $%3.2f-%s</option>",
$o['EarningsRateID'], $o['RatePerUnit'], $o['Name']); $o['EarningsRateID'], $o['RatePerUnit'], $o['Name']);
} }

Ładowanie…
Anuluj
Zapisz