Просмотр исходного кода

filter staff and clients requires both rather than or

master
patrick 6 лет назад
Родитель
Сommit
e06087269b
1 измененных файлов: 60 добавлений и 14 удалений
  1. +60
    -14
      js/bts_timesheet.js

+ 60
- 14
js/bts_timesheet.js Просмотреть файл

@@ -630,25 +630,25 @@
this.mark_rate_invalid();
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;
}
// 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.mark_rate_valid();
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;
}
// 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;
@@ -1187,19 +1187,65 @@
return;
}
//if staffs is empty, we only filter by client
if (staffs === undefined || staffs.length ==0){
filter_workspace_by_client(clients);
return;
}
//if clients is empty, we only filter by staff
if (clients===undefined || clients.length ==0){
filter_workspace_by_staff(staffs);
return;
}
//filter by both
filter_workspace_by_both(staffs, clients);

}
function filter_workspace_by_staff(staffs)
{
//filter some of them;
$('div.workspace div.divTable').each(function(i,e){
var job = $(e).data().job;
var s = job.get_staff();
if (staffs.indexOf(s) ==-1)
$(this).fadeOut();
else
$(this).fadeIn();
});
}
function filter_workspace_by_client(clients)
{
//filter some of them;
$('div.workspace div.divTable').each(function(i,e){
var job = $(e).data().job;
var c = job.get_client();
if (staffs.indexOf(s) ==-1 && clients.indexOf(c) ==-1)
if (clients.indexOf(c) ==-1)
$(this).fadeOut();
else
$(this).fadeIn();
});
}
function filter_workspace_by_both(staffs, clients)
{
//filter some of them;
$('div.workspace div.divTable').each(function(i,e){
var job = $(e).data().job;
var s = job.get_staff();
var c = job.get_client();
if (staffs.indexOf(s) ==-1 || clients.indexOf(c) ==-1)
$(this).fadeOut();
else
$(this).fadeIn();
});
}
function filter_workspace_by_weeks(){
var hide_week1 = $('div.week1').hasClass('filtered');
var hide_week2 = $('div.week2').hasClass('filtered');

Загрузка…
Отмена
Сохранить