|
@@ -205,9 +205,16 @@
|
|
}
|
|
}
|
|
$packed = implode("^^^", $packed);
|
|
$packed = implode("^^^", $packed);
|
|
$shortcuts = $packed;
|
|
$shortcuts = $packed;
|
|
|
|
+ $latestSectionTS = 0;
|
|
?>
|
|
?>
|
|
@foreach($note->sections as $section)
|
|
@foreach($note->sections as $section)
|
|
- <div class="p-3 border-bottom note-section {{ $section->is_initialized ? '' : 'pending-initialization' }}"
|
|
|
|
|
|
+ <?php
|
|
|
|
+ $sectionTS = strtotime($section->created_at);
|
|
|
|
+ if($latestSectionTS === 0 || $latestSectionTS < $sectionTS) {
|
|
|
|
+ $latestSectionTS = $sectionTS;
|
|
|
|
+ }
|
|
|
|
+ ?>
|
|
|
|
+ <div data-ts={{$sectionTS}} class="p-3 border-bottom note-section {{ $section->is_initialized ? '' : 'pending-initialization' }}"
|
|
data-section-uid="{{ $section->uid }}"
|
|
data-section-uid="{{ $section->uid }}"
|
|
data-section-template-uid="{{ $section->sectionTemplate->uid }}"
|
|
data-section-template-uid="{{ $section->sectionTemplate->uid }}"
|
|
data-section-template-name="{{ $section->sectionTemplate->internal_name }}">
|
|
data-section-template-name="{{ $section->sectionTemplate->internal_name }}">
|
|
@@ -246,6 +253,8 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
+ <span class="d-none latest-section-ts">{{ $latestSectionTS }}</span>
|
|
|
|
+
|
|
@if($note->bills->count())
|
|
@if($note->bills->count())
|
|
<div class="mt-2 px-3">
|
|
<div class="mt-2 px-3">
|
|
<div class="d-flex align-items-center mb-2">
|
|
<div class="d-flex align-items-center mb-2">
|
|
@@ -617,9 +626,27 @@
|
|
);
|
|
);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
+ else {
|
|
|
|
+ scrollToLatest();
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // scroll to latest created section
|
|
|
|
+ function scrollToLatest() {
|
|
|
|
+ window.setTimeout(function() {
|
|
|
|
+ let latestSectionTS = $('.latest-section-ts');
|
|
|
|
+ if(latestSectionTS.length) {
|
|
|
|
+ let latestSection = $('.note-section[data-ts="' + latestSectionTS.text() + '"]');
|
|
|
|
+ if(latestSection.length) {
|
|
|
|
+ latestSection[0].scrollIntoView({behavior: "smooth", block: "center"});
|
|
|
|
+ latestSection.find('.edit-trigger').first().click();
|
|
|
|
+ console.log('DONE!');
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }, 100);
|
|
|
|
+ }
|
|
|
|
+
|
|
function initializeSection(_sectionUid, _sectionTemplateName) {
|
|
function initializeSection(_sectionUid, _sectionTemplateName) {
|
|
$.get('/get-default-section-data/' + _sectionTemplateName + '/{{$patient->uid}}' , function(_data) {
|
|
$.get('/get-default-section-data/' + _sectionTemplateName + '/{{$patient->uid}}' , function(_data) {
|
|
if(!_data) {
|
|
if(!_data) {
|