|
@@ -237,7 +237,9 @@
|
|
$shortcuts = $packed;
|
|
$shortcuts = $packed;
|
|
?>
|
|
?>
|
|
@foreach($note->sections as $section)
|
|
@foreach($note->sections as $section)
|
|
- <div class="p-3 border-bottom note-section">
|
|
|
|
|
|
+ <div class="p-3 border-bottom note-section {{ $section->is_initialized ? '' : 'pending-initialization' }}"
|
|
|
|
+ data-section-uid="{{ $section->uid }}"
|
|
|
|
+ data-section-template-name="{{ $section->sectionTemplate->internal_name }}">
|
|
<div class="d-flex align-items-start">
|
|
<div class="d-flex align-items-start">
|
|
<a class="font-weight-bold mb-2 d-flex align-items-center c-pointer">
|
|
<a class="font-weight-bold mb-2 d-flex align-items-center c-pointer">
|
|
{{$section->sectionTemplate->title}}
|
|
{{$section->sectionTemplate->title}}
|
|
@@ -391,6 +393,9 @@
|
|
<div class="note-templates-underlay"></div>
|
|
<div class="note-templates-underlay"></div>
|
|
<script>
|
|
<script>
|
|
(function() {
|
|
(function() {
|
|
|
|
+
|
|
|
|
+ let numSectionsPendingInitialization = 0;
|
|
|
|
+
|
|
function init() {
|
|
function init() {
|
|
$('textarea[rte]').each(function() {
|
|
$('textarea[rte]').each(function() {
|
|
|
|
|
|
@@ -635,6 +640,33 @@
|
|
return false;
|
|
return false;
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ let sectionsPendingInitialization = $('.note-section.pending-initialization');
|
|
|
|
+ numSectionsPendingInitialization = sectionsPendingInitialization.length;
|
|
|
|
+ if(numSectionsPendingInitialization > 0) {
|
|
|
|
+ showMask('Initializing note. Please wait...');
|
|
|
|
+ sectionsPendingInitialization.each(function() {
|
|
|
|
+ initializeSection(
|
|
|
|
+ $(this).attr('data-section-uid'),
|
|
|
|
+ $(this).attr('data-section-template-name')
|
|
|
|
+ );
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function initializeSection(_sectionUid, _sectionTemplateName) {
|
|
|
|
+ $.get('/get-default-section-data/' + _sectionTemplateName + '/{{$patient->uid}}' , function(_data) {
|
|
|
|
+ $.post('/process_form_submit', {
|
|
|
|
+ section_uid: _sectionUid,
|
|
|
|
+ value: _data.value
|
|
|
|
+ }, function(_data) {
|
|
|
|
+ console.log('done: ', _sectionTemplateName);
|
|
|
|
+ numSectionsPendingInitialization--;
|
|
|
|
+ if(numSectionsPendingInitialization <= 0) {
|
|
|
|
+ fastReload();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }, 'json');
|
|
}
|
|
}
|
|
|
|
|
|
function loadTemplateSet(_chooser) {
|
|
function loadTemplateSet(_chooser) {
|