Переглянути джерело

disable jobs that passed payroll start date

master
patrick 6 роки тому
джерело
коміт
dea9c6f203
3 змінених файлів з 53 додано та 19 видалено
  1. +8
    -0
      css/bts_office.css
  2. +1
    -1
      html/jobv1.html
  3. +44
    -18
      js/bts_office.js

+ 8
- 0
css/bts_office.css Переглянути файл

@@ -1042,6 +1042,14 @@ div.divTable .invalid {
background-color: yellow;
}


div.blueTable.divTable.jobTable.disabled *{
background-color: lightgrey;
color:black;
}
div.blueTable.divTable.jobTable.disabled span.ticon{
display:none;
}
/* end of div table */
/* pop up message box */
.bts_message .ult_modal-body {

+ 1
- 1
html/jobv1.html Переглянути файл

@@ -1,5 +1,5 @@
{{#jobs}}
<div class="divTable jobTable blueTable {{#saved}} saved {{/saved}} {{^saved}} dirty {{/saved}} {{#is_week1}}week1job{{/is_week1}} {{#is_week2}} week2job {{/is_week2}}"
<div class="divTable jobTable blueTable {{#disabled}} disabled {{/disabled}} {{#saved}} saved {{/saved}} {{^saved}} dirty {{/saved}} {{#is_week1}}week1job{{/is_week1}} {{#is_week2}} week2job {{/is_week2}}"
{{#id}} id="job_{{id}}" {{/id}} {{^id}} id="{{newjob_id}}" {{/id}}
data-id="{{id}}" {{^id}} data-newjob_id="{{newjob_id}}" {{/id}}
data-tos="{{tos}}" data-rate="{{rate}}" data-staff="{{staff}}" data-client="{{client}}"

+ 44
- 18
js/bts_office.js Переглянути файл

@@ -288,9 +288,7 @@
});
$(document).on('click', 'div.workspace div.bedit span.ticon-edit', function(){
var el = $(this).closest('div.jobTable');
el.addClass('Editing');
var el = $(this).closest('div.jobTable');
var newjob_id = el.attr('data-newjob_id');
if (typeof newjob_id != 'undefined' && newjob_id != ''){
do_edit_new_job(newjob_id);
@@ -308,14 +306,10 @@
{
return new Date(bts().pay_calendar.start + " 00:00:00");
}
function allow_editing(job){
if (! job instanceof Job)
return false;

//TODO:
function allow_editing(date){
var begin = new Date(date);
var pay_begin = get_payroll_start();
return date > pay_begin;
return begin > pay_begin;
}
// $(document).on('click', 'div.bts_editor div.ult-overlay-close', function(){
// $('.Editing').addClass('blink_me');
@@ -542,6 +536,7 @@
this.rating_range(this);
this.identify_job_week(this);
this.job_acked(this);
this.job_disabled(this);
}
tos_name(e){
@@ -601,14 +596,18 @@
}
job_acked(e){
if (typeof e == 'undefined'){
console.log('break;');
}
if (e.ack != 0){
e.is_confirmed = true;
}
}
job_disabled(e){
var allow = allow_editing(e.start);
if (!allow)
e.disabled =true;
else
delete e.disabled;

}
is_job_valid(){

var error_found = false;
@@ -673,7 +672,11 @@
}else{
return 1 * rate_info.RatePerUnit;
}
}
}
allow_edit(){
return allow_editing(this.start);
}
};
class JobEditor{ //save data for the record, and display it as GUI
constructor(selector, job){
@@ -1459,7 +1462,7 @@
if( -1 != value.indexOf(strDate) ) //found
{
var el = $(e).closest('div.jobTable');
if (el.is(":visible") && el.hasClass('saved')){
if (el.is(":visible") && el.hasClass('saved') && ! el.hasClass('disabled')){
var id = el.data().id;
var j = bts().job_map[id];
var newj = clone_data_create_new_job(j.get_record(),7);//add 7 days
@@ -1471,6 +1474,7 @@
});
show_jobs(jobs);
debounced_calculate();
alert("Copied " + jobs.length + " jobs");
});

$('div.weekly div.weekname.next > input').click(function(e){
@@ -1510,6 +1514,7 @@
});
show_jobs(new_jobs);
unblink_all_date();
alert("Copied " + new_jobs.length + " jobs");
});
$('div.week1,div.week2').click(function(e){
@@ -1523,6 +1528,8 @@
if (tb.is(':visible') && tb.hasClass('saved')){
var id = tb.data().id;
var j = bts().job_map[id];
if (! j.allow_edit())
return false;
var newj = clone_data_create_new_job(j.get_record() , 7); // +7 days
return newj;
}
@@ -1945,6 +1952,8 @@
$('div.jobTable[data-staff="' + id + '"]:visible').each(function(){
var el = this;
var match = find_driving_partner_job(el);
if (match == false)
return;
var staff = $('#' + match).data().staff;
if (typeof kms[staff] =='undefined'){
@@ -1980,7 +1989,11 @@
}
});
if (matches.length != 1){
$(selector).find('.bstart').addClass("error");
$(selector).find(".bstart_err").html("No matching Job");
ensure_visible(selector);
console.warn("1 driving job has more than 1 matching", $(selector).attr('id'), matches);
return false;
}
$(selector).attr('data-driver', matches[0].driver);
$(selector).attr('data-parent', matches[0].parent);
@@ -2267,11 +2280,24 @@
function do_edit_job(id)
{
open_modal('editor');
set_modal_title('editor', "Editing Job: " + id);

//make a copy of the job
var child = bts().job_map[id];
if (! child.allow_edit()){
var msg =`You should not Edit this job,
it's locked by Xero,
Unless you insist to proceed
Are you sure you want edit it?
`;
if(!confirm(msg))
return;
}
var el = $("#job_" + id);
el.addClass('Editing');
open_modal('editor');
set_modal_title('editor', "Editing Job: " + id);
var job_copy = Object.assign(Object.create(Object.getPrototypeOf(child)), child); //a shallow copy only;
job_copy.editorid = bts_random_number();
//set_modal_data('editor', {jobid: id, job_copy:job_copy});

Завантаження…
Відмінити
Зберегти