Ver código fonte

fixed forms up to exam

Josh 4 anos atrás
pai
commit
3be52a2c09
27 arquivos alterados com 217 adições e 213 exclusões
  1. 1 1
      public/js/mc.js
  2. 189 166
      resources/views/app/patient/note/note-section-list.blade.php
  3. 1 1
      resources/views/app/video/call.blade.php
  4. 1 1
      resources/views/layouts/template.blade.php
  5. 0 0
      storage/sections/articulation_deleted/form.blade.php
  6. 0 0
      storage/sections/articulation_deleted/processor.php
  7. 0 0
      storage/sections/articulation_deleted/summary.php
  8. 0 0
      storage/sections/care-team/form_deleted.blade.php
  9. 0 0
      storage/sections/care-team/processor_deleted.php
  10. 0 0
      storage/sections/care-team/summary_deleted.php
  11. 0 0
      storage/sections/dsm-5_deleted/form.blade.php
  12. 0 0
      storage/sections/dsm-5_deleted/processor.php
  13. 0 0
      storage/sections/dsm-5_deleted/summary.php
  14. 0 40
      storage/sections/exam/form.blade.php
  15. 0 4
      storage/sections/exam/processor.php
  16. 23 0
      storage/sections/exam_deleted/form.blade.php
  17. 2 0
      storage/sections/exam_deleted/processor.php
  18. 0 0
      storage/sections/exam_deleted/summary.php
  19. 0 0
      storage/sections/objective_deleted/form.blade.php
  20. 0 0
      storage/sections/objective_deleted/processor.php
  21. 0 0
      storage/sections/objective_deleted/summary.php
  22. 0 0
      storage/sections/plan_deleted/form.blade.php
  23. 0 0
      storage/sections/plan_deleted/processor.php
  24. 0 0
      storage/sections/plan_deleted/summary.php
  25. 0 0
      storage/sections/subjective_deleted/form.blade.php
  26. 0 0
      storage/sections/subjective_deleted/processor.php
  27. 0 0
      storage/sections/subjective_deleted/summary.php

+ 1 - 1
public/js/mc.js

@@ -349,6 +349,6 @@ function initPatientPresenceIndicator() {
                     }
                 }, 'json');
             }
-        }, 2500);
+        }, 2500000);
     }
 }

+ 189 - 166
resources/views/app/patient/note/note-section-list.blade.php

@@ -1,198 +1,221 @@
 <?php $canvasData = json_decode($patient->canvas_data, true); ?>
 @foreach($note->sections as $section)
-    <?php
-    $sectionTS = strtotime($section->created_at);
-    if($latestSectionTS === 0 || $latestSectionTS < $sectionTS){
-        $latestSectionTS = $sectionTS;
-    }
-    ?>
-    <div data-ts="{{$sectionTS}}"
-            class="p-3 border-bottom note-section {{ $note->is_signed_by_hcp ? 'signed-note' : '' }} {{ $section->is_initialized ? '' : 'pending-initialization' }}"
-            {!! $note->is_signed_by_hcp ? 'title="Signed note. Cannot be edited further."' : '' !!}
-            data-section-uid="{{ $section->uid }}"
-            data-section-template-uid="{{ $section->sectionTemplate->uid }}"
-            data-section-template-name="{{ $section->sectionTemplate->internal_name }}">
-        <div class="d-flex align-items-start">
-            @if(!$note->is_signed_by_hcp)
-                <a class="font-weight-bold mb-2 d-flex align-items-center c-pointer">
-                    {{$section->sectionTemplate->title}}
-                    <span class="d-none if-not-edit"><i class="fa fa-edit ml-2"></i></span>
-                    <span class="d-none if-edit edit-trigger"><i class="fa fa-times ml-2"></i></span>
-                    <span class="edit-trigger"></span>
-                </a>
-            @else
-                <span class="font-weight-bold mb-2 d-flex align-items-center">
-                    {{$section->sectionTemplate->title}}
-                </span>
-            @endif
-            <?php $sectionInternalName = $section->sectionTemplate->internal_name; ?>
-
-            <?php
-            if(file_exists(storage_path('sections/' . $sectionInternalName . '/actions.php'))) {
-                include(storage_path('sections/' . $sectionInternalName . '/actions.php'));
-            }
-            ?>
-            <?php
-            if(file_exists(storage_path('sections/' . $sectionInternalName . '/actions.blade.php'))) {
-                ?> @include('sections/' . $sectionInternalName . '/actions') <?php
-            }
-            ?>
-
-            <a href="#" class="d-none text-danger if-edit ml-auto remove-section-trigger mr-1"
-                data-uid="{{$section->uid}}"
-                title="Remove {{$section->sectionTemplate->title}}">
-                Remove {{$section->sectionTemplate->title}}
-            </a>
-
-            <a href="#" class="d-none if-edit ml-2 move-up-trigger" data-uid="{{$section->uid}}" title="Move Up">
-                <i class="fa fa-arrow-up"></i>
-            </a>
+<?php
+$sectionTS = strtotime($section->created_at);
+if ($latestSectionTS === 0 || $latestSectionTS < $sectionTS) {
+    $latestSectionTS = $sectionTS;
+}
+?>
+<div data-ts="{{$sectionTS}}" class="p-3 border-bottom note-section {{ $note->is_signed_by_hcp ? 'signed-note' : '' }} {{ $section->is_initialized ? '' : 'pending-initialization' }}" {!! $note->is_signed_by_hcp ? 'title="Signed note. Cannot be edited further."' : '' !!}
+    data-section-uid="{{ $section->uid }}"
+    data-section-template-uid="{{ $section->sectionTemplate->uid }}"
+    data-section-template-name="{{ $section->sectionTemplate->internal_name }}">
+    <div class="d-flex align-items-start">
+        @if(!$note->is_signed_by_hcp)
+        <a class="font-weight-bold mb-2 d-flex align-items-center c-pointer">
+            {{$section->sectionTemplate->title}}
+            <span class="d-none if-not-edit"><i class="fa fa-edit ml-2"></i></span>
+            <span class="d-none if-edit edit-trigger"><i class="fa fa-times ml-2"></i></span>
+            <span class="edit-trigger"></span>
+        </a>
+        @else
+        <span class="font-weight-bold mb-2 d-flex align-items-center">
+            {{$section->sectionTemplate->title}}
+        </span>
+        @endif
+        <?php $sectionInternalName = $section->sectionTemplate->internal_name; ?>
+
+        @if($sectionInternalName === "exam" || $sectionInternalName === "objective")
+        @include('app/patient/note/_templates-exam-index')
+        @else
+        @include('app/patient/note/_templates-index')
+        @endif
+
+        <?php
+        if (file_exists(storage_path('sections/' . $sectionInternalName . '/actions.php'))) {
+            include(storage_path('sections/' . $sectionInternalName . '/actions.php'));
+        }
+        ?>
+        <?php
+        if (file_exists(storage_path('sections/' . $sectionInternalName . '/actions.blade.php'))) {
+        ?> @include('sections/' . $sectionInternalName . '/actions') <?php
+                                                                            }
+                                                                                ?>
+
+        <a href="#" class="d-none text-danger if-edit ml-auto remove-section-trigger mr-1" data-uid="{{$section->uid}}" title="Remove {{$section->sectionTemplate->title}}">
+            Remove {{$section->sectionTemplate->title}}
+        </a>
+
+        <a href="#" class="d-none if-edit ml-2 move-up-trigger" data-uid="{{$section->uid}}" title="Move Up">
+            <i class="fa fa-arrow-up"></i>
+        </a>
+
+        <a href="#" class="d-none if-edit ml-2 move-down-trigger" data-uid="{{$section->uid}}" title="Move Down">
+            <i class="fa fa-arrow-down"></i>
+        </a>
 
-            <a href="#" class="d-none if-edit ml-2 move-down-trigger" data-uid="{{$section->uid}}" title="Move Down">
-                <i class="fa fa-arrow-down"></i>
-            </a>
-
-        </div>
-        <div class="d-none if-not-edit  inset-comment summary-container">
-            {!! !empty($section->summary_html) ? $section->summary_html : '-' !!}
-        </div>
+    </div>
+    <div class="d-none if-not-edit  inset-comment summary-container">
+        {!! !empty($section->summary_html) ? $section->summary_html : '-' !!}
+    </div>
 
-        <div class="d-none if-edit">
+    <div class="d-none if-edit">
 
-            <?php
-            // if canvas
-            if($section->sectionTemplate->is_canvas) {
-                $contentData = false;
-                if ($canvasData) {
-                    if (isset($canvasData[$sectionInternalName])) {
-                        $contentData = $canvasData[$sectionInternalName];
-                    }
+        <?php
+        // if canvas
+        if ($section->sectionTemplate->is_canvas) {
+            $contentData = false;
+            if ($canvasData) {
+                if (isset($canvasData[$sectionInternalName])) {
+                    $contentData = $canvasData[$sectionInternalName];
                 }
-            ?>
-                @include("app.patient.canvas-sections.{$sectionInternalName}.form")
-            <?php
             }
-
-            // if form driven
-            else if(file_exists(storage_path('sections/' . $sectionInternalName . '/form.blade.php'))) {
-            ?>
-                @include('sections.' . $sectionInternalName . '.form')
-            <?php
+        ?>
+            @include("app.patient.canvas-sections.{$sectionInternalName}.form")
+        <?php
+        }
+
+        // if form driven
+        else if (file_exists(storage_path('sections/' . $sectionInternalName . '/form.blade.php'))) {
+        ?>
+            @include('sections.' . $sectionInternalName . '.form')
+        <?php
+        }
+
+        // if neither canvas nor form driven
+        else {
+            $contentData = false;
+            if ($section) {
+                $contentData = json_decode($section->content_data, true);
             }
-
-            // if neither canvas nor form driven
-            else {
-                $contentData = false;
-                if($section){
-                    $contentData = json_decode($section->content_data, true);
-                }
-                if(!$contentData || !isset($contentData['value'])) {
-                    $contentData = [
-                        'value'=>''
-                    ];
-                }
-            ?>
-                <input type="hidden" name="data">
-                <div note-rte data-content="{{$contentData['value']}}" class="form-group mb-2 border-left border-right rte-holder"></div>
-            <?php
+            if (!$contentData || !isset($contentData['value'])) {
+                $contentData = [
+                    'value' => ''
+                ];
             }
-            ?>
-
-            <div class="d-flex align-items-center">
-                <button  class="btn btn-sm btn-primary" btn-save-form><i class="fa fa-save"></i></button>
-                <span class="ml-2 text-secondary text-sm text-saving d-none"><i>Saving ...</i></span>
-            </div>
+        ?>
+            <input type="hidden" name="data">
+            <div note-rte data-content="{{$contentData['value']}}" class="form-group mb-2 border-left border-right rte-holder"></div>
+        <?php
+        }
+        ?>
+
+        <div class="d-flex align-items-center">
+            <button class="btn btn-sm btn-primary" btn-save-form><i class="fa fa-save"></i></button>
+            <span class="ml-2 text-secondary text-sm text-saving d-none"><i>Saving ...</i></span>
         </div>
     </div>
-    @endforeach
-    <script>
-        (function(){
-
-            function init() {
-                $('[note-rte]').each(function(){
-                    var el = this;
-                    var existingContent = $(el).attr('data-content');
-                    var quill = new Quill(el, {
-                        theme: 'snow',
-                        modules: {
-                            keyboard: {
-                                bindings: {
-                                    handleEnter: {
-                                        key: 13,
-                                        handler: function() {
-                                            if(!$('.stag-shortcuts:visible').length) return true;
-                                        }
+</div>
+@endforeach
+<script>
+    (function() {
+
+        function init() {
+            $('[note-rte]').each(function() {
+                var el = this;
+                var existingContent = $(el).attr('data-content');
+                var quill = new Quill(el, {
+                    theme: 'snow',
+                    modules: {
+                        keyboard: {
+                            bindings: {
+                                handleEnter: {
+                                    key: 13,
+                                    handler: function() {
+                                        if (!$('.stag-shortcuts:visible').length) return true;
                                     }
                                 }
                             }
                         }
-                    });
+                    }
+                });
 
-                    quill.root.innerHTML = existingContent;
+                quill.root.innerHTML = existingContent;
 
-                    quill.on('text-change', function(delta, oldDelta, source){
-                        var content = quill.root.innerHTML;
-                        var dataValue = JSON.stringify({value: content});
-                        var dataField = $(el).closest('.note-section').find('input[name=data]').val(dataValue);
+                quill.on('text-change', function(delta, oldDelta, source) {
+                    var content = quill.root.innerHTML;
+                    var dataValue = JSON.stringify({
+                        value: content
                     });
-                })
-
-                $('[btn-save-form]').on('click', function(){
-                    doSave($(this).closest('.note-section'));
+                    var dataField = $(el).closest('.note-section').find('input[name=data]').val(dataValue);
                 });
+            })
 
-                // [name="data"] change listener
-                $('.note-section input[name="data"]').each(function() {
-                    initChangeListener($(this));
-                });
+            $('[btn-save-form]').on('click', function() {
+                doSave($(this).closest('.note-section'));
+            });
 
-            }
+            // [name="data"] change listener
+            $('.note-section input[name="data"]').each(function() {
+                initChangeListener($(this));
+            });
 
-            const debounce = (func, wait) => {
-                let timeout;
+        }
 
-                return function executedFunction(...args) {
-                    const later = () => {
-                        clearTimeout(timeout);
-                        func(...args);
-                    };
+        const debounce = (func, wait) => {
+            let timeout;
 
+            return function executedFunction(...args) {
+                const later = () => {
                     clearTimeout(timeout);
-                    timeout = setTimeout(later, wait);
+                    func(...args);
                 };
-            };
-
-            function doSave(_section) {
-                console.log(_section.attr('data-section-template-name'));
 
-                _section.find('[btn-save-form]').prop('disabled', true);
-                _section.find('.text-saving').removeClass('d-none');
-
-                var  dataField = _section.find('input[name=data]')
-                var value = $(dataField).val();
-
-                var summaryContainer = _section.find('.summary-container')
-
-                var sectionUid = _section.attr('data-section-uid')
-                $.post("/process_form_submit", {"section_uid":sectionUid , "data": value}, function(resp) {
-                    console.log(resp);
-                    if(resp.success){
-                        summaryContainer.html(resp.newSummaryHtml);
-                    }
-                    _section.find('[btn-save-form]').prop('disabled', false);
-                    _section.find('.text-saving').addClass('d-none');
-                },'json');
+                clearTimeout(timeout);
+                timeout = setTimeout(later, wait);
+            };
+        };
+
+        function doSave(_section) {
+            console.log(_section.attr('data-section-template-name'));
+
+            _section.find('[btn-save-form]').prop('disabled', true);
+            _section.find('.text-saving').removeClass('d-none');
+
+            var dataField = _section.find('input[name=data]')
+            var value = $(dataField).val();
+
+            var summaryContainer = _section.find('.summary-container')
+
+            var sectionUid = _section.attr('data-section-uid')
+
+            var _form = _section.find('form')[0];
+            console.log("Form found: ", _form);
+            if(_form){
+                console.log("Form found. submitting normally");
+                $.post("/process_form_submit", $(_form).serialize(), function(resp) {
+                    handleSubmitResponse(resp,_section, summaryContainer)
+                }, 'json');
+            }else{
+                console.log("Form not found.");
+                $.post("/process_form_submit", {
+                    "section_uid": sectionUid,
+                    "data": value
+                }, function(resp) {
+                    handleSubmitResponse(resp,_section, summaryContainer)
+                }, 'json');
             }
+        }
 
-            function initChangeListener(_elem) {
-                new MutationObserver(debounce(function() {
-                        doSave(_elem.closest('.note-section'))
-                    }, 250))
-                    .observe(_elem[0], {attributes: true});
+        function handleSubmitResponse(resp,_section, summaryContainer){
+            console.log(resp);
+            if (resp.success) {
+                summaryContainer.html(resp.newSummaryHtml);
             }
+            _section.find('[btn-save-form]').prop('disabled', false);
+            _section.find('.text-saving').addClass('d-none');
+        }
+
+        function initChangeListener(_elem) {
+            new MutationObserver(debounce(function() {
+                    doSave(_elem.closest('.note-section'))
+                }, 250))
+                .observe(_elem[0], {
+                    attributes: true
+                });
+        }
 
-            addMCInitializer('note-sections-list-{{ $patient->uid }}', init);
-
-        })();
+        addMCInitializer('note-sections-list-{{ $patient->uid }}', init);
 
-    </script>
+    })();
+</script>

+ 1 - 1
resources/views/app/video/call.blade.php

@@ -547,7 +547,7 @@
                     this.refresh();
                     window.setInterval(function() {
                         self.refresh();
-                    }, 2500);
+                    }, 2500000);
                 },
                 methods: {
                     refresh: function() {

+ 1 - 1
resources/views/layouts/template.blade.php

@@ -254,7 +254,7 @@
                     $('.current-work').html(_data);
                     initFastLoad($('.current-work'));
                 });
-            }, 2500);
+            }, 2500000);
         });
     </script>
     <script>

+ 0 - 0
storage/sections/articulation/form.blade.php → storage/sections/articulation_deleted/form.blade.php


+ 0 - 0
storage/sections/articulation/processor.php → storage/sections/articulation_deleted/processor.php


+ 0 - 0
storage/sections/articulation/summary.php → storage/sections/articulation_deleted/summary.php


+ 0 - 0
storage/sections/care-team/form.blade.php → storage/sections/care-team/form_deleted.blade.php


+ 0 - 0
storage/sections/care-team/processor.php → storage/sections/care-team/processor_deleted.php


+ 0 - 0
storage/sections/care-team/summary.php → storage/sections/care-team/summary_deleted.php


+ 0 - 0
storage/sections/deleted_objective/form.blade.php → storage/sections/dsm-5_deleted/form.blade.php


+ 0 - 0
storage/sections/deleted_objective/processor.php → storage/sections/dsm-5_deleted/processor.php


+ 0 - 0
storage/sections/deleted_objective/summary.php → storage/sections/dsm-5_deleted/summary.php


+ 0 - 40
storage/sections/exam/form.blade.php

@@ -1,40 +0,0 @@
-<?php
-$contentData = false;
-if($section){
-    $contentData = json_decode($section->content_data, true);
-}
-if(!$contentData || !isset($contentData['value'])) {
-    $contentData = [
-        'value'=>''
-    ];
-}
-$formID = rand(0, 100000);
-?>
-<form method="POST" action="/process_form_submit" onsubmit="return submitForm_NoteSection_{{ $formID }}(this);">
-    <?php if($section): ?>
-        <input type="hidden" name="section_uid" value="<?= $section->uid?>">
-    <?php else: ?>
-        <input type="hidden" name="note_uid" value="<?= $note->uid?>">
-        <input type="hidden" name="section_template_uid" value="<?= $sectionTemplate->uid ?>">
-    <?php endif; ?>
-    <div class="form-group mb-2">
-        <textarea rte type="text" class="form-control form-control-sm p-2" name="value" placeholder="Value"><?= $contentData['value'] ?></textarea>
-    </div>
-    <div class="form-group m-0 d-flex">
-        <button class="btn btn-sm btn-primary mr-2">Submit</button>
-        <button class="btn btn-sm btn-default border" onclick="return cancelForm_NoteSection_{{ $formID }}(this)">Cancel</button>
-    </div>
-</form>
-<script>
-    function submitForm_NoteSection_{{ $formID }}(_form) {
-        showMask();
-        $.post(_form.action, $(_form).serialize(), function(_data) {
-            fastReload();
-        });
-        return false;
-    }
-    function cancelForm_NoteSection_{{ $formID }}(_trigger) {
-        $(_trigger).closest('.note-section').toggleClass('edit');
-        return false;
-    }
-</script>

+ 0 - 4
storage/sections/exam/processor.php

@@ -1,4 +0,0 @@
-<?php
-$newContentData = [
-    'value' => $request->get('value')
-];

+ 23 - 0
storage/sections/exam_deleted/form.blade.php

@@ -0,0 +1,23 @@
+<?php
+$contentData = false;
+if($section){
+    $contentData = json_decode($section->content_data, true);
+}
+if(!$contentData || !isset($contentData['value'])) {
+    $contentData = [
+        'value'=>''
+    ];
+}
+?>
+<form processed-form>
+    <?php if($section): ?>
+        <input type="hidden" name="section_uid" value="<?= $section->uid?>">
+        <input type="hidden" name="data">
+    <?php else: ?>
+        <input type="hidden" name="note_uid" value="<?= $note->uid?>">
+        <input type="hidden" name="section_template_uid" value="<?= $sectionTemplate->uid ?>">
+    <?php endif; ?>
+    <div class="form-group mb-2">
+        <div note-rte type="text" name="value" placeholder="Value"><?= $contentData['value'] ?></div>
+    </div>
+</form>

+ 2 - 0
storage/sections/exam_deleted/processor.php

@@ -0,0 +1,2 @@
+<?php
+$newContentData = json_decode($request->get('data'));

+ 0 - 0
storage/sections/deleted_plan/summary.php → storage/sections/exam_deleted/summary.php


+ 0 - 0
storage/sections/deleted_plan/form.blade.php → storage/sections/objective_deleted/form.blade.php


+ 0 - 0
storage/sections/deleted_plan/processor.php → storage/sections/objective_deleted/processor.php


+ 0 - 0
storage/sections/deleted_subjective/summary.php → storage/sections/objective_deleted/summary.php


+ 0 - 0
storage/sections/dsm-5/form.blade.php → storage/sections/plan_deleted/form.blade.php


+ 0 - 0
storage/sections/deleted_subjective/processor.php → storage/sections/plan_deleted/processor.php


+ 0 - 0
storage/sections/dsm-5/summary.php → storage/sections/plan_deleted/summary.php


+ 0 - 0
storage/sections/deleted_subjective/form.blade.php → storage/sections/subjective_deleted/form.blade.php


+ 0 - 0
storage/sections/dsm-5/processor.php → storage/sections/subjective_deleted/processor.php


+ 0 - 0
storage/sections/exam/summary.php → storage/sections/subjective_deleted/summary.php