Browse Source

Add "templates" func into Assessment > detail rte

Vijayakrishnan 4 năm trước cách đây
mục cha
commit
a53ba88786

+ 15 - 0
public/css/style.css

@@ -1159,3 +1159,18 @@ input[data-option-list]:focus+.data-option-list {
 .measurement-item:not(:last-child) {
     border-bottom: 1px solid #e7e7e7;
 }
+.assessment-detail-template>span {
+    margin: 0 !important;
+    padding: 0 !important;
+    border: 0 !important;
+    margin-left: -0.5rem !important;
+    position: static !important;
+}
+.assessment-detail-template>span>a {
+    display: none;
+}
+button.add-shortcut,
+button.note-templates-trigger-assessment {
+    outline: none !important;
+    box-shadow: none !important;
+}

+ 17 - 4
resources/views/app/patient/canvas-sections/dx/form.blade.php

@@ -66,7 +66,7 @@ $formID = rand(0, 100000);
                     <span>All</span>
                 </label>
             </th>
-            <th class="px-2 text-secondary border-bottom-0 w-50">
+            <th class="px-2 text-secondary border-bottom-0 w-35">
                 <div class="d-flex align-items-center font-weight-normal">
                     <span>Title</span>
                     <div class="hide-if-dashboard ml-auto">
@@ -98,7 +98,7 @@ $formID = rand(0, 100000);
             </th>
             {{--<th class="px-2 text-secondary border-bottom-0 min-width-140px">ICD</th>
             <th class="px-2 text-secondary border-bottom-0 w-25">Detail</th>--}}
-            <th class="px-2 text-secondary border-bottom-0 w-50">Plan</th>
+            <th class="px-2 text-secondary border-bottom-0 w-75">Plan</th>
             <th class="px-2 text-secondary border-bottom-0"></th>
         </tr>
         </thead>
@@ -174,6 +174,11 @@ $formID = rand(0, 100000);
     >+ New Entry</button>
     </div>
 
+    <div class="assessment-detail-template">
+        <?php $sectionInternalName = 'plan'; ?>
+        @include('app/patient/note/_templates-index')
+    </div>
+
 </div>
 <script>
     (function() {
@@ -287,8 +292,6 @@ $formID = rand(0, 100000);
 
                             let vueField = $(this).attr('data-field'), vueIndex = +$(this).attr('data-index');
 
-                            $(this).remove();
-
                             var qe = new Quill('[data-editor-id="' + editorID + '"]', {
                                 theme: 'snow',
                                 modules: stagQuillConfig
@@ -302,6 +305,14 @@ $formID = rand(0, 100000);
                                 'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
                             toolbar.append(newSCButton);
 
+                            // add button for templates
+                            var templatesButton = $('<button type="button" tabindex="-1" ' +
+                                'class="position-relative note-templates-trigger-assessment btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ml-1 ' +
+                                'text-sm show-templates">Templates</button>');
+                            templatesButton.attr('data-editor-id', editorID);
+                            toolbar.append(templatesButton);
+                            // $(this).closest('tr').find('.assessment-detail-template').appendTo(templatesButton);
+
                             qe.on('text-change', function() {
                                 // ti.val(qe.root.innerHTML);
                                 self.items[vueIndex][vueField] = qe.root.innerHTML;
@@ -312,6 +323,8 @@ $formID = rand(0, 100000);
                                 .attr('data-editor-id', editorID)
                                 .attr('with-shortcuts', 1);
 
+                            $(this).remove();
+
                         });
                     },
                     initICDAutoSuggest: function() {

+ 35 - 3
resources/views/app/patient/note/dashboard_script.blade.php

@@ -79,6 +79,29 @@
                         return false;
                     });
 
+                $(document)
+                    .off('click.note-templates-trigger-assessment', '.note-templates-trigger-assessment')
+                    .on('click.note-templates-trigger-assessment', '.note-templates-trigger-assessment', function() {
+                        $('.note-templates-underlay').show();
+                        let container = $(this).closest('.note-section').find('.note-template-container');
+                        container.find('.note-template-children').hide();
+                        container.find('.note-template-item.selected').removeClass('selected');
+                        container.find('.note-template-item[prefix]').removeAttr('prefix');
+                        container.find('input[type="checkbox"]').prop('checked', false);
+                        container.find('.note-template-output-text').empty();
+                        container.attr('data-editor-id', $(this).attr('data-editor-id'));
+                        container.show();
+                        container.css({
+                            left: ($(this).position().left - 140) + 'px',
+                            top: ($(this).position().top + 22) + 'px',
+                        });
+                        loadTemplateSet(container.find('.note-template-set-chooser'));
+                        loadExamTemplateSet(container.find('.note-exam-template-set-chooser'),
+                            container.find('.note-exam-exam-chooser').val(),
+                            container.find('.note-exam-template-set-chooser').val());
+                        return false;
+                    });
+
                 $(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() {
@@ -127,12 +150,21 @@
                 $(document)
                     .off('mousedown.note-templates-apply', '.note-template-apply-trigger')
                     .on('mousedown.note-templates-apply', '.note-template-apply-trigger', function() {
+                        let templateContainer = $('.note-template-container:visible').first();
                         let result = $('.note-template-output-text:visible').first().html();
                         $('.note-templates-underlay').hide();
                         $('.note-template-container').hide();
-                        let editor  = $('.ql-editor[contenteditable]:visible').first();
-                        result = $.trim(editor.text() !== '' ? editor.html() : '') + result;
-                        editor.html(result).focus();
+                        let editor = null;
+                        if($(this).closest('.assessment-detail-template').length) {
+                            editor  = $('.ql-editor[data-editor-id="' + templateContainer.attr('data-editor-id') + '"]:visible').first();
+                        }
+                        else {
+                            editor  = $('.ql-editor[contenteditable]:visible').first();
+                        }
+                        if(editor && editor.length) {
+                            result = $.trim(editor.text() !== '' ? editor.html() : '') + result;
+                            editor.html(result).focus();
+                        }
                         return false;
                     });