Răsfoiți Sursa

Custom actions support

Vijayakrishnan Krishnan 4 ani în urmă
părinte
comite
45bafb13d7

+ 23 - 18
resources/views/app/patient/note/dashboard.blade.php

@@ -246,10 +246,15 @@
                                 </a>
                                 <?php $sectionInternalName = $section->sectionTemplate->internal_name; ?>
                                 @include('app/patient/note/_templates-index')
+                                <?php
+                                if(file_exists(storage_path('sections/' . $sectionInternalName . '/actions.php'))) {
+                                    include(storage_path('sections/' . $sectionInternalName . '/actions.php'));
+                                }
+                                ?>
                                 <a href="#" class="d-none text-danger if-edit ml-auto remove-section-trigger"
                                    data-uid="{{$section->uid}}"
                                    title="Remove {{$section->sectionTemplate->title}}">
-                                    <i class="fa fa-times-circle"></i>
+                                    Remove {{$section->sectionTemplate->title}}
                                 </a>
                             </div>
                             <div class="d-none if-not-edit  inset-comment">{!! !empty($section->summary_html) ? $section->summary_html : '-' !!}</div>
@@ -570,23 +575,23 @@
                     });
 
                 $('.remove-section-trigger').click(function() {
-                    // $.post('/api/section/deactivate', {
-                    //     uid: $(this).attr('data-uid'),
-                    //     memo: 'Deactivated from note',
-                    // }, function(_data) {
-                    //     if(_data) {
-                    //         if(_data.success) {
-                    //             fastReload();
-                    //         }
-                    //         else {
-                    //             toastr.error(_data.message);
-                    //         }
-                    //     }
-                    //     else {
-                    //         toastr.error('Unable to remove section!');
-                    //     }
-                    // }, 'json');
-                    $(this).closest('.note-section').removeClass('edit');
+                    $.post('/api/section/deactivate', {
+                        uid: $(this).attr('data-uid'),
+                        memo: 'Deactivated from note',
+                    }, function(_data) {
+                        if(_data) {
+                            if(_data.success) {
+                                fastReload();
+                            }
+                            else {
+                                toastr.error(_data.message);
+                            }
+                        }
+                        else {
+                            toastr.error('Unable to remove section!');
+                        }
+                    }, 'json');
+                    // $(this).closest('.note-section').removeClass('edit');
                     return false;
                 });
 

+ 45 - 0
storage/sections/assessment/actions.php

@@ -0,0 +1,45 @@
+<?php
+$infoLines = json_decode($patient->info_lines);
+$infoLines = !$infoLines ? [] : $infoLines;
+$rows = [];
+foreach ($infoLines as $category => $lines):
+    if ($category === "dx"):
+        foreach ($lines as $line):
+            $rows[] = '<label class="d-flex align-items-center current-symptoms-item mb-1 c-pointer">' .
+                '<input type="checkbox" checked class="my-0 mr-2">' .
+                '<span><b>' . $line->contentText . '</b>' .
+                (isset($line->contentDetail->{"Chronic or Acute"}) ? '<span class="text-secondary">&nbsp/&nbsp</span>' . @$line->contentDetail->{"Chronic or Acute"} : '') .
+                (isset($line->contentDetail->{"ICD"}) ? '<span class="text-secondary mx-1">&nbsp/&nbsp</span>' . @$line->contentDetail->{"ICD"} : '') .
+                '</span></label>';
+        endforeach;
+    endif;
+endforeach;
+?>
+
+<div moe class="position-relative d-none if-edit ml-3 pl-3 border-left">
+    <a start show href="#">Include from Symptoms</a>
+    <form url="/no-op" class="current-symptoms-form">
+        <div class="min-width-200px">
+            <?= implode("", $rows) ?>
+            <div class="mt-2 mb-0">
+                <button class="btn btn-primary btn-sm mr-1" type="button" onclick="return applySelectedSymptoms()">Apply</button>
+                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+            </div>
+        </div>
+    </form>
+</div>
+
+<script>
+    function applySelectedSymptoms() {
+        let html = [];
+        $('.current-symptoms-item input:checkbox:checked').each(function() {
+            html.push('<p>' + $(this).next().html() + '</p>');
+        });
+        $('.current-symptoms-form').hide();
+        hideMask();
+        hideMoeFormMask();
+        $('.ql-editor[contenteditable]:visible').first().html(html.join('')).focus();
+        return false;
+    }
+</script>
+

+ 44 - 0
storage/sections/medication/actions.php

@@ -0,0 +1,44 @@
+<?php
+$infoLines = json_decode($patient->info_lines);
+$infoLines = !$infoLines ? [] : $infoLines;
+$rows = [];
+foreach ($infoLines as $category => $lines):
+    if ($category === "rx"):
+        foreach ($lines as $line):
+            $rows[] = '<label class="d-flex align-items-center current-medication-item mb-1 c-pointer">' .
+                '<input type="checkbox" checked class="my-0 mr-2">' .
+                '<span><b>' . $line->contentText . '</b>&nbsp;' .
+                @$line->contentDetail->strength .
+                '</span></label>';
+        endforeach;
+    endif;
+endforeach;
+?>
+
+<div moe class="position-relative d-none if-edit ml-3 pl-3 border-left">
+    <a start show href="#">Current Medications</a>
+    <form url="/no-op" class="current-medications-form">
+        <div class="min-width-200px">
+            <?= implode("", $rows) ?>
+            <div class="mt-2 mb-0">
+                <button class="btn btn-primary btn-sm mr-1" type="button" onclick="return applySelectedMedication()">Apply</button>
+                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+            </div>
+        </div>
+    </form>
+</div>
+
+<script>
+    function applySelectedMedication() {
+        let html = [];
+        $('.current-medication-item input:checkbox:checked').each(function() {
+            html.push('<p>' + $(this).next().html() + '</p>');
+        });
+        $('.current-medications-form').hide();
+        hideMask();
+        hideMoeFormMask();
+        $('.ql-editor[contenteditable]:visible').first().html(html.join('')).focus();
+        return false;
+    }
+</script>
+