diff --git a/js/bts_timesheet.js b/js/bts_timesheet.js index f3b5d5d..0064fd7 100644 --- a/js/bts_timesheet.js +++ b/js/bts_timesheet.js @@ -262,7 +262,9 @@ this.el.find("div.brating span").click(function(){ var r = $(this).attr('data-rating'); self.data.rating = r; + self.mark_dirty(); self.set_rating(r); + }) this.el.find("div.brating").mouseenter(function(){ @@ -399,6 +401,7 @@ record.staff = this.get_staff(); record.client = this.get_client(); record.ack = this.get_ack(); + record.rating = this.get_rating(); return record; } @@ -409,10 +412,35 @@ action: "save_job", // action record: this.get_record_from_ui(), }, function(response, status, xhr){ - console.log("response for save %o", response); - self.load_data(response.newdata); + if (response.status=='success'){ + self.load_data(response.newdata); + self.mark_saved(); + }else{ + alert( 'error saving data, please check your network'); + } }); } + + mark_dirty() //need save + { + var d = this.el.find('.bsave'); + d.removeClass('saved'); + d.addClass('blink_me'); + setTimeout(function(){ + d.removeClass('blink_me'); + },1000); + } + + mark_saved() + { + var d = this.el.find('.bsave'); + + d.addClass('blink_me'); + setTimeout(function(){ + d.removeClass('blink_me'); + d.addClass('saved'); + },1000); + } }//end of class Job //global GUI summary @@ -684,6 +712,12 @@ } + + $(document).on('change', '.divTableRow select, .divTableRow input', function() { + var job = $(this).closest('.divTable').data().job; + job.mark_dirty(); + }); + reset_title_to_today(); /*________________________________________________________________________*/ }); diff --git a/ts.php b/ts.php index da4a4a4..053b339 100644 --- a/ts.php +++ b/ts.php @@ -328,6 +328,7 @@ class AcareOffice{ 'staff' => $r['staff'], 'client' => $r['client'], 'ack' => $r['ack']=='true'?1:0, + 'rating'=>$r['rating'], ); //this is an update