|
@@ -41,8 +41,9 @@
|
|
}
|
|
}
|
|
|
|
|
|
window.refreshRHSSidebar = function() {
|
|
window.refreshRHSSidebar = function() {
|
|
- if($('#note-rhs-sidebar').length) {
|
|
|
|
- let lastUpdatedAt = $('#note-rhs-sidebar').attr('last-updated-at');
|
|
|
|
|
|
+ let noteRHSSidebar = $('#note-rhs-sidebar');
|
|
|
|
+ if(noteRHSSidebar.length) {
|
|
|
|
+ let lastUpdatedAt = noteRHSSidebar.attr('last-updated-at');
|
|
if(lastUpdatedAt) {
|
|
if(lastUpdatedAt) {
|
|
lastUpdatedAt = +lastUpdatedAt;
|
|
lastUpdatedAt = +lastUpdatedAt;
|
|
if(new Date().getTime() - lastUpdatedAt < 500) { // dont refresh if refreshed less than a second ago
|
|
if(new Date().getTime() - lastUpdatedAt < 500) { // dont refresh if refreshed less than a second ago
|
|
@@ -50,11 +51,11 @@
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ noteRHSSidebar.attr('last-updated-at', new Date().getTime());
|
|
$.get('/note-rhs-sidebar/{{$patient->uid}}/{{$note->uid}}', _data => {
|
|
$.get('/note-rhs-sidebar/{{$patient->uid}}/{{$note->uid}}', _data => {
|
|
- $('#note-rhs-sidebar')
|
|
|
|
|
|
+ noteRHSSidebar
|
|
.empty()
|
|
.empty()
|
|
- .html($(_data).html())
|
|
|
|
- .attr('last-updated-at', new Date().getTime());
|
|
|
|
|
|
+ .html($(_data).html());
|
|
$(window).trigger('scroll');
|
|
$(window).trigger('scroll');
|
|
});
|
|
});
|
|
}
|
|
}
|