Преглед изворни кода

checking missing tos and rate

master
patrick пре 6 година
родитељ
комит
057130de40
4 измењених фајлова са 63 додато и 24 уклоњено
  1. +14
    -12
      Xero.php
  2. +4
    -0
      css/bts_timesheet.css
  3. +1
    -1
      html/job.html
  4. +44
    -11
      js/bts_timesheet.js

+ 14
- 12
Xero.php Прегледај датотеку

// "IsReportableAsW1": true, // "IsReportableAsW1": true,
// "UpdatedDateUTC": "2019-03-16T13:18:19+00:00", // "UpdatedDateUTC": "2019-03-16T13:18:19+00:00",
// "CurrentRecord": false // "CurrentRecord": false
$payitem_options[]= array(
'EarningsRateID' => $e->getEarningsRateID(),
'Name'=> $e->getName(),
'EarningsType'=> $e->getEarningstype(),
'RatePerUnit' => $e->getRatePerUnit(),
'RateType' => $e->getRateType(),
'AccountCode' => $e->getAccountCode(),
"Multiplier"=> $e->getMultiplier(),
"IsExemptFromTax" => $e->getIsExemptFromTax(),
"IsExemptFromSuper"=> $e->getIsExemptFromSuper(),
"AccrueLeave" => $e->getAccrueLeave(),
);
if ($e->getCurrentRecord() == "true"){
$payitem_options[]= array(
'EarningsRateID' => $e->getEarningsRateID(),
'Name'=> $e->getName(),
'EarningsType'=> $e->getEarningstype(),
'RatePerUnit' => $e->getRatePerUnit(),
'RateType' => $e->getRateType(),
'AccountCode' => $e->getAccountCode(),
"Multiplier"=> $e->getMultiplier(),
"IsExemptFromTax" => $e->getIsExemptFromTax(),
"IsExemptFromSuper"=> $e->getIsExemptFromSuper(),
"AccrueLeave" => $e->getAccrueLeave(),
);
}
} }
update_option('bts_payitem_earnings_rate', $payitem_options); update_option('bts_payitem_earnings_rate', $payitem_options);
update_option('bts_payitem_last_sync', time()); update_option('bts_payitem_last_sync', time());

+ 4
- 0
css/bts_timesheet.css Прегледај датотеку

border-left: 2px solid red; border-left: 2px solid red;
border-right: 2px solid red; border-right: 2px solid red;
} }

div.divTable .invalid{
background-color:yellow;
}
/* end of div table */ /* end of div table */

+ 1
- 1
html/job.html Прегледај датотеку

<div class="divTableCell bdelete"> <div class="divTableCell bdelete">
<span class="ticon ticon-trash"></span> <span class="ticon ticon-trash"></span>
</div> </div>
<div class="divTableCell bsave saved">
<div class="divTableCell bsave ">
<span class="ticon ticon-save"></span> <span class="ticon ticon-save"></span>
<span class="ticon ticon-copy"></span> <span class="ticon ticon-copy"></span>
</div> </div>

+ 44
- 11
js/bts_timesheet.js Прегледај датотеку

load_data(data) load_data(data)
{ {
//save to html element
this.data = data;
this.el.data({job:this, data:data});

//draw GUI
this.clear_err_msg();
this.set_job_id(data.id); this.set_job_id(data.id);
this.set_tos(data.tos); this.set_tos(data.tos);
this.set_start(data.start); this.set_start(data.start);
this.set_client(data.client); this.set_client(data.client);
this.set_ack(data.ack); this.set_ack(data.ack);
this.set_rating(data.rating); this.set_rating(data.rating);
//save to html element
this.data = data;
this.el.data({job:this, data:data});
//draw GUI by other
this.mark_dirty_on_new_record(data); this.mark_dirty_on_new_record(data);
this.mark_week_color(); this.mark_week_color();
this.validate(); //also triggers mark errors this.validate(); //also triggers mark errors
d.addClass('blink_me'); d.addClass('blink_me');
setTimeout(function(){ setTimeout(function(){
d.removeClass('blink_me'); d.removeClass('blink_me');
d.removeClass('saved');
},1000); },1000);
} }
mark_saved() mark_saved()
{ {
var d = this.el.find('.bsave'); var d = this.el.find('.bsave');
d.addClass('blink_me'); d.addClass('blink_me');
setTimeout(function(){ setTimeout(function(){
d.removeClass('blink_me'); d.removeClass('blink_me');
validate() validate()
{ {
this.clear_err_msg();
var ok = this.validate_start() &&
this.validate_finish() &&
this.validate_rate();
var ok_time = this.validate_start() &&
this.validate_finish(); //finish might not be executed, if start is wrong
var ok_tos = this.validate_tos(); //make sure this validate is executed;
var ok_rate = this.validate_rate() ; //make sure this validate is executed
var ok = ok_time && ok_tos && ok_rate;
if (ok){ if (ok){
this.el.removeClass('invalidjob'); this.el.removeClass('invalidjob');
}else{ }else{
this.mark_rate_invalid(); this.mark_rate_invalid();
return false; return false;
} }
if (this.get_rate() != this.data.rate){
this.set_err_msg_rate('rate@Xero inactive ' + this.data.rate);
this.mark_rate_invalid();
this.mark_dirty();
return false;
}
this.set_err_msg_rate(''); this.set_err_msg_rate('');
this.mark_rate_valid(); this.mark_rate_valid();
return true; return true;
} }
validate_tos(){
if (this.get_tos() != this.data.tos){
this.set_err_msg_tos('require NDIS ' + this.data.tos);
this.mark_tos_invalid();
this.mark_dirty();
console.log('tos mark dirty');
return false;
}
this.set_err_msg_tos('');
this.mark_tos_valid();
return true;
}
clear_err_msg(){ clear_err_msg(){
this.el.find('.divTableRow.errmsg > div').html(''); this.el.find('.divTableRow.errmsg > div').html('');
} }
{ {
this.el.find('div.bsave_err').html(str); this.el.find('div.bsave_err').html(str);
} }
set_err_msg_tos(str)
{
this.el.find('div.btos_err').html(str);
}


mark_tos_valid(){
this.el.find('div.btos select').removeClass('invalid');
}
mark_tos_invalid(){
this.el.find('div.btos select').addClass('invalid');
}
mark_start_valid(){ mark_start_valid(){
this.el.find('div.bstart input').removeClass('invalid'); this.el.find('div.bstart input').removeClass('invalid');
} }
$('div.sheettitle h1').click(function(){ $('div.sheettitle h1').click(function(){
reset_title_to_today(); reset_title_to_today();
load_timesheet();
}); });


function reset_title_to_today(){ function reset_title_to_today(){
} }
}); });
console.log('filter worksspace');
filter_workspace(staffs, clients); filter_workspace(staffs, clients);
console.log('filter by weeks');
filter_workspace_by_weeks(); filter_workspace_by_weeks();
debounced_calculate(); debounced_calculate();
} }

Loading…
Откажи
Сачувај