| 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; | |||||
| } | |||||
| // 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(){ | 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.set_err_msg_tos(''); | ||||
| this.mark_tos_valid(); | this.mark_tos_valid(); | ||||
| return true; | return true; | ||||
| return; | 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; | //filter some of them; | ||||
| $('div.workspace div.divTable').each(function(i,e){ | $('div.workspace div.divTable').each(function(i,e){ | ||||
| var job = $(e).data().job; | var job = $(e).data().job; | ||||
| var s = job.get_staff(); | 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(); | var c = job.get_client(); | ||||
| if (staffs.indexOf(s) ==-1 && clients.indexOf(c) ==-1) | |||||
| if (clients.indexOf(c) ==-1) | |||||
| $(this).fadeOut(); | $(this).fadeOut(); | ||||
| else | else | ||||
| $(this).fadeIn(); | $(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(){ | function filter_workspace_by_weeks(){ | ||||
| var hide_week1 = $('div.week1').hasClass('filtered'); | var hide_week1 = $('div.week1').hasClass('filtered'); | ||||
| var hide_week2 = $('div.week2').hasClass('filtered'); | var hide_week2 = $('div.week2').hasClass('filtered'); |