|
|
|
@@ -314,7 +314,10 @@ |
|
|
|
return; |
|
|
|
var table = $(this).closest('div.divTable'); |
|
|
|
var job = table.data().job; |
|
|
|
clone_data_create_new_job(job.get_record_from_ui()); |
|
|
|
var newj = clone_data_create_new_job(job.get_record_from_ui()); |
|
|
|
$('div.workspace').append(newj.el); |
|
|
|
newj.el.get(0).scrollIntoView();//make sure it's visible; |
|
|
|
newj.mark_highlight_me(1000);//for 1 second; |
|
|
|
dtp_init(); |
|
|
|
}); |
|
|
|
|
|
|
|
@@ -907,6 +910,7 @@ |
|
|
|
if (!confirm ('copy entire week to next week? ')) |
|
|
|
return; |
|
|
|
var jobs = []; |
|
|
|
var job_els =[]; |
|
|
|
$('div.week1 >div').each(function(i,e){ |
|
|
|
var date = new Date($(e).find('span.weekday').data().date); |
|
|
|
var strDate = format_date(date); //yyyy-mm-dd |
|
|
|
@@ -917,16 +921,13 @@ |
|
|
|
var el = $(e).closest('div.divTable'); |
|
|
|
if (el.is(":visible")){ |
|
|
|
var j = el.data().job; |
|
|
|
jobs.push(j); |
|
|
|
var newj = clone_data_create_new_job(j.get_record_from_ui(),7);//add 7 days |
|
|
|
job_els.push(newj.el); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
jobs.forEach(function(e){ |
|
|
|
clone_data_create_new_job(e.get_record_from_ui(),7);//add 7 days |
|
|
|
}); |
|
|
|
dtp_init(); |
|
|
|
show_jobs(job_els); |
|
|
|
debounced_calculate(); |
|
|
|
}); |
|
|
|
|
|
|
|
@@ -942,9 +943,13 @@ |
|
|
|
} |
|
|
|
if (!confirm ('copy to next week')) |
|
|
|
return; |
|
|
|
var jobs_el = []; |
|
|
|
$('div.bstart input.blink_me').each(function(i,e){ |
|
|
|
copy_single_day_to_next_week(e); |
|
|
|
var r = copy_single_day_to_next_week(e); |
|
|
|
if (r != false) |
|
|
|
jobs_el.push(r.el); |
|
|
|
}); |
|
|
|
show_jobs(jobs_el); |
|
|
|
unblink_all_date(); |
|
|
|
}); |
|
|
|
|
|
|
|
@@ -958,9 +963,10 @@ |
|
|
|
var tb = $(el).closest('div.divTable'); |
|
|
|
if (tb.is(':visible')){ |
|
|
|
var j = $(tb).data().job; |
|
|
|
clone_data_create_new_job(j.get_record_from_ui() , 7); // +7 days |
|
|
|
var newj = clone_data_create_new_job(j.get_record_from_ui() , 7); // +7 days |
|
|
|
return newj; |
|
|
|
} |
|
|
|
dtp_init(); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
function clone_data_create_new_job(val, num_of_shifted_days){ |
|
|
|
@@ -984,7 +990,7 @@ |
|
|
|
data.finish = format_date_time(f); |
|
|
|
} |
|
|
|
var newj = new Job(data); |
|
|
|
newj.mark_highlight_me(1000);//for 1 second; |
|
|
|
return newj; |
|
|
|
} |
|
|
|
|
|
|
|
function is_valid_date_str(val){ |
|
|
|
@@ -1043,13 +1049,13 @@ |
|
|
|
if (response.status =='success'){ |
|
|
|
var job_els = []; |
|
|
|
response.jobs.forEach(function(job){ |
|
|
|
console.log('loading job... %o', job); |
|
|
|
//console.log('loading job... %o', job); |
|
|
|
var o = new Job(job); |
|
|
|
job_els.push(o.el); |
|
|
|
}); |
|
|
|
show_jobs(job_els); |
|
|
|
show_jobs(job_els, 'in-ajax=true'); |
|
|
|
//filter it if reqired |
|
|
|
do_filter_workspace(); |
|
|
|
debounced_filter_workspace(); |
|
|
|
}else{ |
|
|
|
alert('error loading job'); |
|
|
|
} |
|
|
|
@@ -1058,11 +1064,14 @@ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function show_jobs(job_els){ |
|
|
|
function show_jobs(job_els, in_ajax){ |
|
|
|
if (job_els.length >0){ |
|
|
|
$('div.workspace').append(job_els); |
|
|
|
job_els[0].get(0).scrollIntoView(); |
|
|
|
console.log('loading ... %d jobs', job_els.length); |
|
|
|
} |
|
|
|
if (typeof in_ajax =='undefined') |
|
|
|
dtp_init(); |
|
|
|
} |
|
|
|
|
|
|
|
function format_date(date){ |
|
|
|
@@ -1106,8 +1115,8 @@ |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$(document).on('click','div.userlist', debounce(do_filter_workspace)); |
|
|
|
var debounced_filter_workspace = debounce(do_filter_workspace, 1000); |
|
|
|
$(document).on('click','div.userlist', debounced_filter_workspace); |
|
|
|
|
|
|
|
function do_filter_workspace(){ |
|
|
|
var staffs =[]; |