Forráskód Böngészése

Bring back support for old notes + template selection in add moe

Vijayakrishnan 3 éve
szülő
commit
f9b2dd0db4

+ 100 - 0
resources/views/app/patient/note/dashboard.blade.php

@@ -2323,3 +2323,103 @@
     </script>
     @endif
 @endsection
+@if(!$isVisitTemplateBased)
+@section('left-nav-content')
+    @if(!$note->is_signed_by_hcp)
+    <div class="left-nav-content" id="note-sections-app">
+        <div class="note-widget-title px-2 py-1">Note Sections</div>
+        <input type="search" class="d-block w-100 border-0 outline-0 px-2 py-1"
+               v-model="q" placeholder="Filter">
+        <div class="border-top py-1">
+            <div v-for="section in sections"
+                 v-show="section.title.toLowerCase().indexOf(q.toLowerCase()) !== -1">
+                <div class="d-flex pr-1 align-items-center note-widget-item c-pointer"
+                     :title="section.title + ' - Click to remove'"
+                     v-if="section.used"
+                     v-on:click.once="remove(section.section_uid)">
+                    <span class="mx-2">
+                        <a class="font-12 text-secondary" href="#">
+                            <i class="fa fa-minus-circle"></i>
+                        </a>
+                    </span>
+                    <span class="font-smaller text-ellipsis">
+                        @{{section.title}}
+                    </span>
+                </div>
+                <div class="d-flex pr-1 align-items-center note-widget-item c-pointer"
+                     :title="section.title + ' - Click to add'"
+                     v-if="!section.used"
+                     v-on:click.once="add(section.uid, section.internal_name)">
+                    <span class="mx-2">
+                        <a class="font-12" href="#">
+                            <i class="fa fa-plus-circle"></i>
+                        </a>
+                    </span>
+                    <span class="font-smaller text-ellipsis">
+                        @{{section.title}}
+                    </span>
+                </div>
+            </div>
+        </div>
+    </div>
+                <script>
+        (function() {
+            function initSectionsWidget() {
+                var allSections = <?= json_encode($allSections) ?>;
+                new Vue({
+                    el: '#note-sections-app',
+                    delimiters: ['@{{', '}}'],
+                    data: {
+                        q: '',
+                        sections: allSections
+                    },
+                    methods: {
+                        add: function(_uid, _section) {
+                            $.post('/api/section/create', {
+                                noteUid: '{{$note->uid}}',
+                                sectionTemplateUid: _uid,
+                            }, function(_data) {
+                                if(_data) {
+                                    if(_data.success) {
+                                        fastReload();
+                                    }
+                                    else {
+                                        toastr.error(_data.message);
+                                    }
+                                }
+                                else {
+                                    toastr.error('Unable to add section!');
+                                }
+                            }, 'json');
+                        },
+                        remove: function(_uid) {
+                            $.post('/api/section/deactivate', {
+                                uid: _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');
+                        }
+                    }
+                });
+
+                $('div[embed]').each(function() {
+                    $(this).load($(this).attr('embed'));
+                });
+            }
+            addMCInitializer('note-sections-widget', initSectionsWidget, '#note-sections-app');
+        })();
+    </script>
+    @endif
+@endsection
+@endif

+ 31 - 21
resources/views/app/patient/notes.blade.php

@@ -10,30 +10,38 @@
                 <span class="mx-2 text-secondary">|</span>
                 <div moe>
                     <a start show class="py-0 mb-3">Add</a>
-                    <form url="/api/note/create" class="mcp-theme-1"
-                          redir="patients/view/{{ $patient->uid }}/notes/view/[data]">
+
+
+                    <form url="/api/note/createUsingTemplate"
+                          redir="/patients/view/{{$patient->uid}}/notes/view/[data]"
+                          class="mcp-theme-1">
                         <input type="hidden" name="clientUid" value="{{$patient->uid}}">
-                        <div class="form-group">
+                        <input type="hidden" name="effectiveDateEST" value="{{date("Y-m-d")}}">
+                        <input type="hidden" name="effectiveTime" value="{{date("h:i")}}">
+                        <input type="hidden" name="title" id="note-create-title" value="">
+                        <div class="form-group mb-2">
                             <label for="" class="text-secondary text-sm mb-1">Pro *</label>
                             <select name="hcpProUid" class="form-control" provider-search required data-pro-uid="{{$pro->is_hcp ? $pro->uid : ''}}">
                             </select>
                         </div>
-                        <input type="hidden" name="effectiveDateEST" value="{{ date('Y-m-d') }}">
-                        <div class="form-group">
-                            <label for="" class="text-secondary text-sm mb-1">Type *</label>
-                            <select name="newOrFuOrNa" class="form-control">
-                                <option value="NEW">New Patient</option>
-                                <option value="FU" {{$pro->is_hcp && $patient->hasNewNoteForPro($pro) ? 'selected' : ''}}>Follow Up</option>
-                                <option value="NA">N/A</option>
+                        <div class="form-group mb-2">
+                            <label for="" class="text-secondary text-sm mb-1">Note Template *</label>
+                            <select name="noteTemplateUid" class="form-control form-control-sm"
+                                    onchange="$('#note-create-title').val($(this).find('option:selected').text())"
+                                    required>
+                                <option value=""> --select--</option>
+                                @foreach($pro->noteTemplates as $noteTemplate)
+                                    <?php $nT = $noteTemplate->template(); ?>
+                                    <option value="{{$nT->uid}}">{{$nT->title}}</option>
+                                @endforeach
                             </select>
                         </div>
-                        <div class="form-group">
+                        <div class="mb-2">
                             <label for="" class="text-secondary text-sm mb-1">Method *</label>
-                            <select name="method" class="form-control note-method-select" required>
-                                <option value="">-- select --</option>
-                                <option value="VIDEO">Video</option>
+                            <select name="method" class="form-control form-control-sm note-method-select" required>
                                 <option value="AUDIO">Audio</option>
-                                <option value="IN_CLINIC">In Clinic</option>
+                                <option value="VIDEO">Video</option>
+                                <option value="IN_CLINIC">In-Clinic</option>
                                 <option value="HOUSE_CALL">House Call</option>
                             </select>
                         </div>
@@ -46,15 +54,14 @@
                                 @endforeach
                             </select>
                         </div>
-                        <div>
-                            <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                        <div class="form-group m-0">
+                            <button submit class="btn btn-primary btn-sm">submit</button>
                         </div>
                     </form>
                 </div>
                 <span class="mx-2 text-secondary">|</span>
                 <div moe>
-                <a start show class="py-0 mb-3">Add Visit</a>
+                <a start show class="py-0 mb-3 text-info font-weight-bold">Add Visit</a>
                 <form url="/api/visit/create"
                       redir="/patients/view/{{$patient->uid}}/notes/view/[data]"
                       class="mcp-theme-1">
@@ -166,9 +173,12 @@
         @foreach ($records as $note)
             <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
                 <td class="px-2">
-                    <span class="font-weight-bold">
+                    <a href="/patients/view/{{ $patient->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold">
                         {{ friendly_date_time($note->effective_dateest, false) }}
-                    </span>
+                    </a>
+                    @if(!!$note->visitTemplate)
+                        <span class="text-info font-weight-bold">*</span>
+                    @endif
                     <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
                 </td>
                 <td class="px-2">