|
@@ -41,10 +41,23 @@
|
|
|
}
|
|
|
|
|
|
window.refreshRHSSidebar = function() {
|
|
|
- $.get('/note-rhs-sidebar/{{$patient->uid}}/{{$note->uid}}', _data => {
|
|
|
- $('#note-rhs-sidebar').replaceWith(_data);
|
|
|
- $(window).trigger('scroll');
|
|
|
- });
|
|
|
+ if($('#note-rhs-sidebar').length) {
|
|
|
+ let lastUpdatedAt = $('#note-rhs-sidebar').attr('last-updated-at');
|
|
|
+ if(lastUpdatedAt) {
|
|
|
+ lastUpdatedAt = +lastUpdatedAt;
|
|
|
+ if(new Date().getTime() - lastUpdatedAt < 500) { // dont refresh if refreshed less than a second ago
|
|
|
+ console.log('Skipping rhs sidebar refresh');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $.get('/note-rhs-sidebar/{{$patient->uid}}/{{$note->uid}}', _data => {
|
|
|
+ $('#note-rhs-sidebar')
|
|
|
+ .empty()
|
|
|
+ .html($(_data).html())
|
|
|
+ .attr('last-updated-at', new Date().getTime());
|
|
|
+ $(window).trigger('scroll');
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
window.updateSegmentByUid = function(_uid, _summaryHtml, _editHtml, _updateOnlySummary) {
|