Vijayakrishnan Krishnan 4 жил өмнө
parent
commit
dd752ac9a5

+ 122 - 156
resources/views/app/patient/notes.blade.php

@@ -2,164 +2,130 @@
 
 @section('inner-content')
 
-    <?php /*
-    @if($patient->has_mcp_done_onboarding_visit !== 'YES')
-        <div class="pt-2 d-flex align-items-start">
-            <h6 class="my-0 text-secondary d-flex align-items-start">
-                <div>
-                    <div>
-                        <span class="text-dark font-weight-bold">Notes</span>
+    <div class="pt-2 d-flex align-items-start">
+        <h6 class="my-0 text-secondary d-flex align-items-start">
+            <span class="font-weight-bold text-secondary">Notes</span>
+            <span class="mx-2 text-secondary">|</span>
+            <a href="#" class="py-0 mb-0 create-auto-note-trigger"
+               data-patient-uid="{{ $patient->uid  }}"
+               data-hcp-uid="{{ $pro->uid }}"
+               data-effective-date="{{ date('Y-m-d') }}">Add</a>
+            <?php /*<div moe>
+                <a start show class="py-0 mb-3">Add</a>
+                <form url="/api/note/createUsingFreeTextHtml" class="mcp-theme-1">
+                    <input type="hidden" name="clientUid" value="{{$patient->uid}}">
+                    <div class="mb-2">
+                        <select name="hcpProUid" class="form-control form-control-sm">
+                            <option value="">-- Select HCP Pro --</option>
+                            @foreach ($pros as $iPro)
+                                <option
+                                    value="{{$iPro->uid}}">{{$iPro->name_display}}</option>
+                            @endforeach
+                        </select>
                     </div>
-                    <div class="text-dark d-inline-flex align-items-center mt-2">
-                                    <span class="mr-2">
-                                        <i class="fa fa-exclamation-triangle"></i>
-                                        MCP Onboarding Visit Pending
-                                    </span>
-                        <div moe>
-                            <a start show>Update</a>
-                            <form url="/api/client/updateMcpOnboardingVisitInfo" class="mcp-theme-1">
-                                <input type="hidden" name="uid" value="{{$patient->uid}}">
-                                <div class="mb-2">
-                                    <select name="hasMcpDoneOnboardingVisit"
-                                            class="form-control form-control-sm"
-                                            onchange="toggleDisabledAsNeeded(this, 'YES', 'if-visit-done')">
-                                        <option value="">-- Select Status --</option>
-                                        <option value="YES" {{ $patient->has_mcp_done_onboarding_visit === 'YES' ? 'selected' : '' }}>YES</option>
-                                        <option value="NO" {{ $patient->has_mcp_done_onboarding_visit === 'NO' ? 'selected' : '' }}>NO</option>
-                                        <option value="UNKNOWN" {{ $patient->has_mcp_done_onboarding_visit === 'UNKNOWN' ? 'selected' : '' }}>UNKNOWN</option>
-                                    </select>
-                                </div>
-                                <div class="mb-2">
-                                    <input type="date" class="if-visit-done form-control form-control-sm" disabled name="mcpOnboardingVisitDate" max="{{ date('Y-m-d') }}">
-                                </div>
-                                <div class="mb-2">
-                                    <select name="mcpOnboardingVisitNoteUid" disabled
-                                            class="form-control form-control-sm if-visit-done"
-                                            onchange="toggleVisibilityAsNeeded(this, '', 'if-note-outside-system')">
-                                        <option value="">-- Visit Note --</option>
-                                        @foreach ($notes as $note)
-                                            @if(!empty($note->title))
-                                                <option value="{{$note->uid}}">{{$note->title}}</option>
-                                            @endif
-                                        @endforeach
-                                    </select>
-                                </div>
-                                <div class="mb-2 if-note-outside-system">
-                                                <textarea class="form-control form-control-sm"
-                                                          name="reasonOnboardingVisitNoteOutsideSystem"
-                                                          placeholder="Visit note outside the system reason"></textarea>
-                                </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>
-                            </form>
-                        </div>
+                    {{--<div class="mb-2">
+                        <select name="allyProUid" class="form-control form-control-sm">
+                            <option value="">-- Select Ally Pro --</option>
+                            @foreach ($pros as $iPro)
+                                <option
+                                    value="{{$iPro->uid}}">{{$iPro->name_display}}</option>
+                            @endforeach
+                        </select>
+                    </div>--}}
+                    <div class="mb-2">
+                        <input type="text" name="title" placeholder="Title" class="form-control form-control-sm">
                     </div>
-                </div>
-            </h6>
-        </div>
-    @else */ ?>
-
-        <div class="pt-2 d-flex align-items-start">
-            <h6 class="my-0 text-secondary d-flex align-items-start">
-                <span class="font-weight-bold text-secondary">Notes</span>
-                <span class="mx-2 text-secondary">|</span>
-                <a href="#" class="py-0 mb-0 create-auto-note-trigger"
-                   data-patient-uid="{{ $patient->uid  }}"
-                   data-hcp-uid="{{ $pro->uid }}"
-                   data-effective-date="{{ date('Y-m-d') }}">Add</a>
-                <?php /*<div moe>
-                    <a start show class="py-0 mb-3">Add</a>
-                    <form url="/api/note/createUsingFreeTextHtml" class="mcp-theme-1">
-                        <input type="hidden" name="clientUid" value="{{$patient->uid}}">
-                        <div class="mb-2">
-                            <select name="hcpProUid" class="form-control form-control-sm">
-                                <option value="">-- Select HCP Pro --</option>
-                                @foreach ($pros as $iPro)
-                                    <option
-                                        value="{{$iPro->uid}}">{{$iPro->name_display}}</option>
-                                @endforeach
-                            </select>
-                        </div>
-                        {{--<div class="mb-2">
-                            <select name="allyProUid" class="form-control form-control-sm">
-                                <option value="">-- Select Ally Pro --</option>
-                                @foreach ($pros as $iPro)
-                                    <option
-                                        value="{{$iPro->uid}}">{{$iPro->name_display}}</option>
-                                @endforeach
-                            </select>
-                        </div>--}}
-                        <div class="mb-2">
-                            <input type="text" name="title" placeholder="Title" class="form-control form-control-sm">
-                        </div>
-                        <div class="mb-2">
-                            <label class="text-secondary text-sm">Effective Date</label>
-                            <input type="date" name="effectiveDateEST" placeholder="Effective Date" class="form-control form-control-sm">
-                        </div>
-                        <div class="mb-2">
-                            <label class="text-secondary text-sm">Effective Time</label>
-                            <input type="time" name="effectiveTime" placeholder="Effective Time" class="form-control form-control-sm">
-                        </div>
-                        <div class="mb-2">
-                            <textarea name="freeTextHtml" id="" cols="30" rows="5" placeholder="Content" class="form-control form-control-sm"></textarea>
-                        </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>
-                    </form>
-                </div> */ ?>
-            </h6>
-        </div>
+                    <div class="mb-2">
+                        <label class="text-secondary text-sm">Effective Date</label>
+                        <input type="date" name="effectiveDateEST" placeholder="Effective Date" class="form-control form-control-sm">
+                    </div>
+                    <div class="mb-2">
+                        <label class="text-secondary text-sm">Effective Time</label>
+                        <input type="time" name="effectiveTime" placeholder="Effective Time" class="form-control form-control-sm">
+                    </div>
+                    <div class="mb-2">
+                        <textarea name="freeTextHtml" id="" cols="30" rows="5" placeholder="Content" class="form-control form-control-sm"></textarea>
+                    </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>
+                </form>
+            </div> */ ?>
+        </h6>
+    </div>
 
-        <table class="table table-sm table-striped table-bordered mb-0 mt-2">
-            <thead>
-            <tr>
-                <th class="px-2 text-secondary border-bottom-0">Created</th>
-                <th class="px-2 text-secondary border-bottom-0 w-50">Content</th>
-                <th class="px-2 text-secondary border-bottom-0">Effective Date</th>
-                <th class="px-2 text-secondary border-bottom-0">HCP</th>
-                {{--<th class="px-2 text-secondary border-bottom-0">Ally</th>--}}
+    <table class="table table-sm table-striped table-bordered mb-0 mt-2">
+        <thead>
+        <tr>
+            <th class="px-2 text-secondary border-bottom-0">Created</th>
+            <th class="px-2 text-secondary border-bottom-0 w-50">Content</th>
+            <th class="px-2 text-secondary border-bottom-0">Effective Date</th>
+            <th class="px-2 text-secondary border-bottom-0">HCP</th>
+            <th class="px-2 text-secondary border-bottom-0">&nbsp;</th>
+        </tr>
+        </thead>
+        <tbody>
+        @foreach ($patient->notes as $note)
+            <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
+                <td class="px-2">
+                    {{ friendly_date_time($note->created_at, true) }}
+                </td>
+                <td class="px-2">
+                    <?php
+                    $textContent = strip_tags($note->free_text_html);
+                    if(strlen($textContent) > 200) {
+                        $textContent = substr($textContent, 0, 200) . '…';
+                    }
+                    ?>
+                    {!! $textContent !!}
+                    @foreach($note->sections as $section)
+                    <div p-2>
+                        {!! $section->summary_html !!}
+                    </div>
+                    @endforeach
+                </td>
+                <td class="px-2">
+                    <a href="/patients/view/{{ $patient->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold">
+                        {{ friendly_date_time($note->effective_dateest, false) }}
+                    </a>
+                    <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
+                </td>
+                <td class="px-2">
+                    {{$note->hcpPro ? $note->hcpPro->name_display: '-'}}
+                </td>
+                <td class="px-2">
+                    <a href="#" class="text-primary trigger-clone" data-uid="{{$note->uid}}">Clone</a>
+                </td>
             </tr>
-            </thead>
-            <tbody>
-            @foreach ($patient->notes as $note)
-                <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
-                    <td class="px-2">
-                        {{ friendly_date_time($note->created_at, true) }}
-                    </td>
-                    <td class="px-2">
-                        <?php
-                        $textContent = strip_tags($note->free_text_html);
-                        if(strlen($textContent) > 200) {
-                            $textContent = substr($textContent, 0, 200) . '…';
-                        }
-                        ?>
-                        {!! $textContent !!}
-                        @foreach($note->sections as $section)
-                        <div p-2>
-                            {!! $section->summary_html !!}
-                        </div>
-                        @endforeach
-                    </td>
-                    <td class="px-2">
-                        <a href="/patients/view/{{ $patient->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold">
-                            {{ friendly_date_time($note->effective_dateest, false) }}
-                        </a>
-                        <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
-                    </td>
-                    <td class="px-2">
-                        {{$note->hcpPro ? $note->hcpPro->name_display: '-'}}
-                    </td>
-                    {{--<td class="px-2">
-                        {{$note->allyPro ? $note->allyPro->name_display: '-'}}
-                    </td>--}}
-                </tr>
-            @endforeach
-            </tbody>
-        </table>
-
-    <?php /* @endif */ ?>
+        @endforeach
+        </tbody>
+    </table>
+    <script>
+        (function() {
+            function initNotesList() {
+                $('.trigger-clone')
+                    .off('click.clone')
+                    .on('click.clone', function() {
+                        $.post('/api/note/clone', {
+                            uid: $(this).attr('data-uid')
+                        }, function(_data) {
+                            if(_data) {
+                                if(_data.success) {
+                                    toastr.success('Note cloned successfully');
+                                    fastLoad('/patients/view/{{$patient->uid}}/notes/view/' + _data.data);
+                                }
+                                else {
+                                    toastr.error(_data.message);
+                                }
+                            }
+                            else {
+                                toastr.error('Unable to clone the note!');
+                            }
+                        }, 'json');
+                    })
+            }
+            addMCInitializer('notes-list', initNotesList);
+        })();
+    </script>
 @endsection