|
@@ -227,66 +227,6 @@
|
|
|
</div>
|
|
|
<div class="card-body p-0">
|
|
|
<div>
|
|
|
- <?php
|
|
|
- function _renderNoteTemplate($template, $topLevel) {
|
|
|
- echo
|
|
|
- '<div class="note-template-item" ' .
|
|
|
- 'template="' . (isset($template->template) ? $template->template : $template->text) . '" ' .
|
|
|
- 'type="' . (isset($template->type) ? $template->type : "value") . '" ' .
|
|
|
- '>' .
|
|
|
- '<div class="note-template-text d-flex align-items-center">' .
|
|
|
- '<span class="label">' .
|
|
|
- '<input type="checkbox" />' .
|
|
|
- '<span>' . $template->text . '</span>' .
|
|
|
- '</span>';
|
|
|
- if(isset($template->type) && $template->type === 'plus-minus') {
|
|
|
- echo '<div class="ml-auto mr-2 text-nowrap">';
|
|
|
- echo '<a href="#" class="plus-trigger"><i class="fa fa-plus-circle"></i></a>';
|
|
|
- echo '<a href="#" class="minus-trigger ml-1"><i class="fa fa-minus-circle"></i></a>';
|
|
|
- echo '</div>';
|
|
|
- }
|
|
|
- echo '</div>';
|
|
|
- if(isset($template->children) && count($template->children)) {
|
|
|
- echo '<i class="fa fa-chevron-right has-children"></i>';
|
|
|
- echo '<div class="note-template-children">';
|
|
|
- foreach ($template->children as $t) {
|
|
|
- _renderNoteTemplate($t, false);
|
|
|
- }
|
|
|
- echo '</div>';
|
|
|
- }
|
|
|
- else if(isset($template->type) && $template->type !== 'plus-minus') {
|
|
|
- echo '<i class="fa fa-chevron-right has-children"></i>';
|
|
|
- echo '<div class="note-template-children">';
|
|
|
- if($template->type === 'alpha') {
|
|
|
- echo '<textarea class="form-control form-control-sm"></textarea>';
|
|
|
- }
|
|
|
- else {
|
|
|
- echo '<input type="' . $template->type . '" class="form-control form-control-sm">';
|
|
|
- }
|
|
|
- echo '</div>';
|
|
|
- }
|
|
|
- echo '</div>';
|
|
|
- }
|
|
|
-
|
|
|
- function renderNoteTemplates($path) {
|
|
|
- $templates = json_decode(file_get_contents($path));
|
|
|
- echo '<div class="note-template-container">';
|
|
|
- echo '<div class="position-relative w-100">' .
|
|
|
- '<div class="note-template-output">' .
|
|
|
- '<div class="font-weight-bold text-secondary">Result:</div>' .
|
|
|
- '<div class="note-template-output-text"></div>' .
|
|
|
- '</div>' .
|
|
|
- '<div class="note-template-buttons d-flex align-items-center">' .
|
|
|
- '<button class="btn btn-sm btn-default bg-white border text-primary border-primary note-template-apply-trigger">Apply</button>' .
|
|
|
- '<button class="btn btn-sm btn-default bg-light border text-secondary border-secondary note-template-close-trigger">Close</button>' .
|
|
|
- '</div>' .
|
|
|
- '</div>';
|
|
|
- foreach ($templates->templates as $template) {
|
|
|
- _renderNoteTemplate($template, true);
|
|
|
- }
|
|
|
- echo '</div>';
|
|
|
- }
|
|
|
- ?>
|
|
|
<div class="mb-3">
|
|
|
<div>
|
|
|
<?php
|
|
@@ -298,13 +238,6 @@
|
|
|
$packed = implode("^^^", $packed);
|
|
|
$shortcuts = $packed;
|
|
|
?>
|
|
|
- {{--<div class="primary-form">
|
|
|
- <div class="note-content {{ $note->is_cancelled ? 'cancelled' : '' }} {{ $note->is_signed_by_hcp ? 'readonly' : '' }}"
|
|
|
- data-note-uid="{{ $note->uid }}"
|
|
|
- {{ !$note->is_cancelled && empty($note->free_text_html) ? 'auto-edit' : '' }}
|
|
|
- data-shortcuts="{{ $packed }}"
|
|
|
- >{!! $note->free_text_html !!}</div>
|
|
|
- </div>--}}
|
|
|
@foreach($note->sections as $section)
|
|
|
<div class="p-3 border-bottom note-section">
|
|
|
<div class="d-flex align-items-start">
|
|
@@ -312,14 +245,8 @@
|
|
|
{{$section->sectionTemplate->title}}
|
|
|
<span class="d-none if-not-edit"><i class="fa fa-edit ml-2"></i></span>
|
|
|
</a>
|
|
|
- <?php
|
|
|
- if(file_exists(storage_path('sections/'.$section->sectionTemplate->internal_name.'/templates.json'))) {
|
|
|
- echo '<span class="position-relative d-none if-edit ml-3 pl-3 border-left">' .
|
|
|
- '<a href="#" class="note-templates-trigger">Templates</a>';
|
|
|
- renderNoteTemplates(storage_path('sections/'.$section->sectionTemplate->internal_name.'/templates.json'));
|
|
|
- echo '</span>';
|
|
|
- }
|
|
|
- ?>
|
|
|
+ <?php $sectionInternalName = $section->sectionTemplate->internal_name; ?>
|
|
|
+ @include('app/patient/note/_templates-index')
|
|
|
</div>
|
|
|
<div class="d-none if-not-edit inset-comment">{!! !empty($section->summary_html) ? $section->summary_html : '-' !!}</div>
|
|
|
<div class="d-none if-edit">@include('sections/'.$section->sectionTemplate->internal_name.'/form')</div>
|
|
@@ -534,16 +461,16 @@
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
- $('.note-templates-underlay, .note-template-close-trigger')
|
|
|
- .off('click.note-templates-underlay')
|
|
|
- .on('click.note-templates-underlay', function() {
|
|
|
+ $(document)
|
|
|
+ .off('click.note-templates-underlay', '.note-templates-underlay, .note-template-close-trigger')
|
|
|
+ .on('click.note-templates-underlay', '.note-templates-underlay, .note-template-close-trigger', function() {
|
|
|
$('.note-templates-underlay').hide();
|
|
|
$('.note-template-container').hide();
|
|
|
});
|
|
|
|
|
|
- $('.note-template-item .label')
|
|
|
- .off('click.note-template-label')
|
|
|
- .on('click.note-template-label', function() {
|
|
|
+ $(document)
|
|
|
+ .off('click.note-template-label', '.note-template-item .label')
|
|
|
+ .on('click.note-template-label', '.note-template-item .label', function() {
|
|
|
let item = $(this).closest('.note-template-item');
|
|
|
let isChecked = $(this).find('>input[type="checkbox"]').prop('checked');
|
|
|
let hasChildren = !!item.find('>.note-template-children').length,
|
|
@@ -579,27 +506,27 @@
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
- $('.note-template-apply-trigger')
|
|
|
- .off('mousedown.note-templates-apply')
|
|
|
- .on('mousedown.note-templates-apply', function() {
|
|
|
+ $(document)
|
|
|
+ .off('mousedown.note-templates-apply', '.note-template-apply-trigger')
|
|
|
+ .on('mousedown.note-templates-apply', '.note-template-apply-trigger', function() {
|
|
|
let result = $('.note-template-output-text:visible').first().html();
|
|
|
$('.note-templates-underlay').hide();
|
|
|
$('.note-template-container').hide();
|
|
|
- let editor = $('.ql-editor[contenteditable]').first();
|
|
|
+ let editor = $('.ql-editor[contenteditable]:visible').first();
|
|
|
result = $.trim(editor.text() !== '' ? editor.html() : '') + result;
|
|
|
editor.html(result).focus();
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
- $('.note-template-item textarea, .note-template-item input[type="number"], .note-template-item input[type="date"]')
|
|
|
- .off('input paste change')
|
|
|
- .on('input paste change', function() {
|
|
|
+ $(document)
|
|
|
+ .off('input paste change', '.note-template-item textarea, .note-template-item input[type="number"], .note-template-item input[type="date"]')
|
|
|
+ .on('input paste change', '.note-template-item textarea, .note-template-item input[type="number"], .note-template-item input[type="date"]', function() {
|
|
|
generateTemplateOutput();
|
|
|
});
|
|
|
|
|
|
- $('.note-template-item .plus-trigger')
|
|
|
- .off('click.plus-trigger')
|
|
|
- .on('click.plus-trigger', function() {
|
|
|
+ $(document)
|
|
|
+ .off('click.plus-trigger', '.note-template-item .plus-trigger')
|
|
|
+ .on('click.plus-trigger', '.note-template-item .plus-trigger', function() {
|
|
|
let item = $(this).closest('.note-template-item');
|
|
|
if(item.attr('prefix') === '(+)') {
|
|
|
item.removeAttr('prefix');
|
|
@@ -615,9 +542,9 @@
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
- $('.note-template-item .minus-trigger')
|
|
|
- .off('click.plus-trigger')
|
|
|
- .on('click.plus-trigger', function() {
|
|
|
+ $(document)
|
|
|
+ .off('click.minus-trigger', '.note-template-item .minus-trigger')
|
|
|
+ .on('click.minus-trigger', '.note-template-item .minus-trigger', function() {
|
|
|
let item = $(this).closest('.note-template-item');
|
|
|
if(item.attr('prefix') === '(-)') {
|
|
|
item.removeAttr('prefix');
|
|
@@ -633,6 +560,17 @@
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
+ $(document)
|
|
|
+ .off('click.note-template-set-chooser', '.note-template-set-chooser')
|
|
|
+ .on('click.note-template-set-chooser', '.note-template-set-chooser', function() {
|
|
|
+ if(!$(this).val()) return false;
|
|
|
+ $.get('/note-template-set/' + $(this).attr('data-section') + '/' + $(this).val(), function(_html) {
|
|
|
+ $('.note-template-container:visible>.note-template-item').remove();
|
|
|
+ $('.note-template-container:visible').append(_html);
|
|
|
+ });
|
|
|
+ return false;
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function generateOutputForNode(_node) {
|