Przeglądaj źródła

save rating works

master
patrick 6 lat temu
rodzic
commit
088ee49941
2 zmienionych plików z 37 dodań i 2 usunięć
  1. +36
    -2
      js/bts_timesheet.js
  2. +1
    -0
      ts.php

+ 36
- 2
js/bts_timesheet.js Wyświetl plik

this.el.find("div.brating span").click(function(){ this.el.find("div.brating span").click(function(){
var r = $(this).attr('data-rating'); var r = $(this).attr('data-rating');
self.data.rating = r; self.data.rating = r;
self.mark_dirty();
self.set_rating(r); self.set_rating(r);
}) })
this.el.find("div.brating").mouseenter(function(){ this.el.find("div.brating").mouseenter(function(){
record.staff = this.get_staff(); record.staff = this.get_staff();
record.client = this.get_client(); record.client = this.get_client();
record.ack = this.get_ack(); record.ack = this.get_ack();
record.rating = this.get_rating();
return record; return record;
} }
action: "save_job", // action action: "save_job", // action
record: this.get_record_from_ui(), record: this.get_record_from_ui(),
}, function(response, status, xhr){ }, 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 }//end of class Job
//global GUI summary //global GUI summary
} }


$(document).on('change', '.divTableRow select, .divTableRow input', function() {
var job = $(this).closest('.divTable').data().job;
job.mark_dirty();
});
reset_title_to_today(); reset_title_to_today();
/*________________________________________________________________________*/ /*________________________________________________________________________*/
}); });

+ 1
- 0
ts.php Wyświetl plik

'staff' => $r['staff'], 'staff' => $r['staff'],
'client' => $r['client'], 'client' => $r['client'],
'ack' => $r['ack']=='true'?1:0, 'ack' => $r['ack']=='true'?1:0,
'rating'=>$r['rating'],
); );
//this is an update //this is an update

Ładowanie…
Anuluj
Zapisz