Ver código fonte

Note single - Allergies inline CRUD

Vijayakrishnan Krishnan 4 anos atrás
pai
commit
10c3c62570

+ 1 - 96
resources/views/app/patient/dashboard.blade.php

@@ -345,102 +345,7 @@
                 </div>
 
                 {{-- allergies --}}
-                <div class="mt-2 pb-1">
-                    <div class="d-flex align-items-center mb-2 py-2 border-top border-bottom">
-                        <h6 class="my-0 font-weight-bold text-secondary">Allergies</h6>
-                        <span class="mx-2 text-secondary">|</span>
-                        <div moe>
-                            <a start show class="py-0 font-weight-normal">Add</a>
-                            <form url="/api/clientInfoLine/create">
-                                <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
-                                <input type="hidden" name="category" value="allergy">
-                                <div class="mb-2"><input type="text" class="form-control form-control-sm" name="contentText" value="" placeholder="Allergy"></div>
-                                <div class="d-flex align-items-center">
-                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-
-                        <span class="mx-2 text-secondary">|</span>
-
-                        <div moe>
-                            <a start show class="">Multi</a>
-                            <form url="/api/clientInfoLine/createMultiple">
-                                <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
-                                <input type="hidden" name="category" value="allergy">
-                                <div class="mb-2"><textarea class="form-control form-control-sm" rows="8" name="contentTexts" value="" placeholder="Allergies"></textarea></div>
-                                <div class="d-flex align-items-center">
-                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-
-                        <span class="mx-2 text-secondary">|</span>
-                        <a start show class="py-0 font-weight-normal"
-                           href="/patients/view/{{ $patient->uid }}/allergies">
-                            View All
-                        </a>
-                    </div>
-                    <table class="table table-sm border-0 m-0">
-                        <tbody>
-                        <?php $itemCount = 0;
-                        ?>
-                        @foreach($infoLines as $category => $lines)
-                            @if($category === "allergy")
-                                @foreach ($lines as $line)
-                                    <?php $itemCount++; ?>
-                                    <tr>
-                                        <td class="text-black p-0 border-0">
-                                            <div class="d-flex">
-                                                <div moe relative class="mr-2">
-                                                    <a class="on-hover-opaque" start show title="Delete">
-                                                        <i class="font-size-11 fa fa-trash-alt text-danger"></i>
-                                                    </a>
-                                                    <form url="/api/clientInfoLine/remove">
-                                                        <input type="hidden" name="uid" value="{{ $line->uid }}">
-                                                        <p class="small">Are you sure you want to delete this entry?</p>
-                                                        <div class="d-flex align-items-center">
-                                                            <button class="btn btn-sm btn-danger mr-2" submit>Delete</button>
-                                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                                        </div>
-                                                    </form>
-                                                </div>
-                                                <div moe relative class="mr-2">
-                                                    <a class="on-hover-opaque" start show title="Edit">
-                                                        <i class="font-size-11 fa fa-edit"></i>
-                                                    </a>
-                                                    <form url="/api/clientInfoLine/updateContent">
-                                                        <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
-                                                        <input type="hidden" name="uid" value="{{ $line->uid }}">
-                                                        <input type="hidden" name="category" value="allergy">
-                                                        <div class="mb-2">
-                                                            <input type="text" class="form-control form-control-sm" name="contentText" placeholder="Allergy" value="{{$line->contentText}}">
-                                                        </div>
-                                                        <div class="d-flex align-items-center">
-                                                            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                                        </div>
-                                                    </form>
-                                                </div>
-                                                <span class="font-weight-bold">{{$line->contentText}}</span>
-                                            </div>
-                                        </td>
-                                    </tr>
-                                @endforeach
-                            @endif
-                        @endforeach
-                        @if($itemCount === 0)
-                            <tr>
-                                <td class="text-secondary p-0 border-0">
-                                    No items to show
-                                </td>
-                            </tr>
-                        @endif
-                        </tbody>
-                    </table>
-                </div>
+                @include('app/patient/partials/allergies')
 
                 {{-- rx --}}
                 @include('app/patient/partials/rx')

+ 108 - 0
resources/views/app/patient/partials/allergies.blade.php

@@ -0,0 +1,108 @@
+<?php $infoLines = json_decode($patient->info_lines);?>
+<?php $infoLines = !$infoLines ? [] : $infoLines; ?>
+<div class="<?= !@$selectable ? 'mt-2' : 'border-bottom' ?> pb-1">
+    <div class="d-flex align-items-center mb-2 py-2 <?= @$selectable ? 'px-2' : 'border-top' ?> border-bottom">
+
+        @if(!@$selectable)
+        <h6 class="my-0 font-weight-bold text-secondary">Allergies</h6>
+        <span class="mx-2 text-secondary">|</span>
+        @endif
+
+        <div moe>
+            <a start show class="py-0 font-weight-normal">Add</a>
+            <form url="/api/clientInfoLine/create">
+                <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                <input type="hidden" name="category" value="allergy">
+                <div class="mb-2"><input type="text" class="form-control form-control-sm" name="contentText" value="" placeholder="Allergy"></div>
+                <div class="d-flex align-items-center">
+                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                </div>
+            </form>
+        </div>
+
+        <span class="mx-2 text-secondary">|</span>
+        <div moe>
+            <a start show class="">Multi</a>
+            <form url="/api/clientInfoLine/createMultiple">
+                <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                <input type="hidden" name="category" value="allergy">
+                <div class="mb-2"><textarea class="form-control form-control-sm" rows="8" name="contentTexts" value="" placeholder="Allergies"></textarea></div>
+                <div class="d-flex align-items-center">
+                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                </div>
+            </form>
+        </div>
+
+        @if(!@$selectable)
+        <span class="mx-2 text-secondary">|</span>
+        <a start show class="py-0 font-weight-normal"
+           href="/patients/view/{{ $patient->uid }}/allergies">
+            View All
+        </a>
+        @endif
+    </div>
+    <table class="table table-sm border-0 my-0 mx-2">
+        <tbody>
+        <?php $itemCount = 0;
+        ?>
+        @foreach($infoLines as $category => $lines)
+            @if($category === "allergy")
+                @foreach ($lines as $line)
+                    <?php $itemCount++; ?>
+                    <tr>
+                        <td class="text-black p-0 border-0 pb-1">
+                            <div class="d-flex allergy-item">
+                                @if(@$selectable)
+                                    <span class="mr-2 d-inline-flex align-items-center">
+                                        <input type="checkbox" class="my-0 allergy-item-checkbox">
+                                    </span>
+                                @endif
+                                <div moe relative class="mr-2">
+                                    <a class="on-hover-opaque" start show title="Delete">
+                                        <i class="font-size-11 fa fa-trash-alt text-danger"></i>
+                                    </a>
+                                    <form url="/api/clientInfoLine/remove">
+                                        <input type="hidden" name="uid" value="{{ $line->uid }}">
+                                        <p class="small">Are you sure you want to delete this entry?</p>
+                                        <div class="d-flex align-items-center">
+                                            <button class="btn btn-sm btn-danger mr-2" submit>Delete</button>
+                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                                <div moe relative class="mr-2">
+                                    <a class="on-hover-opaque" start show title="Edit">
+                                        <i class="font-size-11 fa fa-edit"></i>
+                                    </a>
+                                    <form url="/api/clientInfoLine/updateContent">
+                                        <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                                        <input type="hidden" name="uid" value="{{ $line->uid }}">
+                                        <input type="hidden" name="category" value="allergy">
+                                        <div class="mb-2">
+                                            <input type="text" class="form-control form-control-sm" name="contentText" placeholder="Allergy" value="{{$line->contentText}}">
+                                        </div>
+                                        <div class="d-flex align-items-center">
+                                            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                                <span class="content-html"><b>{{$line->contentText}}</b></span>
+                            </div>
+                        </td>
+                    </tr>
+                @endforeach
+            @endif
+        @endforeach
+        @if($itemCount === 0)
+            <tr>
+                <td class="text-secondary p-0 border-0">
+                    No items to show
+                </td>
+            </tr>
+        @endif
+        </tbody>
+    </table>
+</div>

+ 135 - 0
resources/views/app/patient/partials/rx.blade.php

@@ -0,0 +1,135 @@
+<?php $infoLines = json_decode($patient->info_lines);?>
+<?php $infoLines = !$infoLines ? [] : $infoLines; ?>
+<div class="<?= !@$selectable ? 'mt-2' : 'border-bottom' ?> pb-1" rx-section>
+    <div class="d-flex align-items-center mb-2 py-2 <?= @$selectable ? 'px-2' : 'border-top' ?> border-bottom">
+
+        @if(!@$selectable)
+        <h6 class="my-0 font-weight-bold text-secondary">Current Medications</h6>
+        <span class="mx-2 text-secondary">|</span>
+        @endif
+
+        <div moe>
+            <a start show class="py-0 font-weight-normal">Add</a>
+            <form url="/api/clientInfoLine/create">
+                <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                <input type="hidden" name="category" value="rx">
+                <div class="mb-2">
+                    <input type="text" class="form-control form-control-sm" name="contentText" value=""
+                           placeholder="Medication">
+                </div>
+                <div class="mb-2">
+                    <input type="text" class="form-control form-control-sm" name="strength" value=""
+                           placeholder="Strength/Form">
+                </div>
+                <div class="d-flex align-items-center">
+                    <button class="btn btn-sm btn-primary mr-2" type="button" submit>Save</button>
+                    <button class="btn btn-sm btn-default mr-2 border" type="button" cancel>Cancel</button>
+                </div>
+            </form>
+        </div>
+
+        <span class="mx-2 text-secondary">|</span>
+        <div moe>
+            <a start show class="">Multi</a>
+            <form url="/api/clientInfoLine/createMultiple">
+                <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                <input type="hidden" name="category" value="rx">
+                <div class="mb-2">
+                    <textarea class="form-control form-control-sm" rows="8"
+                              name="contentTexts" value=""
+                              placeholder="Medications"></textarea>
+                </div>
+                <div class="d-flex align-items-center">
+                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                </div>
+            </form>
+        </div>
+
+        @if(!@$selectable)
+        <span class="mx-2 text-secondary">|</span>
+        <a start show class="py-0 font-weight-normal"
+           href="/patients/view/{{ $patient->uid }}/medications">
+            View All
+        </a>
+        @endif
+    </div>
+    <table class="table table-sm border-0 my-0 mx-2">
+        <tbody>
+        <?php $itemCount = 0; ?>
+        @foreach($infoLines as $category => $lines)
+            @if($category === "rx")
+                @foreach ($lines as $line)
+                    <?php $itemCount++; ?>
+                    <tr>
+                        <td class="text-black p-0 border-0 pb-1">
+                            <div class="d-flex rx-item">
+                                @if(@$selectable)
+                                    <span class="mr-2 d-inline-flex align-items-center">
+                                        <input type="checkbox" class="my-0 rx-item-checkbox">
+                                    </span>
+                                @endif
+                                <span moe relative class="mr-2">
+                                    <a class="on-hover-opaque" start show title="Delete">
+                                        <i class="font-size-11 fa fa-trash-alt text-danger"></i>
+                                    </a>
+                                    <form url="/api/clientInfoLine/remove">
+                                        <input type="hidden" name="uid" value="{{ $line->uid }}">
+                                        <p class="small">Are you sure you want to delete this entry?</p>
+                                        <div class="d-flex align-items-center">
+                                            <button class="btn btn-sm btn-danger mr-2" submit>Delete</button>
+                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </span>
+                                <div moe relative class="mr-2">
+                                    <a class="on-hover-opaque" start show title="Edit">
+                                        <i class="font-size-11 fa fa-edit"></i>
+                                    </a>
+                                    <form url="/api/clientInfoLine/updateContent">
+                                        <input type="hidden" name="uid" value="{{ $line->uid }}">
+                                        <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                                        <input type="hidden" name="category" value="rx">
+                                        <div class="mb-2">
+                                            <input type="text" class="form-control form-control-sm"
+                                                   name="contentText"
+                                                   placeholder="Medication"
+                                                   value="{{$line->contentText}}"></div>
+                                        <div class="mb-2">
+                                            <input type="text" class="form-control form-control-sm" name="strength"
+                                                   value="{{getVal($line->contentDetail, "strength") }}"
+                                                   placeholder="Strength/Form">
+                                        </div>
+                                        <div class="d-flex align-items-center">
+                                            <button class="btn btn-sm btn-primary mr-2" type="button" submit>Save
+                                            </button>
+                                            <button class="btn btn-sm btn-default mr-2 border" type="button" cancel>
+                                                Cancel
+                                            </button>
+                                        </div>
+                                    </form>
+                                </div>
+                                <span class="content-html">
+                                    <b>{{$line->contentText}}</b>
+                                    @if(!empty(getVal($line->contentDetail, "strength")))
+                                        <span class="text-secondary">/</span>
+                                        <span>{{getVal($line->contentDetail, "strength") }}</span>
+                                    @endif
+                                </span>
+                            </div>
+                        </td>
+                    </tr>
+                @endforeach
+            @endif
+        @endforeach
+        @if($itemCount === 0)
+            <tr>
+                <td class="text-secondary p-0 border-0">
+                    No items to show
+                </td>
+            </tr>
+        @endif
+        </tbody>
+    </table>
+</div>
+

+ 0 - 0
storage/sections/allergies/actions.php → storage/sections/allergies/actions-old.php


+ 34 - 0
storage/sections/allergies/actions.blade.php

@@ -0,0 +1,34 @@
+<div class="position-relative d-none if-edit ml-3 pl-3 border-left">
+    <a href="#" onclick="$(this).siblings('.embed-section, .embed-mask').removeClass('d-none'); return false;">Current Allergies</a>
+    <div class="embed-section min-width-300px bg-white position-absolute d-none current-allergy-form">
+        <div>
+            @include('app/patient/partials/allergies', ['selectable' => true])
+        </div>
+        <div class="m-2">
+            <form url="/no-op">
+                <button class="btn btn-primary btn-sm mr-1" type="button" onclick="return applySelectedAllergy()">Apply</button>
+                <button class="btn btn-default border btn-sm" type="button" onclick="return cancelAllergyPopup()">Cancel</button>
+            </form>
+        </div>
+    </div>
+</div>
+
+<script>
+    function applySelectedAllergy() {
+        let html = [];
+        $('.allergy-item-checkbox:checked').each(function() {
+            html.push('<p style="white-space: normal;">' + $.trim($(this).closest('.allergy-item').find('.content-html').first().html()) + '</p>');
+        });
+        $('.embed-section, .embed-mask').addClass('d-none');
+        $('.ql-editor[contenteditable]:visible').first().html(html.join('')).focus();
+        return false;
+    }
+    function cancelAllergyPopup() {
+        $('.embed-section, .embed-mask').addClass('d-none');
+        hideMask();
+        hideMoeFormMask();
+        $('.ql-editor[contenteditable]:visible').first().focus();
+        return false;
+    }
+</script>
+

+ 0 - 17
storage/sections/medication/actions.blade.php

@@ -1,20 +1,3 @@
-<?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 class="position-relative d-none if-edit ml-3 pl-3 border-left">
     <a href="#" onclick="$(this).siblings('.embed-section, .embed-mask').removeClass('d-none'); return false;">Current Medications</a>
     <div class="embed-section min-width-300px bg-white position-absolute d-none current-medications-form">