|
|
|
@@ -287,7 +287,7 @@ |
|
|
|
el.addClass('Editing'); |
|
|
|
|
|
|
|
var newjob_id = el.attr('data-newjob_id'); |
|
|
|
if (newjob_id != ''){ |
|
|
|
if (typeof newjob_id != 'undefined' && newjob_id != ''){ |
|
|
|
do_edit_new_job(newjob_id); |
|
|
|
}else{ |
|
|
|
var id = el.attr('data-id'); |
|
|
|
@@ -319,6 +319,8 @@ |
|
|
|
var job = data.job; |
|
|
|
//console.log('close_editor event %o, %o', editor, job); |
|
|
|
|
|
|
|
editor.off_event_handler();//remove all events handler; |
|
|
|
|
|
|
|
var templ = $("#jobv1_item").html(); |
|
|
|
var html = Mustache.render(templ, {jobs:job}); //job id should be available; |
|
|
|
if ( $('div.jobTable.Editing').length == 0){ |
|
|
|
@@ -390,7 +392,7 @@ |
|
|
|
job.is_new = true; |
|
|
|
title = "Create New 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; |
|
|
|
@@ -543,7 +545,6 @@ |
|
|
|
if (typeof bts().earnings_rate[e.rate] != 'undefined') { |
|
|
|
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 )){ |
|
|
|
e.rate_non_hour = true; |
|
|
|
e.rate_err = `Rate unit must be ⟦ Hours ⟧ |
|
|
|
Possible solution: |
|
|
|
1. Change it in Xero |
|
|
|
@@ -737,57 +738,14 @@ |
|
|
|
|
|
|
|
off_event_handler(){ |
|
|
|
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(){ |
|
|
|
@@ -1695,6 +1653,10 @@ |
|
|
|
|
|
|
|
|
|
|
|
function has_txt_hour(str){ |
|
|
|
if (str == null){ |
|
|
|
console.warn('null'); |
|
|
|
return; |
|
|
|
} |
|
|
|
var s = str.toLowerCase(); |
|
|
|
return s.indexOf('hour') != -1; |
|
|
|
} |
|
|
|
@@ -1750,7 +1712,20 @@ |
|
|
|
$('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 |
|
|
|
if( check_workspace_error() ){ |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (!confirm('sending email to each staff for their job arrangement?')) |
|
|
|
return; |
|
|
|
$('div.bts_message .ult-overlay-close-inside').hide(); |
|
|
|
@@ -1879,7 +1854,7 @@ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
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() |
|
|
|
{ |
|
|
|
@@ -1893,9 +1868,7 @@ |
|
|
|
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 job = bts().job_map[id]; |