Explorar o código

Merge branch 'dev' of rav.triplestart.com:jmudaka/stagfe2

= %!s(int64=3) %!d(string=hai) anos
pai
achega
b5fd975573

+ 11 - 0
app/Http/Controllers/PatientController.php

@@ -438,6 +438,17 @@ class PatientController extends Controller
         return view('app.patient.prescriptions.index', compact('patient', 'type', 'currentErx'));
     }
 
+    public function prescriptionsList(Request $request, Client $patient, String $type = '', String $currentErx = '') {
+        if(!!$currentErx) {
+            $currentErx = Erx::where('uid', $currentErx)->first();
+        }
+        $note = null;
+        if($request->input('noteUid')) {
+            $note = Note::where('uid', $request->input('noteUid'))->first();
+        }
+        return view('app.patient.prescriptions.list', compact('patient', 'type', 'currentErx', 'note'));
+    }
+
     public function downloadPrescriptionAsPdf(Request $request, Erx $prescription){
         if($request->input('html')) {
             return view('app.patient.prescriptions.pdf.pdf-preview', compact('prescription'));

+ 1 - 0
app/Models/Client.php

@@ -94,6 +94,7 @@ class Client extends Model
     public function prescriptions()
     {
         return $this->hasMany(Erx::class, 'client_id', 'id')
+            ->orderByRaw('note_id DESC NULLS LAST')
             ->orderBy('created_at', 'desc');
     }
 

+ 3 - 0
public/css/style.css

@@ -427,6 +427,9 @@ body>nav.navbar {
     background: #f6f9fc;
     cursor: pointer;
 }
+[data-non-segment-section]:hover {
+    background: #f6f9fc;
+}
 .note-signed-by-hcp .note-section:not(.edit):hover {
     background: #f6f9fc;
     cursor: auto;

+ 158 - 10
resources/views/app/patient/dashboard.blade.php

@@ -33,7 +33,7 @@
                 @include('app/patient/partials/appointments')
 
                 {{-- canvas based allergies --}}
-                <div class="pt-2 mt-2 border-top">
+                {{-- <div class="pt-2 mt-2 border-top">
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Allergies</h6>
                         <span class="mx-2 text-secondary">|</span>
@@ -42,10 +42,31 @@
                     <div class="bg-light border p-2 mb-3">
                         @include('app.patient.canvas-sections.allergies.summary')
                     </div>
+                </div> --}}
+
+                <!-- allergies - point -->
+                <?php
+                $allergies = \App\Models\Point::getPointsOfCategory($patient, "ALLERGY");
+                ?>
+                <div class="pt-2 mt-2">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Allergies</h6>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @foreach($allergies as $allergy)
+                            <div class="mb-1">
+                                <b><?= !!@($allergy->data->name) ? @($allergy->data->name) : '-' ?></b>
+                                <?= !!@($allergy->data->description) ? '/&nbsp;' . @($allergy->data->description) : '' ?>
+                            </div>
+                        @endforeach
+                        @if(!count($allergies))
+                            <div class="text-secondary">Nothing here yet</div>
+                        @endif
+                    </div>
                 </div>
 
                 {{-- canvas based rx --}}
-                <div class="pt-2 mt-2 border-top">
+                {{-- <div class="pt-2 mt-2 border-top">
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Current Medications</h6>
                         <span class="mx-2 text-secondary">|</span>
@@ -61,7 +82,28 @@
                         @include('app.patient.canvas-sections.rx.summary')
                     </div>
                 </div>
-                <div class="stag-popup stag-popup-lg ticket-popup mcp-theme-1" stag-popup-key="ticket-popup"></div>
+                <div class="stag-popup stag-popup-lg ticket-popup mcp-theme-1" stag-popup-key="ticket-popup"></div> --}}
+
+                <!-- meds - point -->
+                <?php
+                $medications = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
+                ?>
+                <div class="pt-2 mt-2">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Current Medications</h6>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @foreach($medications as $medication)
+                            <div class="mb-1">
+                                <b><?= !!@($medication->data->name) ? @($medication->data->name) : '-' ?></b>
+                                <?= !!@($medication->data->frequency) ? '/&nbsp;' . @($medication->data->frequency) : '' ?>
+                            </div>
+                        @endforeach
+                        @if(!count($medications))
+                            <div class="text-secondary">Nothing here yet</div>
+                        @endif
+                    </div>
+                </div>
 
                 {{-- rm reasons --}}
                 <div class="pt-2 mt-2 border-top">
@@ -190,7 +232,7 @@
                 {{--@include('app/patient/partials/vitals')--}}
 
                 {{-- canvas based vitals --}}
-                <div class="pt-2 border-top">
+                {{-- <div class="pt-2 border-top">
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Vitals</h6>
                         <span class="mx-2 text-secondary">|</span>
@@ -199,6 +241,27 @@
                     <div class="bg-light border p-2 mb-3">
                         @include('app.patient.canvas-sections.vitals.summary')
                     </div>
+                </div> --}}
+
+                <!-- vitals - point -->
+                <?php $latestVitals = \App\Models\Point::where('client_id', $patient->id)->where('category', 'VITALS')->orderBy('id', 'DESC')->first(); ?>
+                <div class="pt-2 mt-2">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Vitals
+                            @if(!!$latestVitals && $latestVitals->note && $latestVitals->note->effective_dateest)
+                                <span class="text-secondary font-weight-normal pl-1">(as on
+                                    <a href="{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $latestVitals->note])}}">{{friendlier_date($latestVitals->note->effective_dateest)}}</a>)
+                                </span>
+                            @endif
+                        </h6>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @if(!!$latestVitals)
+                            @include('app.patient.partials.latest-vitals', ['patient' => $patient, 'point' => $latestVitals])
+                        @else
+                            <div class="text-secondary">Nothing here yet</div>
+                        @endif
+                    </div>
                 </div>
 
             </div>
@@ -208,7 +271,7 @@
                 @include('app/patient/partials/medical-team')
 
                 {{-- canvas based dx --}}
-                <div class="pt-2 mt-2 border-top">
+                {{-- <div class="pt-2 mt-2 border-top">
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Current Problems / Focus Areas</h6>
                         <span class="mx-2 text-secondary">|</span>
@@ -217,8 +280,31 @@
                     <div class="bg-light border p-2 mb-3">
                         @include('app.patient.canvas-sections.dx.summary')
                     </div>
+                </div> --}}
+
+                <!-- probs - point -->
+                <?php
+                $problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEM");
+                ?>
+                <div class="pt-2 mt-2">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Current Problems / Focus Areas</h6>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @foreach($problems as $problem)
+                            <div class="mb-1">
+                                <b><?= !!@($problem->data->name) ? @($problem->data->name) : '-' ?></b>
+                                <?= !!@($problem->data->icd) ? '/&nbsp;' . @($problem->data->icd) : '' ?>
+                                <?= !!@($problem->data->description) ? '/&nbsp;' . @($problem->data->description) : '' ?>
+                            </div>
+                        @endforeach
+                        @if(!count($problems))
+                            <div class="text-secondary">Nothing here yet</div>
+                        @endif
+                    </div>
                 </div>
 
+
                 {{--<div class="mt-2">
                     <div class="d-flex align-items-center mb-2 py-2 border-top border-bottom">
                         <h6 class="my-0 font-weight-bold text-secondary">History</h6>
@@ -231,7 +317,7 @@
                 </div>--}}
 
                 {{-- history_medical --}}
-                <div class="pt-2 mt-2 border-top">
+                {{-- <div class="pt-2 mt-2 border-top">
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Medical History</h6>
                         <span class="mx-2 text-secondary">|</span>
@@ -240,10 +326,20 @@
                     <div class="bg-light border p-2 mb-3">
                         @include('app.patient.canvas-sections.pmhx.summary')
                     </div>
+                </div> --}}
+
+                <!-- pmhx - point -->
+                <div class="pt-2 mt-2">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Medical History</h6>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @include('app.patient.segment-templates.past_medical_history.summary', compact('patient'))
+                    </div>
                 </div>
 
                 {{-- history_surgical --}}
-                <div class="mt-2">
+                {{-- <div class="mt-2">
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Surgical History</h6>
                         <span class="mx-2 text-secondary">|</span>
@@ -252,10 +348,20 @@
                     <div class="bg-light border p-2 mb-3">
                         @include('app.patient.canvas-sections.pshx.summary')
                     </div>
+                </div> --}}
+
+                <!-- pshx - point -->
+                <div class="pt-2 mt-2">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Surgical History</h6>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @include('app.patient.segment-templates.history_surgical.summary', compact('patient'))
+                    </div>
                 </div>
 
                 {{-- history_family --}}
-                <div class="mt-2">
+                {{-- <div class="mt-2">
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Family History</h6>
                         <span class="mx-2 text-secondary">|</span>
@@ -264,10 +370,20 @@
                     <div class="bg-light border p-2 mb-3">
                         @include('app.patient.canvas-sections.fhx.summary')
                     </div>
+                </div> --}}
+
+                <!-- fhx - point -->
+                <div class="pt-2 mt-2">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Family History</h6>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @include('app.patient.segment-templates.history_family.summary', compact('patient'))
+                    </div>
                 </div>
 
                 {{-- history_social --}}
-                <div class="mt-2">
+                {{-- <div class="mt-2">
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Social History</h6>
                         <span class="mx-2 text-secondary">|</span>
@@ -276,6 +392,16 @@
                     <div class="bg-light border p-2 mb-3">
                         @include('app.patient.canvas-sections.sochx.summary')
                     </div>
+                </div> --}}
+
+                <!-- sochx - point -->
+                <div class="pt-2 mt-2">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Social History</h6>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @include('app.patient.segment-templates.history_social.summary', compact('patient'))
+                    </div>
                 </div>
 
                 {{-- history_ob_and_preg --}}
@@ -656,7 +782,7 @@
                 {{--@include('app/patient/partials/care-team')--}}
 
                 {{-- canvas based dx --}}
-                <div class="pt-2 mt-2 border-top">
+                {{-- <div class="pt-2 mt-2 border-top">
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Care Team</h6>
                         <span class="mx-2 text-secondary">|</span>
@@ -665,6 +791,28 @@
                     <div class="bg-light border p-2 mb-3">
                         @include('app.patient.canvas-sections.care-team.summary')
                     </div>
+                </div> --}}
+
+                <!-- careteam - point -->
+                <?php
+                $careTeamMembers = \App\Models\Point::getPointsOfCategory($patient, "CARE_TEAM_MEMBER");
+                ?>
+                <div class="pt-2 mt-2">
+                    <div class="d-flex align-items-center pb-2">
+                        <h6 class="my-0 font-weight-bold text-secondary">Care Team</h6>
+                    </div>
+                    <div class="bg-light border p-2 mb-3">
+                        @foreach($careTeamMembers as $careTeamMember)
+                            <div class="mb-1">
+                                <b><?= !!@($careTeamMember->data->name) ? @($careTeamMember->data->name) : '-' ?></b>
+                                <?= !!@($careTeamMember->data->spacialty) ? '/&nbsp;' . @($careTeamMember->data->spacialty) . '<br>' : '' ?>
+                                <?= !!@($careTeamMember->data->organization) ? '/&nbsp;' . @($careTeamMember->data->organization) . '<br>' : '' ?>
+                            </div>
+                        @endforeach
+                        @if(!count($careTeamMembers))
+                            <div class="text-secondary">Nothing here yet</div>
+                        @endif
+                    </div>
                 </div>
             </div>
         </div>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 588 - 789
resources/views/app/patient/note/dashboard.blade.php


+ 10 - 0
resources/views/app/patient/note/dashboard_script.blade.php

@@ -16,6 +16,16 @@
                         return false;
                     });
 
+                $(document)
+                    .off('mouseenter', '[data-non-segment-section]')
+                    .on('mouseenter', '[data-non-segment-section]', function(){
+                        $('.note-tree-node').removeClass('hovered');
+                        let target = $('.note-tree-node a[data-non-segment-target="' + $(this).attr('data-non-segment-section') + '"]');
+                        target.parent().addClass('hovered');
+                        target.parent().parents('.note-tree-node').addClass('hovered');
+                        return false;
+                    });
+
                 $(document)
                     .off('mouseleave', '.note-section')
                     .on('mouseleave', '.note-section', () => {

+ 23 - 26
resources/views/app/patient/note/segment.blade.php

@@ -53,32 +53,29 @@
 
     <?php endif ?>
 
-</div>
-
-<!-- popup hack for LS segments -->
-<?php if(strpos($segment->segmentTemplate->internal_name, 'lifestyle_') === 0): ?>
-<div class="stag-popup stag-popup-md"
-     stag-popup-key="segment-popup-<?= $segment->segmentTemplate->internal_name ?>">
-    <div class="stag-popup-content">
-        <h3 class="stag-popup-title m-neg-3 px-3 mt-0 pb-3 border-bottom mb-3 pt-1">
-            <span class="d-inline-flex align-items-center">
-                @if($segment->subheading)
-                    {{$segment->subheading}}
-                    <i class="text-secondary text-sm fa fa-arrow-right mx-2"></i>
-                @endif
-                {{$segment->display_title}}
-            </span>
-
-            <a href="#" class="ml-auto text-secondary" onclick="return closeStagPopup()">
-                <i class="fa fa-times-circle"></i>
-            </a>
-        </h3>
-{{--        <div class="ls-segment-summary-html">--}}
-{{--            {!! $segment->summary_html !!}--}}
-{{--        </div>--}}
-        <div class="ls-segment-edit-html">
-            {!! $segment->edit_html !!}
+    <!-- popup hack for LS segments -->
+    <?php if(strpos($segment->segmentTemplate->internal_name, 'lifestyle_') === 0): ?>
+    <div class="stag-popup stag-popup-md"
+         stag-popup-key="segment-popup-<?= $segment->segmentTemplate->internal_name ?>">
+        <div class="stag-popup-content">
+            <h3 class="stag-popup-title m-neg-3 px-3 mt-0 pb-3 border-bottom mb-3 pt-1">
+                <span class="d-inline-flex align-items-center">
+                    @if($segment->subheading)
+                        {{$segment->subheading}}
+                        <i class="text-secondary text-sm fa fa-arrow-right mx-2"></i>
+                    @endif
+                    {{$segment->display_title}}
+                </span>
+                <a href="#" class="ml-auto text-secondary" onclick="return closeStagPopup()">
+                    <i class="fa fa-times-circle"></i>
+                </a>
+            </h3>
+            <div class="ls-segment-edit-html">
+                {!! $segment->edit_html !!}
+            </div>
         </div>
     </div>
+    <?php endif ?>
+
 </div>
-<?php endif ?>
+

+ 51 - 2
resources/views/app/patient/note/segment_script.blade.php

@@ -3,8 +3,57 @@
 
         function updateAllSegmentsInResponse(_response) {
             if(!hasResponseError(_response)) {
-                for (let i=0; i<_response.data.length; i++) {
-                    updateSegmentFromObject(_response.data[i]);
+
+                // refresh primary segment (where uid is _response.data.uid)
+                if(_response.data && _response.data.uid) {
+                    updateSegmentByUid(_response.data.uid, _response.data.summaryHtml, _response.data.editHtml);
+                }
+
+                // refresh listening segments
+                if(_response.data && _response.data.listenerSegmentUids && _response.data.listenerSegmentUids.length) {
+                    for (let i=0; i<_response.data.listenerSegmentUids.length; i++) {
+                        let listenerSegment = $('.note-section[data-segment-uid="' + _response.data.listenerSegmentUids[i] + '"]');
+                        let listenerSegmentTemplateName = listenerSegment.attr('data-segment-template-name');
+                        if(listenerSegment && listenerSegment.length) {
+                            $.post('/api/visit/updateSegmentHtml', {
+                                segmentUid: _response.data.listenerSegmentUids[i]
+                            }, _data => {
+                                updateAllSegmentsInResponse(_data);
+
+                                // TODO: remove this ugliness
+                                if(listenerSegmentTemplateName === 'medrisk_vigilence') {
+                                    toastr.info('Medrisk Vigilance Updated', null, { timeOut: 10000 });
+                                }
+
+                            }, 'json');
+                        }
+                    }
+                }
+            }
+        }
+
+        function updateSegmentByUid(_uid, _summaryHtml, _editHtml) {
+            let segment = $('.note-section[data-segment-uid="' + _uid + '"]');
+            if(segment && segment.length) {
+                segment.find('.summary-container').html(_summaryHtml);
+                segment.find('.edit-container').html(_editHtml);
+
+                // special case for lifestyle
+                let popupContainer = $('[stag-popup-key="segment-popup-' + segment.attr('data-segment-template-name') + '"] .ls-segment-edit-html');
+                if(popupContainer.length) {
+                    popupContainer.html(_editHtml);
+                }
+
+                initRTEs(segment);
+                initSegmentMoes(segment);
+                initMoes();
+                initStagSuggest();
+                if(window.segmentInitializers) {
+                    let internalName = segment.attr('data-segment-template-name');
+                    if(window.segmentInitializers.hasOwnProperty(internalName) &&
+                        typeof window.segmentInitializers[internalName] === 'function') {
+                        window.segmentInitializers[internalName].call(window);
+                    }
                 }
             }
         }

+ 126 - 0
resources/views/app/patient/partials/latest-vitals.blade.php

@@ -0,0 +1,126 @@
+<?php
+
+use App\Models\Point;
+
+$category = 'VITALS';
+$endPoint = 'upsertNoteSingleton';
+
+$vitalLabels = [
+    "heightInInches" => "Ht. (in.)",
+    "weightPounds" => "Wt. (lbs.)",
+    "temperatureF" => "Temp. (F)",
+    "systolicBP" => "SBP",
+    "diastolicBP" => "DBP",
+    "pulseRatePerMinute" => "Pulse",
+    "respirationRatePerMinute" => "Resp.",
+    "pulseOx" => "Pulse Ox.",
+    "smokingStatus" => "Smoking Status",
+    "bmi" => "BMI (kg/m²)",
+];
+
+$contentData = null;
+if (!!@$point->data) {
+    $contentData = json_decode($point->data, true);
+}
+
+if(!$contentData) {
+    $contentData = [
+        "heightInInches" => [
+            "label" => "Ht. (in.)",
+            "value" => "",
+            "date" => "",
+        ],
+        "weightPounds" => [
+            "label" => "Wt. (lbs.)",
+            "value" => "",
+            "date" => "",
+        ],
+        "temperatureF" => [
+            "label" => "Temp. (F)",
+            "value" => "",
+            "date" => "",
+        ],
+        "systolicBP" => [
+            "label" => "SBP",
+            "value" => "",
+            "date" => "",
+        ],
+        "diastolicBP" => [
+            "label" => "DBP",
+            "value" => "",
+            "date" => "",
+        ],
+        "pulseRatePerMinute" => [
+            "label" => "Pulse",
+            "value" => "",
+            "date" => "",
+        ],
+        "respirationRatePerMinute" => [
+            "label" => "Resp.",
+            "value" => "",
+            "date" => "",
+        ],
+        "pulseOx" => [
+            "label" => "Pulse Ox.",
+            "value" => "",
+            "date" => "",
+        ],
+        "smokingStatus" => [
+            "label" => "Smoking Status",
+            "value" => "",
+            "date" => "",
+        ],
+        "bmi" => [
+            "label" => "BMI (kg/m²)",
+            "value" => "",
+            "date" => "",
+        ],
+    ];
+}else {
+    foreach ($vitalLabels as $k => $v) {
+        if (!isset($contentData[$k])) {
+            $contentData[$k] = [
+                "label" => $v,
+                "value" => "",
+                "date" => "",
+            ];
+        }
+    }
+}
+?>
+
+@foreach ($vitalLabels as $k => $v)
+<div class="d-flex vital-item align-items-center">
+        <span class="content-html text-nowrap">
+            <span>{{$v}}:</span>
+            <?php
+            $vital = [];
+            if(isset($contentData[$k])) {
+                $vital = $contentData[$k];
+            }
+            ?>
+            <b>{{ isset($vital["value"]) && !empty($vital["value"]) ? $vital["value"] : '-' }}</b>
+            @if($k === 'bmi' && isset($vital["value"]) && !empty($vital["value"]))
+                <?php $bmi = floatval($vital["value"]); ?>
+                <span class="ml-2 py-1 m-0 font-weight-bold">
+                     @if($bmi < 18.5)
+                        <span class="text-sm text-warning-mellow">(Underweight)</span>
+                     @endif
+                    @if($bmi >= 18.5 && $bmi < 25)
+                        <span class="text-sm text-success">(Healthy Weight)</span>
+                    @endif
+                    @if($bmi >= 25 && $bmi < 30)
+                        <span class="text-sm text-warning-mellow">(Overweight)</span>
+                    @endif
+                    @if($bmi >= 30)
+                        <span class="text-sm text-warning-mellow">(Obese)</span>
+                    @endif
+                </span>
+            @endif
+            @if(!!$vital["date"])
+                <span class="font-weight-normal text-secondary ml-2 text-sm">(as on {{ friendly_date_time($vital["date"], false) }})</span>
+            @endif
+        </span>
+</div>
+@endforeach
+

+ 12 - 33
resources/views/app/patient/prescriptions/drug-form.blade.php

@@ -1,44 +1,25 @@
 <div class="stag-popup stag-popup-sm mcp-theme-1" stag-popup-key="prescription-popup-DRUG">
-    <form method="POST" action="">
+    <form method="POST" action="" class="overflow-visible">
         <h3 class="stag-popup-title mb-2">
             <span>Drug Prescription</span>
             <a href="#" class="ml-auto text-secondary"
                onclick="return closeStagPopup()"><i class="fa fa-times-circle"></i></a>
         </h3>
+
+        <input type="hidden" data-name="medId">
+        <input type="hidden" data-name="routedMedId">
+        <input type="hidden" data-name="routedDosageFormMedId">
+        <input type="hidden" data-name="gcnSeqno">
+
         <div class="mb-2">
             <label class="text-sm text-secondary mb-1">Drug</label>
             <input type="text" class="form-control form-control-sm min-width-unset prescription-medication"
                    stag-suggest
-                   stag-suggest-ep="/fdb-med-suggest/json">
+                   stag-suggest-ep="/fdb-med-suggest-v2/json">
         </div>
+
         <div class="row">
-            <div class="col-6 pr-0">
-                <div class="mb-2">
-                    <label class="text-sm text-secondary mb-1">Route</label>
-                    <select class="form-control form-control-sm min-width-unset prescription-route"
-                            disabled>
-                    </select>
-                </div>
-            </div>
-            <div class="col-6">
-                <div class="mb-2">
-                    <label class="text-sm text-secondary mb-1">Dosage</label>
-                    <select class="form-control form-control-sm min-width-unset prescription-dose"
-                            disabled>
-                    </select>
-                </div>
-            </div>
-        </div>
-        <div class="row">
-            <div class="col-6 pr-0">
-                <div class="mb-2">
-                    <label class="text-sm text-secondary mb-1">Strength</label>
-                    <select class="form-control form-control-sm min-width-unset prescription-strength"
-                            disabled>
-                    </select>
-                </div>
-            </div>
-            <div class="col-6">
+            <div class="col-4 pr-0">
                 <div class="mb-2">
                     <label class="text-sm text-secondary mb-1">Frequency</label>
                     <input type="text" class="form-control form-control-sm min-width-unset"
@@ -50,16 +31,14 @@
                     </div>
                 </div>
             </div>
-        </div>
-        <div class="row">
-            <div class="col-6 pr-0">
+            <div class="col-4 pr-0">
                 <div class="mb-2">
                     <label class="text-sm text-secondary mb-1">Dispense</label>
                     <input type="text" class="form-control form-control-sm min-width-unset"
                            v-model="currentPrescription_DRUG.clinicalDetailJson.dispense">
                 </div>
             </div>
-            <div class="col-6">
+            <div class="col-4">
                 <div class="mb-2">
                     <label class="text-sm text-secondary mb-1">Refills</label>
                     <input type="text" class="form-control form-control-sm min-width-unset"

+ 1 - 913
resources/views/app/patient/prescriptions/index.blade.php

@@ -1,917 +1,5 @@
 @extends ('layouts.patient')
 
 @section('inner-content')
-    <div id="prescriptions-{{$patient->id}}">
-        <div class="d-flex align-items-baseline py-2">
-            <h6 class="my-0 font-weight-bold text-secondary font-size-14">Prescriptions</h6>
-            <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newPrescription('DRUG')">+ Drug</a>
-            <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newPrescription('LAB')">+ Lab</a>
-            <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newPrescription('IMAGING')">+ Imaging</a>
-            <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newPrescription('REFERRAL')">+ Referral</a>
-            <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newPrescription('SUPPLY')">+ Supply</a>
-            <span class="mx-2 text-secondary on-hover-opaque">|</span>
-            <a href="#" v-on:click.prevent="newPrescription('OTHER')">+ Other</a>
-        </div>
-        <div class="d-flex align-items-start">
-            <table class="table table-striped table-sm table-bordered mb-0 flex-grow-1">
-                <thead>
-                <tr>
-                    <th class="px-2 text-secondary border-bottom-0">Created</th>
-                    <th class="px-2 text-secondary border-bottom-0">Type</th>
-                    <th class="px-2 text-secondary border-bottom-0">Clinical</th>
-                    <th class="px-2 text-secondary border-bottom-0">Prescriber</th>
-                    <th class="px-2 text-secondary border-bottom-0">Sign</th>
-                </tr>
-                </thead>
-                <tbody>
-                <tr v-for="(prescription, index) in prescriptions" :class="currentPrescription && currentPrescription.id === prescription.id ? 'bg-aliceblue' : ''">
-                    <td class="px-2">
-                        <a href="#" v-on:click.prevent="currentPrescription=prescription"
-                           :class="currentPrescription && currentPrescription.id === prescription.id ? 'font-weight-bold' : ''">@{{prescription.created_at_friendly_short}}</a>
-                    </td>
-                    <td class="px-2">@{{prescription.erx_category}}</td>
-                    <td class="px-2">
-                        <div class="d-flex align-items-baseline">
-                            {{--
-                            <a v-if="!prescription.has_hcp_pro_signed" class="mr-2" href="#" v-on:click.prevent="editClinicalDetails(prescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
-                            <span v-else class="mr-2" title="Cannot edit. Prescription already signed."><i class="fa fa-edit on-hover-opaque text-secondary"></i></span>
-                            --}}
-                            <div v-if="prescription.clinical_detail_json" class="d-inline-flex align-items-baseline">
-                                <div class="d-flex align-items-baseline" v-if="prescription.erx_category === 'DRUG'">
-                                    <b class="mr-2">@{{prescription.clinical_detail_json.medication ?? '-'}}</b>
-                                    <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.strength ?? '-'}}</span>
-                                    <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.amount ?? '-'}}</span>
-                                    <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.route ?? '-'}}</span>
-                                </div>
-                                <div class="d-flex align-items-baseline" v-if="prescription.erx_category === 'LAB' || prescription.erx_category === 'IMAGING'">
-                                    <b class="mr-2">@{{prescription.clinical_detail_json.test ?? '-'}}</b>
-                                    <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.icds ?? '-'}}</span>
-                                </div>
-                                <div class="d-flex align-items-baseline" v-if="prescription.erx_category === 'REFERRAL'">
-                                    <b class="mr-2">@{{prescription.clinical_detail_json.to ?? '-'}}</b>
-                                    <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.memo ?? '-'}}</span>
-                                </div>
-                                <div class="d-flex align-items-baseline" v-if="prescription.erx_category === 'SUPPLY'">
-                                    <b class="mr-2">@{{prescription.clinical_detail_json.item ?? '-'}}</b>
-                                    <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.quantity ?? '-'}}</span>
-                                </div>
-                                <div class="d-flex align-items-baseline" v-if="prescription.erx_category === 'OTHER'">
-                                    <b class="mr-2">@{{prescription.clinical_detail_json.title ?? '-'}}</b>
-                                    <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.memo ?? '-'}}</span>
-                                </div>
-                            </div>
-                            <div v-else>-</div>
-                        </div>
-                    </td>
-                    <td class="px-2">
-                        <div class="d-flex align-items-baseline">
-                            {{--
-                            <a v-if="!prescription.has_hcp_pro_signed" class="mr-2" href="#" v-on:click.prevent="editHcpPro(prescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
-                            <span v-else class="mr-2" title="Cannot edit. Prescription already signed."><i class="fa fa-edit on-hover-opaque text-secondary"></i></span>
-                            --}}
-                            <div>@{{prescription.hcpProDisplayName}}</div>
-                        </div>
-                    </td>
-                    <td class="px-2">
-                        <div v-if="prescription.has_hcp_pro_signed" class="d-flex align-items-baseline">
-                            <i class="text-secondary fa fa-check mr-1"></i>
-                            <span class="text-secondary">Signed</span>
-                        </div>
-                        {{--
-                        <div v-else>
-                            <a v-if="prescription.hcp_pro_id === {{$pro->id}}"
-                               href="#"
-                               v-on:click.prevent="signAsHcpPro(prescription)">Sign</a>
-                            <span v-else>-</span>
-                        </div>
-                        --}}
-                    </td>
-                </tr>
-                </tbody>
-            </table>
-            <div v-if="currentPrescription" class="min-width-500px ml-2 border align-self-stretch p-3">
-                <div class="d-flex align-items-center">
-                    <h3 class="font-size-16 m-0">
-                        <div v-if="currentPrescription.clinical_detail_json" class="d-inline-flex align-items-baseline">
-                            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'DRUG'">
-                                <b class="mr-2 font-size-16">@{{currentPrescription.clinical_detail_json.medication ?? '-'}}</b>
-                                <!--<span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.strength ?? '-'}}</span>
-                                <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.amount ?? '-'}}</span>
-                                <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.route ?? '-'}}</span>-->
-                            </div>
-                            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'LAB' || currentPrescription.erx_category === 'IMAGING'">
-                                <b class="mr-2 font-size-16">@{{currentPrescription.clinical_detail_json.test ?? '-'}}</b>
-                                <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.icds ?? '-'}}</span>
-                            </div>
-                            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'REFERRAL'">
-                                <b class="mr-2 font-size-16">@{{currentPrescription.clinical_detail_json.to ?? '-'}}</b>
-                                <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.memo ?? '-'}}</span>
-                            </div>
-                            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'SUPPLY'">
-                                <b class="mr-2 font-size-16">@{{currentPrescription.clinical_detail_json.item ?? '-'}}</b>
-                                <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.quantity ?? '-'}}</span>
-                            </div>
-                            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'OTHER'">
-                                <b class="mr-2 font-size-16">@{{currentPrescription.clinical_detail_json.title ?? '-'}}</b>
-                                <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.memo ?? '-'}}</span>
-                            </div>
-                        </div>
-                        <div v-else>-</div>
-                    </h3>
-                    <a class="ml-auto" href="#" v-on:click.prevent="currentPrescription=null">
-                        <i class="fa fa-times-circle on-hover-opaque"></i>
-                    </a>
-                </div>
-                <hr class="my-3">
-                <div class="pb-2 d-flex align-items-center">
-                    <span class="min-width-140px text-secondary text-sm">Created</span>
-                    <span>@{{currentPrescription.created_at_friendly}}</span>
-                </div>
-                <div class="pb-2 d-flex align-items-center">
-                    <span class="min-width-140px text-secondary text-sm">Type</span>
-                    <span>@{{currentPrescription.erx_category}}</span>
-                </div>
-                <div class="pb-2 d-flex align-items-center">
-                    <span class="min-width-140px text-secondary text-sm">Clinical</span>
-                    <div class="d-inline-flex align-items-baseline flex-grow-1">
-                        <a v-if="!currentPrescription.has_hcp_pro_signed" class="mr-2" href="#" v-on:click.prevent="editClinicalDetails(currentPrescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
-                        <span v-else class="mr-2" title="Cannot edit. Prescription already signed."><i class="fa fa-edit on-hover-opaque text-secondary"></i></span>
-                        <div v-if="currentPrescription.clinical_detail_json" class="d-inline-flex align-items-baseline">
-                            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'DRUG'">
-                                <b class="mr-2">@{{currentPrescription.clinical_detail_json.medication ?? '-'}}</b>
-                                <!--<span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.strength ?? '-'}}</span>
-                                <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.dispense ?? '-'}}</span>
-                                <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.refills ?? '-'}}</span>-->
-                            </div>
-                            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'LAB' || currentPrescription.erx_category === 'IMAGING'">
-                                <b class="mr-2">@{{currentPrescription.clinical_detail_json.test ?? '-'}}</b>
-                                <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.icds ?? '-'}}</span>
-                            </div>
-                            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'REFERRAL'">
-                                <b class="mr-2">@{{currentPrescription.clinical_detail_json.to ?? '-'}}</b>
-                                <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.memo ?? '-'}}</span>
-                            </div>
-                            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'SUPPLY'">
-                                <b class="mr-2">@{{currentPrescription.clinical_detail_json.item ?? '-'}}</b>
-                                <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.quantity ?? '-'}}</span>
-                            </div>
-                            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'OTHER'">
-                                <b class="mr-2">@{{currentPrescription.clinical_detail_json.title ?? '-'}}</b>
-                                <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.memo ?? '-'}}</span>
-                            </div>
-                        </div>
-                        <div v-else>-</div>
-                    </div>
-                </div>
-                <div class="pb-2 d-flex align-items-center">
-                    <span class="min-width-140px text-secondary text-sm">Logistics</span>
-                    <div class="d-inline-flex align-items-baseline flex-grow-1">
-                        <a class="mr-2" href="#" v-on:click.prevent="editLogisticsDetails(currentPrescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
-                        <div v-if="currentPrescription.logistics_detail_json" class="d-flex align-items-baseline">
-                            <div class="d-flex align-items-baseline">
-                                <b class="mr-2">@{{currentPrescription.logistics_detail_json.facilityName ?? '-'}}</b>
-                                <span class="text-secondary mr-1">@{{currentPrescription.logistics_detail_json.facilityCity ?? '-'}}</span>
-                                <span class="text-secondary mr-1">@{{currentPrescription.logistics_detail_json.facilityState ?? '-'}}</span>
-                            </div>
-                        </div>
-                        <div v-else>-</div>
-                    </div>
-                </div>
-                <div class="pb-2 d-flex align-items-center">
-                    <span class="min-width-140px text-secondary text-sm">HCP Pro</span>
-                    <div class="d-inline-flex align-items-baseline flex-grow-1">
-                        <a v-if="!currentPrescription.has_hcp_pro_signed" class="mr-2" href="#" v-on:click.prevent="editHcpPro(currentPrescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
-                        <span v-else class="mr-2" title="Cannot edit. Prescription already signed."><i class="fa fa-edit on-hover-opaque text-secondary"></i></span>
-                        <div>@{{currentPrescription.hcpProDisplayName}}</div>
-                    </div>
-                </div>
-                <div class="pb-2 d-flex align-items-center">
-                    <span class="min-width-140px text-secondary text-sm">Sign</span>
-                    <div v-if="currentPrescription.has_hcp_pro_signed" class="d-inline-flex align-items-baseline">
-                        <i class="text-secondary fa fa-check mr-1"></i>
-                        <span class="text-secondary">Signed</span>
-                    </div>
-                    <div v-else>
-                        <a v-if="currentPrescription.hcp_pro_id === {{$pro->id}}"
-                           href="#"
-                           v-on:click.prevent="signAsHcpPro(currentPrescription)">Sign</a>
-                        <span v-else>-</span>
-                    </div>
-                </div>
-                <div class="pb-2 d-flex align-items-center">
-                    <span class="min-width-140px text-secondary text-sm">Pro Status</span>
-                    <div class="d-inline-flex align-items-baseline">
-                        <a class="mr-2" href="#" v-on:click.prevent="editProStatus(currentPrescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
-                        <div v-if="currentPrescription.pro_declared_status" class="d-flex align-items-baseline">
-                            @{{ sanitizeStatus(currentPrescription.pro_declared_status) }}
-                        </div>
-                        <div v-else>-</div>
-                    </div>
-                </div>
-                <div class="pb-2 d-flex align-items-center">
-                    <span class="min-width-140px text-secondary text-sm">Client Status</span>
-                    <div class="d-inline-flex align-items-baseline">
-                        <a class="mr-2" href="#" v-on:click.prevent="editClientStatus(currentPrescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
-                        <div v-if="currentPrescription.client_declared_status" class="d-flex align-items-baseline">
-                            @{{ sanitizeStatus(currentPrescription.client_declared_status) }}
-                        </div>
-                        <div v-else>-</div>
-                    </div>
-                </div>
-                <div class="pb-2 d-flex align-items-center">
-                    <span class="min-width-140px text-secondary text-sm">PDF</span>
-                    <div class="d-inline-flex align-items-baseline">
-                        <a class="pdf-viewer-trigger" native target="_blank"
-                           :href="'/prescription-download-as-pdf/' + currentPrescription.uid">View</a>
-                        <span class="mx-2 text-secondary">|</span>
-                        <a native target="_blank"
-                           :href="'/prescription-download-as-pdf/' + currentPrescription.uid">Download</a>
-                        <span class="mx-2 text-secondary">|</span>
-                        <a href="#" v-on:click.prevent="transmit(currentPrescription)">Transmit</a>
-                    </div>
-                </div>
-            </div>
-        </div>
-        @include('app.patient.prescriptions.drug-form')
-        @include('app.patient.prescriptions.lab-form')
-        @include('app.patient.prescriptions.imaging-form')
-        @include('app.patient.prescriptions.referral-form')
-        @include('app.patient.prescriptions.supply-form')
-        @include('app.patient.prescriptions.other-form')
-        @include('app.patient.prescriptions.logistics-form')
-        @include('app.patient.prescriptions.hcp-pro-form')
-        @include('app.patient.prescriptions.sign-as-hcp-form')
-        @include('app.patient.prescriptions.pro-status-form')
-        @include('app.patient.prescriptions.client-status-form')
-        @include('app.patient.prescriptions.transmit-form')
-    </div>
-    <script>
-        (function() {
-
-            <?php
-            $prescriptions = $patient->prescriptions;
-            $currentPrescription = null;
-            foreach ($prescriptions as $prescription) {
-                if($prescription->clinical_detail_json) {
-                    $prescription->clinical_detail_json = json_decode($prescription->clinical_detail_json);
-                }
-                if($prescription->logistics_detail_json) {
-                    $prescription->logistics_detail_json = json_decode($prescription->logistics_detail_json);
-                }
-                $prescription->created_at_friendly = friendlier_date_time($prescription->created_at);
-                $prescription->created_at_friendly_short = friendlier_date_time($prescription->created_at, false);
-                $prescription->hcpProDisplayName = $prescription->hcpPro ? $prescription->hcpPro->displayName() : '-';
-                $prescription->hcpProUid = $prescription->hcpPro ? $prescription->hcpPro->uid : '';
-
-                if(!!@$currentErx && $currentErx->uid === $prescription->uid) {
-                    $currentPrescription = $prescription;
-                }
-            }
-            ?>
-
-            function init() {
-
-                new Vue({
-                    el: '#prescriptions-{{$patient->id}}',
-                    delimiters: ['@{{', '}}'],
-                    data: {
-                        prescriptions: <?= json_encode($prescriptions) ?>,
-
-                        currentPrescriptionAction: '',
-                        currentPrescriptionType: '',
-
-                        // selected
-                        currentPrescription:  <?= $currentPrescription ? json_encode($currentPrescription) : 'null' ?>,
-
-                        // for editing clinical details
-                        currentPrescription_DRUG: {
-                            noteUid: null, // TODO: this won't be null if created from a note
-                            clientUid: '{{ $patient->uid }}',
-                            replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
-                            hcpProUid: '{{$pro->uid}}',
-                            erxCategory: 'DRUG',
-                            clinicalDetailJson: {
-                                medication: '',
-                                route: '',
-                                dose: '',
-                                strength: '',
-                                frequency: '',
-                                dispense: '',
-                                refills: '',
-                                purpose: '',
-
-                                // fdb specific
-                                medNameID: '',
-                                routedMedID: '',
-                                dosageFormMedID: '',
-                                gcnSeqno: '',
-                                medId: '',
-                            }
-                        },
-                        currentPrescription_LAB: {
-                            noteUid: null, // TODO: this won't be null if created from a note
-                            clientUid: '{{ $patient->uid }}',
-                            replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
-                            hcpProUid: '{{$pro->uid}}',
-                            erxCategory: 'LAB',
-                            clinicalDetailJson: {
-                                test: '',
-                                icds: '',
-                                memo: '',
-                            }
-                        },
-                        currentPrescription_IMAGING: {
-                            noteUid: null, // TODO: this won't be null if created from a note
-                            clientUid: '{{ $patient->uid }}',
-                            replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
-                            hcpProUid: '{{$pro->uid}}',
-                            erxCategory: 'IMAGING',
-                            clinicalDetailJson: {
-                                test: '',
-                                icds: '',
-                                memo: '',
-                            }
-                        },
-                        currentPrescription_REFERRAL: {
-                            noteUid: null, // TODO: this won't be null if created from a note
-                            clientUid: '{{ $patient->uid }}',
-                            replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
-                            hcpProUid: '{{$pro->uid}}',
-                            erxCategory: 'REFERRAL',
-                            clinicalDetailJson: {
-                                to: '',
-                                memo: '',
-                            }
-                        },
-                        currentPrescription_SUPPLY: {
-                            noteUid: null, // TODO: this won't be null if created from a note
-                            clientUid: '{{ $patient->uid }}',
-                            replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
-                            hcpProUid: '{{$pro->uid}}',
-                            erxCategory: 'SUPPLY',
-                            clinicalDetailJson: {
-                                item: '',
-                                quantity: '',
-                                memo: '',
-                            }
-                        },
-                        currentPrescription_OTHER: {
-                            noteUid: null, // TODO: this won't be null if created from a note
-                            clientUid: '{{ $patient->uid }}',
-                            replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
-                            hcpProUid: '{{$pro->uid}}',
-                            erxCategory: 'OTHER',
-                            clinicalDetailJson: {
-                                title: '',
-                                memo: '',
-                            }
-                        },
-
-                        // for editing logistics - common
-                        currentPrescriptionLogistics: {
-                            uid: '',
-                            logisticsDetailJson: {
-                                facilityName: '',
-                                facilityCity: '',
-                                facilityState: '',
-                                facilityAddressMemo: '',
-                                facilityPhone: '',
-                                facilityFax: '',
-                                facilityZip: '',
-                            }
-                        },
-
-                        // for editing hcp, sign, pro status & client status - common
-                        currentPrescriptionHcpPro: {
-                            uid: '',
-                            newHcpProUid: '',
-                        },
-                        currentPrescriptionSign: {
-                            uid: '',
-                            declaredVersionNumber: '',
-                        },
-                        currentPrescriptionProStatus: {
-                            uid: '',
-                            status: '',
-                            memo: '',
-                        },
-                        currentPrescriptionClientStatus: {
-                            uid: '',
-                            status: '',
-                            memo: '',
-                        },
-                        currentPrescriptionTransmit: {
-                            uid: '',
-                            logistics: '',
-                            toWho: '',
-                            toEmail: '',
-                            toFaxNumber: '',
-                            toFaxNumberAttentionLine: '',
-                            toFaxNumberCoverSheetMemo: '',
-                            copyToPatient: false,
-                            copyToPatientFaxNumber: '',
-                            copyToPatientEmail: '',
-                        }
-                    },
-                    methods: {
-
-                        // new/edit/save-clinical
-                        newPrescription: function(_type) {
-                            this.currentPrescriptionAction = 'ADD';
-                            this.currentPrescriptionType = _type;
-                            switch (_type) {
-                                case 'DRUG':
-                                    this.currentPrescription_DRUG = {
-                                        noteUid: null, // TODO: this won't be null if created from a note
-                                        clientUid: '{{ $patient->uid }}',
-                                        replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
-                                        hcpProUid: '{{$pro->uid}}',
-                                        erxCategory: _type,
-                                        clinicalDetailJson: {
-                                            medication: '',
-                                            route: '',
-                                            dose: '',
-                                            strength: '',
-                                            frequency: '',
-                                            dispense: '',
-                                            refills: '',
-                                            purpose: '',
-
-                                            // fdb specific
-                                            medNameID: '',
-                                            routedMedID: '',
-                                            dosageFormMedID: '',
-                                            gcnSeqno: '',
-                                            medId: '',
-                                        }
-                                    };
-                                    break;
-                                case 'LAB':
-                                case 'IMAGING':
-                                    this.currentPrescription_LAB = {
-                                        noteUid: null, // TODO: this won't be null if created from a note
-                                        clientUid: '{{ $patient->uid }}',
-                                        replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
-                                        hcpProUid: '{{$pro->uid}}',
-                                        erxCategory: _type,
-                                        clinicalDetailJson: {
-                                            test: '',
-                                            icds: '',
-                                            memo: '',
-                                        }
-                                    };
-                                    break;
-                                case 'REFERRAL':
-                                    this.currentPrescription_LAB = {
-                                        noteUid: null, // TODO: this won't be null if created from a note
-                                        clientUid: '{{ $patient->uid }}',
-                                        replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
-                                        hcpProUid: '{{$pro->uid}}',
-                                        erxCategory: _type,
-                                        clinicalDetailJson: {
-                                            to: '',
-                                            memo: '',
-                                        }
-                                    };
-                                    break;
-                                case 'SUPPLY':
-                                    this.currentPrescription_LAB = {
-                                        noteUid: null, // TODO: this won't be null if created from a note
-                                        clientUid: '{{ $patient->uid }}',
-                                        replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
-                                        hcpProUid: '{{$pro->uid}}',
-                                        erxCategory: _type,
-                                        clinicalDetailJson: {
-                                            item: '',
-                                            quantity: '',
-                                            memo: '',
-                                        }
-                                    };
-                                    break;
-                                case 'OTHER':
-                                    this.currentPrescription_LAB = {
-                                        noteUid: null, // TODO: this won't be null if created from a note
-                                        clientUid: '{{ $patient->uid }}',
-                                        replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
-                                        hcpProUid: '{{$pro->uid}}',
-                                        erxCategory: _type,
-                                        clinicalDetailJson: {
-                                            title: '',
-                                            memo: '',
-                                        }
-                                    };
-                                    break;
-                            }
-                            Vue.nextTick(() => {
-                                showStagPopup('prescription-popup-' + this.currentPrescriptionType, true);
-                                if(_type === 'DRUG') {
-                                    $('[stag-suggest][stag-suggest-initialized]').removeAttr('stag-suggest-initialized');
-                                    initStagSuggest();
-                                    this.initFdbMedSuggest();
-                                }
-                            });
-                        },
-                        editClinicalDetails: function(_prescription) {
-                            this.currentPrescriptionAction = 'EDIT_CLINICAL';
-                            this.currentPrescriptionType = _prescription.erx_category;
-                            this['currentPrescription_' + this.currentPrescriptionType] = {
-                                uid: _prescription.uid,
-                                clinicalDetailJson: JSON.parse(JSON.stringify(_prescription.clinical_detail_json))
-                            };
-                            Vue.nextTick(() => {
-                                showStagPopup('prescription-popup-' + this.currentPrescriptionType, true);
-                                if(this.currentPrescriptionType === 'DRUG') {
-                                    $('[stag-suggest][stag-suggest-initialized]').removeAttr('stag-suggest-initialized');
-                                    initStagSuggest();
-                                    this.initFdbMedSuggest();
-
-                                    // re-populate drug fields
-                                    console.log(this.currentPrescription_DRUG);
-                                    let parentSegment = $('#prescriptions-{{$patient->id}} [stag-popup-key="prescription-popup-DRUG"]>form').first();
-                                    parentSegment.find('input.prescription-medication').val(this.currentPrescription_DRUG.clinicalDetailJson.medication);
-                                    parentSegment.find('select.prescription-route')
-                                        .empty()
-                                        .append($('<option/>').attr('value', 1).text(this.currentPrescription_DRUG.clinicalDetailJson.route))
-                                        .val(1);
-                                    parentSegment.find('select.prescription-dose')
-                                        .empty()
-                                        .append($('<option/>').attr('value', 1).text(this.currentPrescription_DRUG.clinicalDetailJson.dose))
-                                        .val(1);
-                                    parentSegment.find('select.prescription-strength')
-                                        .empty()
-                                        .append($('<option/>').attr('value', 1).text(this.currentPrescription_DRUG.clinicalDetailJson.strength))
-                                        .val(1);
-                                }
-                            });
-                        },
-                        savePrescription: function() {
-                            let payload = JSON.parse(JSON.stringify(this['currentPrescription_' + this.currentPrescriptionType]));
-                            payload.clinicalDetailJson = JSON.stringify(payload.clinicalDetailJson);
-                            switch (this.currentPrescriptionAction) {
-                                case 'ADD':
-                                    $.post('/api/erx/create', payload, _data => {
-                                        if(!hasResponseError(_data)) {
-                                            toastr.success('Prescription added');
-                                            closeStagPopup();
-                                            fastLoad('/patients/view/{{$patient->uid}}/prescriptions/' + this.currentPrescriptionType.toLowerCase() + '/' + _data.data);
-                                        }
-                                    }, 'json');
-                                    break;
-                                case 'EDIT_CLINICAL':
-                                    $.post('/api/erx/updateClinicalDetail', payload, _data => {
-                                        if(!hasResponseError(_data)) {
-                                            toastr.success('Prescription updated');
-                                            closeStagPopup();
-                                            fastReload();
-                                        }
-                                    }, 'json');
-                                    break;
-                            }
-                        },
-
-                        // edit logistics
-                        editLogisticsDetails: function(_prescription) {
-                            this.currentPrescriptionAction = 'EDIT_LOGISTICS';
-                            this.currentPrescriptionLogistics = {
-                                uid: _prescription.uid,
-                                logisticsDetailJson: _prescription.logistics_detail_json ? JSON.parse(JSON.stringify(_prescription.logistics_detail_json)) : {
-                                    facilityName: '',
-                                    facilityCity: '',
-                                    facilityState: '',
-                                    facilityAddressMemo: '',
-                                    facilityPhone: '',
-                                    facilityFax: '',
-                                    facilityZip: '',
-                                }
-                            }
-                            Vue.nextTick(() => {
-                                showStagPopup('logistics-popup', true);
-                            });
-                        },
-                        saveLogistics: function() {
-                            let payload = JSON.parse(JSON.stringify(this.currentPrescriptionLogistics));
-                            payload.logisticsDetailJson = JSON.stringify(payload.logisticsDetailJson);
-                            $.post('/api/erx/updateLogisticsDetail', payload, _data => {
-                                if(!hasResponseError(_data)) {
-                                    toastr.success('Logistics updated');
-                                    closeStagPopup();
-                                    fastReload();
-                                }
-                            }, 'json');
-                        },
-
-                        // edit hcp (ordering) pro
-                        editHcpPro: function(_prescription) {
-                            this.currentPrescriptionAction = 'EDIT_HCP_PRO';
-                            this.currentPrescriptionType = _prescription.erx_category;
-                            this.currentPrescriptionHcpPro = {
-                                uid: _prescription.uid,
-                                newHcpProUid: _prescription.hcpProUid
-                            };
-                            Vue.nextTick(() => {
-                                showStagPopup('hcp-pro-popup', true);
-                                $('.erx-hcp-pro-select').removeAttr('pro-suggest-initialized');
-                                initProSuggest();
-                            });
-                        },
-                        saveHcpPro: function() {
-                            let payload = JSON.parse(JSON.stringify(this.currentPrescriptionHcpPro));
-                            $.post('/api/erx/updateHcpPro', payload, _data => {
-                                if(!hasResponseError(_data)) {
-                                    toastr.success('HCP Pro updated');
-                                    closeStagPopup();
-                                    fastReload();
-                                }
-                            }, 'json');
-                        },
-
-                        // sign
-                        signAsHcpPro: function(_prescription) {
-                            this.currentPrescriptionAction = 'SIGN_AS_HCP';
-                            this.currentPrescriptionType = _prescription.erx_category;
-                            this.currentPrescriptionSign = {
-                                uid: _prescription.uid,
-                                declaredVersionNumber: _prescription.version_number
-                            };
-                            Vue.nextTick(() => {
-                                showStagPopup('sign-as-hcp-popup', true);
-                            });
-                        },
-                        saveSignAsHcpPro: function() {
-                            let payload = JSON.parse(JSON.stringify(this.currentPrescriptionSign));
-                            $.post('/api/erx/signAsHcp', payload, _data => {
-                                if(!hasResponseError(_data)) {
-                                    toastr.success('Signed');
-                                    closeStagPopup();
-                                    fastReload();
-                                }
-                            }, 'json');
-                        },
-
-                        // edit pro status
-                        editProStatus: function(_prescription) {
-                            this.currentPrescriptionAction = 'EDIT_PRO_DECLARED_STATUS';
-                            this.currentPrescriptionType = _prescription.erx_category;
-                            this.currentPrescriptionProStatus = {
-                                uid: _prescription.uid,
-                                status: _prescription.pro_declared_status,
-                                memo: _prescription.pro_declared_status_memo,
-                            };
-                            Vue.nextTick(() => {
-                                showStagPopup('pro-status-popup', true);
-                            });
-                        },
-                        saveProStatus: function() {
-                            let payload = JSON.parse(JSON.stringify(this.currentPrescriptionProStatus));
-                            $.post('/api/erx/updateProDeclaredStatus', payload, _data => {
-                                if(!hasResponseError(_data)) {
-                                    toastr.success('Pro declared status updated');
-                                    closeStagPopup();
-                                    fastReload();
-                                }
-                            }, 'json');
-                        },
-
-                        // edit client status
-                        editClientStatus: function(_prescription) {
-                            this.currentPrescriptionAction = 'EDIT_CLIENT_DECLARED_STATUS';
-                            this.currentPrescriptionType = _prescription.erx_category;
-                            this.currentPrescriptionClientStatus = {
-                                uid: _prescription.uid,
-                                status: _prescription.client_declared_status,
-                                memo: _prescription.client_declared_status_memo,
-                            };
-                            Vue.nextTick(() => {
-                                showStagPopup('client-status-popup', true);
-                            });
-                        },
-                        saveClientStatus: function() {
-                            let payload = JSON.parse(JSON.stringify(this.currentPrescriptionClientStatus));
-                            $.post('/api/erx/updateClientDeclaredStatus', payload, _data => {
-                                if(!hasResponseError(_data)) {
-                                    toastr.success('Client declared status updated');
-                                    closeStagPopup();
-                                    fastReload();
-                                }
-                            }, 'json');
-                        },
-
-                        // sane display status
-                        sanitizeStatus: function(_s) {
-                            _s = _s.toLowerCase().replaceAll('_', ' ');
-                            _s = _s[0].toUpperCase() + _s.substr(1);
-                            return _s;
-                        },
-
-                        // transmit
-                        transmit: function(_prescription) {
-                            this.currentPrescriptionTransmit = {
-                                uid: _prescription.uid,
-                                toWho: _prescription.logistics_detail_json ? _prescription.logistics_detail_json.facilityName : '',
-                                toEmail: '',
-                                toFaxNumber: _prescription.logistics_detail_json ? _prescription.logistics_detail_json.facilityFax : '',
-                                toFaxNumberAttentionLine: '',
-                                toFaxNumberCoverSheetMemo: '',
-                                copyToPatient: false,
-                                copyToPatientFaxNumber: '{{$patient->cell_number}}',
-                                copyToPatientEmail: '{{$patient->email_address}}',
-                                _token: '{{csrf_token()}}'
-                            };
-                            Vue.nextTick(() => {
-                                showStagPopup('transmit-popup');
-                                this.transmitModalPDFPreview();
-                            });
-                        },
-                        transmitModalPDFPreview: function() {
-
-                            let _loadedPDF = null, _numPages = 1, _page = 1;
-
-                            function _load(_url) {
-
-                                _loadedPDF = null;
-                                _numPages = 1;
-                                _page = 1;
-
-                                $('#transmit-pdf-preview>canvas').remove();
-
-                                let url = _url;
-                                let pdfjsLib = window['pdfjs-dist/build/pdf'];
-                                pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js';
-                                let loadingTask = pdfjsLib.getDocument(url);
-                                loadingTask.promise.then(function (pdf) {
-                                    _numPages = pdf.numPages;
-                                    _loadedPDF = pdf;
-                                    _page = 1;
-                                    _render();
-                                }, function (reason) {
-                                    // reason.message;
-                                });
-                            }
-                            function _render() {
-
-                                _loadedPDF.getPage(_page).then(function (page) {
-
-                                    // create canvas
-                                    let canvasElement = $('<canvas/>')
-                                        .addClass('pdf-viewer-page pdf-preview-page')
-                                        .appendTo('#transmit-pdf-preview');
-
-                                    let canvas = canvasElement[0];
-                                    let viewport = page.getViewport({scale: 0.75});
-                                    let context = canvas.getContext('2d');
-                                    canvas.height = viewport.height;
-                                    canvas.width = viewport.width;
-                                    const $canvas = $(canvas);
-                                    let renderContext = {
-                                        canvasContext: context,
-                                        viewport: viewport
-                                    };
-                                    let renderTask = page.render(renderContext);
-                                    renderTask.promise.then(function () {
-                                        if(_page < _numPages) {
-                                            _page++;
-                                            _render();
-                                        }
-                                    });
-                                });
-                            }
-
-                            _load('/prescription-download-as-pdf/' + this.currentPrescriptionTransmit.uid);
-                        },
-                        doTransmit: function (_item) {
-                            let payload = JSON.parse(JSON.stringify(this.currentPrescriptionTransmit));
-                            $.post('/prescription-transmit/' + payload.uid, payload, _data => {
-                                if(!hasResponseError(_data)) {
-                                    toastr.success('Transmission initiated');
-                                    closeStagPopup();
-                                    fastReload();
-                                }
-                            }, 'json');
-                            closeStagPopup();
-                        },
-
-                        // cancel, etc.
-
-                        initFdbMedSuggest: function() {
-
-                            let self = this;
-
-                            let parentSegment = $('#prescriptions-{{$patient->id}} [stag-popup-key="prescription-popup-DRUG"]>form').first();
-
-                            parentSegment.find('input.prescription-medication').off('stag-suggest-selected');
-                            parentSegment.find('input.prescription-medication').on('stag-suggest-selected', (_e, _input, _data) => {
-
-                                // _input is the textbox
-                                // _data is {med_name_id: "50567", text: "Children's Tylenol"}
-
-                                // set vue values
-                                self.currentPrescription_DRUG.clinicalDetailJson.medication = _data.text;
-                                self.currentPrescription_DRUG.clinicalDetailJson.medNameID = _data.med_name_id;
-
-                                let routeSelect = parentSegment.find('.prescription-route').empty().prop('disabled', true);
-                                let dosageSelect = parentSegment.find('.prescription-dose').empty().prop('disabled', true);
-                                let strengthSelect = parentSegment.find('.prescription-strength').empty().prop('disabled', true);
-
-                                $.get('/fdb-routed-meds?med-name-id=' + _data.med_name_id, _data => {
-                                    routeSelect
-                                        .empty()
-                                        .append('<option value="">-- select --</option>');
-                                    for (let i = 0; i < _data.length; i++) {
-                                        routeSelect.append('<option value="' + _data[i].routed_med_id + '">' + _data[i].med_routed_med_id_desc + '</option>')
-                                    }
-                                    routeSelect.prop('disabled', false);
-                                    if (_data.length === 1) {
-                                        routeSelect.val(_data[0].routed_med_id).trigger('change');
-                                    }
-                                }, 'json');
-                            });
-
-                            // on route selection
-                            parentSegment.find('select.prescription-route').off('change');
-                            parentSegment.find('select.prescription-route').on('change', function () {
-
-                                let elem = $(this);
-
-                                // set vue values
-                                self.currentPrescription_DRUG.clinicalDetailJson.routedMedID = elem.val();
-                                self.currentPrescription_DRUG.clinicalDetailJson.route = elem.find('option:selected').text();
-
-                                // clear
-                                let dosageSelect = parentSegment.find('.prescription-dose').empty().prop('disabled', true);
-                                let strengthSelect = parentSegment.find('.prescription-strength').empty().prop('disabled', true);
-
-                                $.get('/fdb-routed-dosages?routed-med-id=' + self.currentPrescription_DRUG.clinicalDetailJson.routedMedID, _data => {
-                                    dosageSelect
-                                        .empty()
-                                        .append('<option value="">-- select --</option>');
-                                    for (let i = 0; i < _data.length; i++) {
-                                        dosageSelect.append('<option value="' + _data[i].routed_dosage_form_med_id + '">' + _data[i].med_routed_df_med_id_desc + '</option>')
-                                    }
-                                    dosageSelect.prop('disabled', false);
-                                    if(_data.length === 1) {
-                                        dosageSelect.val(_data[0].routed_dosage_form_med_id).trigger('change');
-                                    }
-                                }, 'json');
-                            });
-
-                            // on dosage selection
-                            parentSegment.find('select.prescription-dose').off('change');
-                            parentSegment.find('select.prescription-dose').on('change', function () {
-
-                                let elem = $(this);
-
-                                // set vue values
-                                self.currentPrescription_DRUG.clinicalDetailJson.dosageFormMedID = elem.val();
-                                self.currentPrescription_DRUG.clinicalDetailJson.dose = elem.find('option:selected').text();
-
-                                // clear
-                                let strengthSelect = parentSegment.find('.prescription-strength').empty().prop('disabled', true);
-
-                                $.get('/fdb-meds?dosage-form-med-id=' + self.currentPrescription_DRUG.clinicalDetailJson.dosageFormMedID, _data => {
-                                    strengthSelect
-                                        .empty()
-                                        .append('<option value="">-- select --</option>');
-                                    for (let i = 0; i < _data.length; i++) {
-                                        strengthSelect.append('<option data-medid="' + _data[i].medid + '" value="' + _data[i].gcn_seqno + '">' + _data[i].med_medid_desc + '</option>')
-                                    }
-                                    strengthSelect.prop('disabled', false);
-                                    if(_data.length === 1) {
-                                        strengthSelect.val(_data[0].gcn_seqno).trigger('change');
-                                    }
-                                }, 'json');
-                            });
-
-                            // on strength (medid) selection
-                            parentSegment.find('select.prescription-strength').off('change');
-                            parentSegment.find('select.prescription-strength').on('change', function () {
-
-                                let elem = $(this);
-
-                                // set vue values
-                                self.currentPrescription_DRUG.clinicalDetailJson.gcnSeqno = $(this).val();
-                                self.currentPrescription_DRUG.clinicalDetailJson.medId = $(this).find('option:selected').attr('data-medid');
-                                self.currentPrescription_DRUG.clinicalDetailJson.strength = $(this).find('option:selected').text();
-
-                                console.log(self.currentPrescription_DRUG.clinicalDetailJson);
-
-                            });
-                        }
-                    },
-                    mounted: function() {
-                        let self = this;
-                        $(document).on('pro-changed', '.erx-hcp-pro-select', function() {
-                            self.currentPrescriptionHcpPro.newHcpProUid = this.value;
-                        });
-                    }
-                });
-
-            }
-            addMCInitializer('prescriptions-{{$patient->id}}', init, '#prescriptions-{{$patient->id}}')
-        }).call(window);
-    </script>
+    @include('app.patient.prescriptions.list')
 @endsection

+ 837 - 0
resources/views/app/patient/prescriptions/list.blade.php

@@ -0,0 +1,837 @@
+<div id="prescriptions-{{$patient->id}}">
+    <div class="d-flex align-items-baseline py-2">
+        <h6 class="my-0 font-weight-bold text-secondary font-size-14">Prescriptions</h6>
+        <span class="mx-2 text-secondary on-hover-opaque">|</span>
+        <a href="#" v-on:click.prevent="newPrescription('DRUG')">+ Drug</a>
+        <span class="mx-2 text-secondary on-hover-opaque">|</span>
+        <a href="#" v-on:click.prevent="newPrescription('LAB')">+ Lab</a>
+        <span class="mx-2 text-secondary on-hover-opaque">|</span>
+        <a href="#" v-on:click.prevent="newPrescription('IMAGING')">+ Imaging</a>
+        <span class="mx-2 text-secondary on-hover-opaque">|</span>
+        <a href="#" v-on:click.prevent="newPrescription('REFERRAL')">+ Referral</a>
+        <span class="mx-2 text-secondary on-hover-opaque">|</span>
+        <a href="#" v-on:click.prevent="newPrescription('SUPPLY')">+ Supply</a>
+        <span class="mx-2 text-secondary on-hover-opaque">|</span>
+        <a href="#" v-on:click.prevent="newPrescription('OTHER')">+ Other</a>
+    </div>
+    <div class="d-flex align-items-start">
+        <table class="table table-striped table-sm table-bordered mb-0 flex-grow-1">
+            <thead>
+            <tr>
+                <th class="px-2 text-secondary border-bottom-0">Created</th>
+                <th class="px-2 text-secondary border-bottom-0">Type</th>
+                <th class="px-2 text-secondary border-bottom-0">Clinical</th>
+                <th class="px-2 text-secondary border-bottom-0">Prescriber</th>
+                <th class="px-2 text-secondary border-bottom-0">Sign</th>
+            </tr>
+            </thead>
+            <tbody>
+            <tr v-for="(prescription, index) in prescriptions" :class="currentPrescription && currentPrescription.id === prescription.id ? 'bg-aliceblue' : ''">
+                <td class="px-2">
+                    <a href="#" v-on:click.prevent="currentPrescription=prescription"
+                       :class="currentPrescription && currentPrescription.id === prescription.id ? 'font-weight-bold' : ''">@{{prescription.created_at_friendly_short}}</a>
+                    @if(@$note)
+                        <div v-if="prescription.note_id === {{$note->id}}" class="text-info mt-1">* Create on this note</div>
+                    @endif
+                </td>
+                <td class="px-2">@{{prescription.erx_category}}</td>
+                <td class="px-2">
+                    <div class="d-flex align-items-baseline">
+                        {{--
+                        <a v-if="!prescription.has_hcp_pro_signed" class="mr-2" href="#" v-on:click.prevent="editClinicalDetails(prescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
+                        <span v-else class="mr-2" title="Cannot edit. Prescription already signed."><i class="fa fa-edit on-hover-opaque text-secondary"></i></span>
+                        --}}
+                        <div v-if="prescription.clinical_detail_json" class="d-inline-flex align-items-baseline">
+                            <div class="d-flex align-items-baseline" v-if="prescription.erx_category === 'DRUG'">
+                                <b class="mr-2">@{{prescription.clinical_detail_json.medication ?? '-'}}</b>
+                                <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.frequency ?? ''}}</span>
+                            </div>
+                            <div class="d-flex align-items-baseline" v-if="prescription.erx_category === 'LAB' || prescription.erx_category === 'IMAGING'">
+                                <b class="mr-2">@{{prescription.clinical_detail_json.test ?? '-'}}</b>
+                                <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.icds ?? '-'}}</span>
+                            </div>
+                            <div class="d-flex align-items-baseline" v-if="prescription.erx_category === 'REFERRAL'">
+                                <b class="mr-2">@{{prescription.clinical_detail_json.to ?? '-'}}</b>
+                                <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.memo ?? '-'}}</span>
+                            </div>
+                            <div class="d-flex align-items-baseline" v-if="prescription.erx_category === 'SUPPLY'">
+                                <b class="mr-2">@{{prescription.clinical_detail_json.item ?? '-'}}</b>
+                                <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.quantity ?? '-'}}</span>
+                            </div>
+                            <div class="d-flex align-items-baseline" v-if="prescription.erx_category === 'OTHER'">
+                                <b class="mr-2">@{{prescription.clinical_detail_json.title ?? '-'}}</b>
+                                <span class="text-secondary mr-1">@{{prescription.clinical_detail_json.memo ?? '-'}}</span>
+                            </div>
+                        </div>
+                        <div v-else>-</div>
+                    </div>
+                </td>
+                <td class="px-2">
+                    <div class="d-flex align-items-baseline">
+                        {{--
+                        <a v-if="!prescription.has_hcp_pro_signed" class="mr-2" href="#" v-on:click.prevent="editHcpPro(prescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
+                        <span v-else class="mr-2" title="Cannot edit. Prescription already signed."><i class="fa fa-edit on-hover-opaque text-secondary"></i></span>
+                        --}}
+                        <div>@{{prescription.hcpProDisplayName}}</div>
+                    </div>
+                </td>
+                <td class="px-2">
+                    <div v-if="prescription.has_hcp_pro_signed" class="d-flex align-items-baseline">
+                        <i class="text-secondary fa fa-check mr-1"></i>
+                        <span class="text-secondary">Signed</span>
+                    </div>
+                    {{--
+                    <div v-else>
+                        <a v-if="prescription.hcp_pro_id === {{$pro->id}}"
+                           href="#"
+                           v-on:click.prevent="signAsHcpPro(prescription)">Sign</a>
+                        <span v-else>-</span>
+                    </div>
+                    --}}
+                </td>
+            </tr>
+            </tbody>
+        </table>
+        <div v-if="currentPrescription" class="min-width-500px ml-2 border align-self-stretch p-3">
+            <div class="d-flex align-items-center">
+                <h3 class="font-size-16 m-0">
+                    <div v-if="currentPrescription.clinical_detail_json" class="d-inline-flex align-items-baseline">
+                        <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'DRUG'">
+                            <b class="mr-2 font-size-16">@{{currentPrescription.clinical_detail_json.medication ?? '-'}}</b>
+                            <!--<span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.strength ?? '-'}}</span>
+                            <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.amount ?? '-'}}</span>
+                            <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.route ?? '-'}}</span>-->
+                        </div>
+                        <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'LAB' || currentPrescription.erx_category === 'IMAGING'">
+                            <b class="mr-2 font-size-16">@{{currentPrescription.clinical_detail_json.test ?? '-'}}</b>
+                            <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.icds ?? '-'}}</span>
+                        </div>
+                        <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'REFERRAL'">
+                            <b class="mr-2 font-size-16">@{{currentPrescription.clinical_detail_json.to ?? '-'}}</b>
+                            <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.memo ?? '-'}}</span>
+                        </div>
+                        <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'SUPPLY'">
+                            <b class="mr-2 font-size-16">@{{currentPrescription.clinical_detail_json.item ?? '-'}}</b>
+                            <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.quantity ?? '-'}}</span>
+                        </div>
+                        <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'OTHER'">
+                            <b class="mr-2 font-size-16">@{{currentPrescription.clinical_detail_json.title ?? '-'}}</b>
+                            <span class="text-secondary mr-1 font-size-16">@{{currentPrescription.clinical_detail_json.memo ?? '-'}}</span>
+                        </div>
+                    </div>
+                    <div v-else>-</div>
+                </h3>
+                <a class="ml-auto" href="#" v-on:click.prevent="currentPrescription=null">
+                    <i class="fa fa-times-circle on-hover-opaque"></i>
+                </a>
+            </div>
+            <hr class="my-3">
+            <div class="pb-2 d-flex align-items-start">
+                <span class="min-width-140px text-secondary text-sm">Created</span>
+                <div>
+                    <span>@{{currentPrescription.created_at_friendly}}</span>
+                    @if(@$note)
+                        <div v-if="currentPrescription.note_id === {{$note->id}}" class="text-info mt-1 font-weight-bold">* Create on this note</div>
+                    @endif
+                </div>
+            </div>
+            <div class="pb-2 d-flex align-items-center">
+                <span class="min-width-140px text-secondary text-sm">Type</span>
+                <span>@{{currentPrescription.erx_category}}</span>
+            </div>
+            <div class="pb-2 d-flex align-items-center">
+                <span class="min-width-140px text-secondary text-sm">Clinical</span>
+                <div class="d-inline-flex align-items-baseline flex-grow-1">
+                    <a v-if="!currentPrescription.has_hcp_pro_signed" class="mr-2" href="#" v-on:click.prevent="editClinicalDetails(currentPrescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
+                    <span v-else class="mr-2" title="Cannot edit. Prescription already signed."><i class="fa fa-edit on-hover-opaque text-secondary"></i></span>
+                    <div v-if="currentPrescription.clinical_detail_json" class="d-inline-flex align-items-baseline">
+                        <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'DRUG'">
+                            <b class="mr-2">@{{currentPrescription.clinical_detail_json.medication ?? '-'}}</b>
+                            <!--<span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.strength ?? '-'}}</span>
+                            <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.dispense ?? '-'}}</span>
+                            <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.refills ?? '-'}}</span>-->
+                        </div>
+                        <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'LAB' || currentPrescription.erx_category === 'IMAGING'">
+                            <b class="mr-2">@{{currentPrescription.clinical_detail_json.test ?? '-'}}</b>
+                            <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.icds ?? '-'}}</span>
+                        </div>
+                        <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'REFERRAL'">
+                            <b class="mr-2">@{{currentPrescription.clinical_detail_json.to ?? '-'}}</b>
+                            <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.memo ?? '-'}}</span>
+                        </div>
+                        <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'SUPPLY'">
+                            <b class="mr-2">@{{currentPrescription.clinical_detail_json.item ?? '-'}}</b>
+                            <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.quantity ?? '-'}}</span>
+                        </div>
+                        <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'OTHER'">
+                            <b class="mr-2">@{{currentPrescription.clinical_detail_json.title ?? '-'}}</b>
+                            <span class="text-secondary mr-1">@{{currentPrescription.clinical_detail_json.memo ?? '-'}}</span>
+                        </div>
+                    </div>
+                    <div v-else>-</div>
+                </div>
+            </div>
+            <div class="pb-2 d-flex align-items-center">
+                <span class="min-width-140px text-secondary text-sm">Logistics</span>
+                <div class="d-inline-flex align-items-baseline flex-grow-1">
+                    <a class="mr-2" href="#" v-on:click.prevent="editLogisticsDetails(currentPrescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
+                    <div v-if="currentPrescription.logistics_detail_json" class="d-flex align-items-baseline">
+                        <div class="d-flex align-items-baseline">
+                            <b class="mr-2">@{{currentPrescription.logistics_detail_json.facilityName ?? '-'}}</b>
+                            <span class="text-secondary mr-1">@{{currentPrescription.logistics_detail_json.facilityCity ?? '-'}}</span>
+                            <span class="text-secondary mr-1">@{{currentPrescription.logistics_detail_json.facilityState ?? '-'}}</span>
+                        </div>
+                    </div>
+                    <div v-else>-</div>
+                </div>
+            </div>
+            <div class="pb-2 d-flex align-items-center">
+                <span class="min-width-140px text-secondary text-sm">HCP Pro</span>
+                <div class="d-inline-flex align-items-baseline flex-grow-1">
+                    <a v-if="!currentPrescription.has_hcp_pro_signed" class="mr-2" href="#" v-on:click.prevent="editHcpPro(currentPrescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
+                    <span v-else class="mr-2" title="Cannot edit. Prescription already signed."><i class="fa fa-edit on-hover-opaque text-secondary"></i></span>
+                    <div>@{{currentPrescription.hcpProDisplayName}}</div>
+                </div>
+            </div>
+            <div class="pb-2 d-flex align-items-center">
+                <span class="min-width-140px text-secondary text-sm">Sign</span>
+                <div v-if="currentPrescription.has_hcp_pro_signed" class="d-inline-flex align-items-baseline">
+                    <i class="text-secondary fa fa-check mr-1"></i>
+                    <span class="text-secondary">Signed</span>
+                </div>
+                <div v-else>
+                    <a v-if="currentPrescription.hcp_pro_id === {{$pro->id}}"
+                       href="#"
+                       v-on:click.prevent="signAsHcpPro(currentPrescription)">Sign</a>
+                    <span v-else>-</span>
+                </div>
+            </div>
+            <div class="pb-2 d-flex align-items-center">
+                <span class="min-width-140px text-secondary text-sm">Pro Status</span>
+                <div class="d-inline-flex align-items-baseline">
+                    <a class="mr-2" href="#" v-on:click.prevent="editProStatus(currentPrescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
+                    <div v-if="currentPrescription.pro_declared_status" class="d-flex align-items-baseline">
+                        @{{ sanitizeStatus(currentPrescription.pro_declared_status) }}
+                    </div>
+                    <div v-else>-</div>
+                </div>
+            </div>
+            <div class="pb-2 d-flex align-items-center">
+                <span class="min-width-140px text-secondary text-sm">Client Status</span>
+                <div class="d-inline-flex align-items-baseline">
+                    <a class="mr-2" href="#" v-on:click.prevent="editClientStatus(currentPrescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
+                    <div v-if="currentPrescription.client_declared_status" class="d-flex align-items-baseline">
+                        @{{ sanitizeStatus(currentPrescription.client_declared_status) }}
+                    </div>
+                    <div v-else>-</div>
+                </div>
+            </div>
+            <div class="pb-2 d-flex align-items-center">
+                <span class="min-width-140px text-secondary text-sm">PDF</span>
+                <div class="d-inline-flex align-items-baseline">
+                    <a class="pdf-viewer-trigger" native target="_blank"
+                       :href="'/prescription-download-as-pdf/' + currentPrescription.uid">View</a>
+                    <span class="mx-2 text-secondary">|</span>
+                    <a native target="_blank"
+                       :href="'/prescription-download-as-pdf/' + currentPrescription.uid">Download</a>
+                    <span class="mx-2 text-secondary">|</span>
+                    <a href="#" v-on:click.prevent="transmit(currentPrescription)">Transmit</a>
+                </div>
+            </div>
+        </div>
+    </div>
+    @include('app.patient.prescriptions.drug-form')
+    @include('app.patient.prescriptions.lab-form')
+    @include('app.patient.prescriptions.imaging-form')
+    @include('app.patient.prescriptions.referral-form')
+    @include('app.patient.prescriptions.supply-form')
+    @include('app.patient.prescriptions.other-form')
+    @include('app.patient.prescriptions.logistics-form')
+    @include('app.patient.prescriptions.hcp-pro-form')
+    @include('app.patient.prescriptions.sign-as-hcp-form')
+    @include('app.patient.prescriptions.pro-status-form')
+    @include('app.patient.prescriptions.client-status-form')
+    @include('app.patient.prescriptions.transmit-form')
+</div>
+<script>
+    (function() {
+
+        <?php
+        $prescriptions = $patient->prescriptions;
+        $currentPrescription = null;
+        foreach ($prescriptions as $prescription) {
+            if($prescription->clinical_detail_json) {
+                $prescription->clinical_detail_json = json_decode($prescription->clinical_detail_json);
+            }
+            if($prescription->logistics_detail_json) {
+                $prescription->logistics_detail_json = json_decode($prescription->logistics_detail_json);
+            }
+            $prescription->created_at_friendly = friendlier_date_time($prescription->created_at);
+            $prescription->created_at_friendly_short = friendlier_date_time($prescription->created_at, false);
+            $prescription->hcpProDisplayName = $prescription->hcpPro ? $prescription->hcpPro->displayName() : '-';
+            $prescription->hcpProUid = $prescription->hcpPro ? $prescription->hcpPro->uid : '';
+
+            if(!!@$currentErx && $currentErx->uid === $prescription->uid) {
+                $currentPrescription = $prescription;
+            }
+        }
+        ?>
+
+        function init() {
+
+            new Vue({
+                el: '#prescriptions-{{$patient->id}}',
+                delimiters: ['@{{', '}}'],
+                data: {
+
+                    prescriptions: <?= json_encode($prescriptions) ?>,
+
+                    currentPrescriptionAction: '',
+                    currentPrescriptionType: '',
+
+                    // selected
+                    currentPrescription:  <?= $currentPrescription ? json_encode($currentPrescription) : 'null' ?>,
+
+                    // for editing clinical details
+                    currentPrescription_DRUG: {
+                        noteUid: '{{ @$note ? $note->uid : '' }}',
+                        clientUid: '{{ $patient->uid }}',
+                        replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
+                        hcpProUid: '{{$pro->uid}}',
+                        erxCategory: 'DRUG',
+                        clinicalDetailJson: {
+                            medication: '',
+                            route: '',
+                            dose: '',
+                            strength: '',
+                            frequency: '',
+                            dispense: '',
+                            refills: '',
+                            purpose: '',
+
+                            // fdb specific
+                            medNameID: '',
+                            routedMedID: '',
+                            dosageFormMedID: '',
+                            gcnSeqno: '',
+                            medId: '',
+                        }
+                    },
+                    currentPrescription_LAB: {
+                        noteUid: '{{ @$note ? $note->uid : '' }}',
+                        clientUid: '{{ $patient->uid }}',
+                        replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
+                        hcpProUid: '{{$pro->uid}}',
+                        erxCategory: 'LAB',
+                        clinicalDetailJson: {
+                            test: '',
+                            icds: '',
+                            memo: '',
+                        }
+                    },
+                    currentPrescription_IMAGING: {
+                        noteUid: '{{ @$note ? $note->uid : '' }}',
+                        clientUid: '{{ $patient->uid }}',
+                        replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
+                        hcpProUid: '{{$pro->uid}}',
+                        erxCategory: 'IMAGING',
+                        clinicalDetailJson: {
+                            test: '',
+                            icds: '',
+                            memo: '',
+                        }
+                    },
+                    currentPrescription_REFERRAL: {
+                        noteUid: '{{ @$note ? $note->uid : '' }}',
+                        clientUid: '{{ $patient->uid }}',
+                        replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
+                        hcpProUid: '{{$pro->uid}}',
+                        erxCategory: 'REFERRAL',
+                        clinicalDetailJson: {
+                            to: '',
+                            memo: '',
+                        }
+                    },
+                    currentPrescription_SUPPLY: {
+                        noteUid: '{{ @$note ? $note->uid : '' }}',
+                        clientUid: '{{ $patient->uid }}',
+                        replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
+                        hcpProUid: '{{$pro->uid}}',
+                        erxCategory: 'SUPPLY',
+                        clinicalDetailJson: {
+                            item: '',
+                            quantity: '',
+                            memo: '',
+                        }
+                    },
+                    currentPrescription_OTHER: {
+                        noteUid: '{{ @$note ? $note->uid : '' }}',
+                        clientUid: '{{ $patient->uid }}',
+                        replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
+                        hcpProUid: '{{$pro->uid}}',
+                        erxCategory: 'OTHER',
+                        clinicalDetailJson: {
+                            title: '',
+                            memo: '',
+                        }
+                    },
+
+                    // for editing logistics - common
+                    currentPrescriptionLogistics: {
+                        uid: '',
+                        logisticsDetailJson: {
+                            facilityName: '',
+                            facilityCity: '',
+                            facilityState: '',
+                            facilityAddressMemo: '',
+                            facilityPhone: '',
+                            facilityFax: '',
+                            facilityZip: '',
+                        }
+                    },
+
+                    // for editing hcp, sign, pro status & client status - common
+                    currentPrescriptionHcpPro: {
+                        uid: '',
+                        newHcpProUid: '',
+                    },
+                    currentPrescriptionSign: {
+                        uid: '',
+                        declaredVersionNumber: '',
+                    },
+                    currentPrescriptionProStatus: {
+                        uid: '',
+                        status: '',
+                        memo: '',
+                    },
+                    currentPrescriptionClientStatus: {
+                        uid: '',
+                        status: '',
+                        memo: '',
+                    },
+                    currentPrescriptionTransmit: {
+                        uid: '',
+                        logistics: '',
+                        toWho: '',
+                        toEmail: '',
+                        toFaxNumber: '',
+                        toFaxNumberAttentionLine: '',
+                        toFaxNumberCoverSheetMemo: '',
+                        copyToPatient: false,
+                        copyToPatientFaxNumber: '',
+                        copyToPatientEmail: '',
+                    }
+                },
+                methods: {
+
+                    // new/edit/save-clinical
+                    newPrescription: function(_type) {
+                        this.currentPrescriptionAction = 'ADD';
+                        this.currentPrescriptionType = _type;
+                        switch (_type) {
+                            case 'DRUG':
+                                this.currentPrescription_DRUG = {
+                                    noteUid: '{{ @$note ? $note->uid : '' }}',
+                                    clientUid: '{{ $patient->uid }}',
+                                    replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
+                                    hcpProUid: '{{$pro->uid}}',
+                                    erxCategory: _type,
+                                    clinicalDetailJson: {
+                                        medication: '',
+                                        route: '',
+                                        dose: '',
+                                        strength: '',
+                                        frequency: '',
+                                        dispense: '',
+                                        refills: '',
+                                        purpose: '',
+
+                                        // fdb specific
+                                        medNameID: '',
+                                        routedMedID: '',
+                                        dosageFormMedID: '',
+                                        gcnSeqno: '',
+                                        medId: '',
+                                    }
+                                };
+                                break;
+                            case 'LAB':
+                            case 'IMAGING':
+                                this.currentPrescription_LAB = {
+                                    noteUid: '{{ @$note ? $note->uid : '' }}',
+                                    clientUid: '{{ $patient->uid }}',
+                                    replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
+                                    hcpProUid: '{{$pro->uid}}',
+                                    erxCategory: _type,
+                                    clinicalDetailJson: {
+                                        test: '',
+                                        icds: '',
+                                        memo: '',
+                                    }
+                                };
+                                break;
+                            case 'REFERRAL':
+                                this.currentPrescription_LAB = {
+                                    noteUid: '{{ @$note ? $note->uid : '' }}',
+                                    clientUid: '{{ $patient->uid }}',
+                                    replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
+                                    hcpProUid: '{{$pro->uid}}',
+                                    erxCategory: _type,
+                                    clinicalDetailJson: {
+                                        to: '',
+                                        memo: '',
+                                    }
+                                };
+                                break;
+                            case 'SUPPLY':
+                                this.currentPrescription_LAB = {
+                                    noteUid: '{{ @$note ? $note->uid : '' }}',
+                                    clientUid: '{{ $patient->uid }}',
+                                    replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
+                                    hcpProUid: '{{$pro->uid}}',
+                                    erxCategory: _type,
+                                    clinicalDetailJson: {
+                                        item: '',
+                                        quantity: '',
+                                        memo: '',
+                                    }
+                                };
+                                break;
+                            case 'OTHER':
+                                this.currentPrescription_LAB = {
+                                    noteUid: '{{ @$note ? $note->uid : '' }}',
+                                    clientUid: '{{ $patient->uid }}',
+                                    replacesCancelledErxUid: null, // TODO: step-2 support UI to mark a new one as replacing a cancelled one
+                                    hcpProUid: '{{$pro->uid}}',
+                                    erxCategory: _type,
+                                    clinicalDetailJson: {
+                                        title: '',
+                                        memo: '',
+                                    }
+                                };
+                                break;
+                        }
+                        Vue.nextTick(() => {
+                            showStagPopup('prescription-popup-' + this.currentPrescriptionType, true);
+                            if(_type === 'DRUG') {
+                                $('[stag-suggest][stag-suggest-initialized]').removeAttr('stag-suggest-initialized');
+                                initStagSuggest();
+                                this.initFdbMedSuggest();
+                            }
+                        });
+                    },
+                    editClinicalDetails: function(_prescription) {
+                        this.currentPrescriptionAction = 'EDIT_CLINICAL';
+                        this.currentPrescriptionType = _prescription.erx_category;
+                        this['currentPrescription_' + this.currentPrescriptionType] = {
+                            uid: _prescription.uid,
+                            clinicalDetailJson: JSON.parse(JSON.stringify(_prescription.clinical_detail_json))
+                        };
+                        Vue.nextTick(() => {
+                            showStagPopup('prescription-popup-' + this.currentPrescriptionType, true);
+                            if(this.currentPrescriptionType === 'DRUG') {
+                                $('[stag-suggest][stag-suggest-initialized]').removeAttr('stag-suggest-initialized');
+                                initStagSuggest();
+                                this.initFdbMedSuggest();
+
+                                // re-populate drug fields
+                                console.log(this.currentPrescription_DRUG);
+                                let parentSegment = $('#prescriptions-{{$patient->id}} [stag-popup-key="prescription-popup-DRUG"]>form').first();
+                                parentSegment.find('input.prescription-medication').val(this.currentPrescription_DRUG.clinicalDetailJson.medication);
+                                parentSegment.find('select.prescription-route')
+                                    .empty()
+                                    .append($('<option/>').attr('value', 1).text(this.currentPrescription_DRUG.clinicalDetailJson.route))
+                                    .val(1);
+                                parentSegment.find('select.prescription-dose')
+                                    .empty()
+                                    .append($('<option/>').attr('value', 1).text(this.currentPrescription_DRUG.clinicalDetailJson.dose))
+                                    .val(1);
+                                parentSegment.find('select.prescription-strength')
+                                    .empty()
+                                    .append($('<option/>').attr('value', 1).text(this.currentPrescription_DRUG.clinicalDetailJson.strength))
+                                    .val(1);
+                            }
+                        });
+                    },
+                    savePrescription: function() {
+                        let payload = JSON.parse(JSON.stringify(this['currentPrescription_' + this.currentPrescriptionType]));
+                        payload.clinicalDetailJson = JSON.stringify(payload.clinicalDetailJson);
+                        switch (this.currentPrescriptionAction) {
+                            case 'ADD':
+                                $.post('/api/erx/create', payload, _data => {
+                                    if(!hasResponseError(_data)) {
+                                        toastr.success('Prescription added');
+                                        closeStagPopup();
+                                        @if(@$note)
+                                        fastReload();
+                                        @else
+                                        fastLoad('/patients/view/{{$patient->uid}}/prescriptions/' + this.currentPrescriptionType.toLowerCase() + '/' + _data.data);
+                                        @endif
+                                    }
+                                }, 'json');
+                                break;
+                            case 'EDIT_CLINICAL':
+                                $.post('/api/erx/updateClinicalDetail', payload, _data => {
+                                    if(!hasResponseError(_data)) {
+                                        toastr.success('Prescription updated');
+                                        closeStagPopup();
+                                        fastReload();
+                                    }
+                                }, 'json');
+                                break;
+                        }
+                    },
+
+                    // edit logistics
+                    editLogisticsDetails: function(_prescription) {
+                        this.currentPrescriptionAction = 'EDIT_LOGISTICS';
+                        this.currentPrescriptionLogistics = {
+                            uid: _prescription.uid,
+                            logisticsDetailJson: _prescription.logistics_detail_json ? JSON.parse(JSON.stringify(_prescription.logistics_detail_json)) : {
+                                facilityName: '',
+                                facilityCity: '',
+                                facilityState: '',
+                                facilityAddressMemo: '',
+                                facilityPhone: '',
+                                facilityFax: '',
+                                facilityZip: '',
+                            }
+                        }
+                        Vue.nextTick(() => {
+                            showStagPopup('logistics-popup', true);
+                        });
+                    },
+                    saveLogistics: function() {
+                        let payload = JSON.parse(JSON.stringify(this.currentPrescriptionLogistics));
+                        payload.logisticsDetailJson = JSON.stringify(payload.logisticsDetailJson);
+                        $.post('/api/erx/updateLogisticsDetail', payload, _data => {
+                            if(!hasResponseError(_data)) {
+                                toastr.success('Logistics updated');
+                                closeStagPopup();
+                                fastReload();
+                            }
+                        }, 'json');
+                    },
+
+                    // edit hcp (ordering) pro
+                    editHcpPro: function(_prescription) {
+                        this.currentPrescriptionAction = 'EDIT_HCP_PRO';
+                        this.currentPrescriptionType = _prescription.erx_category;
+                        this.currentPrescriptionHcpPro = {
+                            uid: _prescription.uid,
+                            newHcpProUid: _prescription.hcpProUid
+                        };
+                        Vue.nextTick(() => {
+                            showStagPopup('hcp-pro-popup', true);
+                            $('.erx-hcp-pro-select').removeAttr('pro-suggest-initialized');
+                            initProSuggest();
+                        });
+                    },
+                    saveHcpPro: function() {
+                        let payload = JSON.parse(JSON.stringify(this.currentPrescriptionHcpPro));
+                        $.post('/api/erx/updateHcpPro', payload, _data => {
+                            if(!hasResponseError(_data)) {
+                                toastr.success('HCP Pro updated');
+                                closeStagPopup();
+                                fastReload();
+                            }
+                        }, 'json');
+                    },
+
+                    // sign
+                    signAsHcpPro: function(_prescription) {
+                        this.currentPrescriptionAction = 'SIGN_AS_HCP';
+                        this.currentPrescriptionType = _prescription.erx_category;
+                        this.currentPrescriptionSign = {
+                            uid: _prescription.uid,
+                            declaredVersionNumber: _prescription.version_number
+                        };
+                        Vue.nextTick(() => {
+                            showStagPopup('sign-as-hcp-popup', true);
+                        });
+                    },
+                    saveSignAsHcpPro: function() {
+                        let payload = JSON.parse(JSON.stringify(this.currentPrescriptionSign));
+                        $.post('/api/erx/signAsHcp', payload, _data => {
+                            if(!hasResponseError(_data)) {
+                                toastr.success('Signed');
+                                closeStagPopup();
+                                fastReload();
+                            }
+                        }, 'json');
+                    },
+
+                    // edit pro status
+                    editProStatus: function(_prescription) {
+                        this.currentPrescriptionAction = 'EDIT_PRO_DECLARED_STATUS';
+                        this.currentPrescriptionType = _prescription.erx_category;
+                        this.currentPrescriptionProStatus = {
+                            uid: _prescription.uid,
+                            status: _prescription.pro_declared_status,
+                            memo: _prescription.pro_declared_status_memo,
+                        };
+                        Vue.nextTick(() => {
+                            showStagPopup('pro-status-popup', true);
+                        });
+                    },
+                    saveProStatus: function() {
+                        let payload = JSON.parse(JSON.stringify(this.currentPrescriptionProStatus));
+                        $.post('/api/erx/updateProDeclaredStatus', payload, _data => {
+                            if(!hasResponseError(_data)) {
+                                toastr.success('Pro declared status updated');
+                                closeStagPopup();
+                                fastReload();
+                            }
+                        }, 'json');
+                    },
+
+                    // edit client status
+                    editClientStatus: function(_prescription) {
+                        this.currentPrescriptionAction = 'EDIT_CLIENT_DECLARED_STATUS';
+                        this.currentPrescriptionType = _prescription.erx_category;
+                        this.currentPrescriptionClientStatus = {
+                            uid: _prescription.uid,
+                            status: _prescription.client_declared_status,
+                            memo: _prescription.client_declared_status_memo,
+                        };
+                        Vue.nextTick(() => {
+                            showStagPopup('client-status-popup', true);
+                        });
+                    },
+                    saveClientStatus: function() {
+                        let payload = JSON.parse(JSON.stringify(this.currentPrescriptionClientStatus));
+                        $.post('/api/erx/updateClientDeclaredStatus', payload, _data => {
+                            if(!hasResponseError(_data)) {
+                                toastr.success('Client declared status updated');
+                                closeStagPopup();
+                                fastReload();
+                            }
+                        }, 'json');
+                    },
+
+                    // sane display status
+                    sanitizeStatus: function(_s) {
+                        _s = _s.toLowerCase().replaceAll('_', ' ');
+                        _s = _s[0].toUpperCase() + _s.substr(1);
+                        return _s;
+                    },
+
+                    // transmit
+                    transmit: function(_prescription) {
+                        this.currentPrescriptionTransmit = {
+                            uid: _prescription.uid,
+                            toWho: _prescription.logistics_detail_json ? _prescription.logistics_detail_json.facilityName : '',
+                            toEmail: '',
+                            toFaxNumber: _prescription.logistics_detail_json ? _prescription.logistics_detail_json.facilityFax : '',
+                            toFaxNumberAttentionLine: '',
+                            toFaxNumberCoverSheetMemo: '',
+                            copyToPatient: false,
+                            copyToPatientFaxNumber: '{{$patient->cell_number}}',
+                            copyToPatientEmail: '{{$patient->email_address}}',
+                            _token: '{{csrf_token()}}'
+                        };
+                        Vue.nextTick(() => {
+                            showStagPopup('transmit-popup');
+                            this.transmitModalPDFPreview();
+                        });
+                    },
+                    transmitModalPDFPreview: function() {
+
+                        let _loadedPDF = null, _numPages = 1, _page = 1;
+
+                        function _load(_url) {
+
+                            _loadedPDF = null;
+                            _numPages = 1;
+                            _page = 1;
+
+                            $('#transmit-pdf-preview>canvas').remove();
+
+                            let url = _url;
+                            let pdfjsLib = window['pdfjs-dist/build/pdf'];
+                            pdfjsLib.GlobalWorkerOptions.workerSrc = '//mozilla.github.io/pdf.js/build/pdf.worker.js';
+                            let loadingTask = pdfjsLib.getDocument(url);
+                            loadingTask.promise.then(function (pdf) {
+                                _numPages = pdf.numPages;
+                                _loadedPDF = pdf;
+                                _page = 1;
+                                _render();
+                            }, function (reason) {
+                                // reason.message;
+                            });
+                        }
+                        function _render() {
+
+                            _loadedPDF.getPage(_page).then(function (page) {
+
+                                // create canvas
+                                let canvasElement = $('<canvas/>')
+                                    .addClass('pdf-viewer-page pdf-preview-page')
+                                    .appendTo('#transmit-pdf-preview');
+
+                                let canvas = canvasElement[0];
+                                let viewport = page.getViewport({scale: 0.75});
+                                let context = canvas.getContext('2d');
+                                canvas.height = viewport.height;
+                                canvas.width = viewport.width;
+                                const $canvas = $(canvas);
+                                let renderContext = {
+                                    canvasContext: context,
+                                    viewport: viewport
+                                };
+                                let renderTask = page.render(renderContext);
+                                renderTask.promise.then(function () {
+                                    if(_page < _numPages) {
+                                        _page++;
+                                        _render();
+                                    }
+                                });
+                            });
+                        }
+
+                        _load('/prescription-download-as-pdf/' + this.currentPrescriptionTransmit.uid);
+                    },
+                    doTransmit: function (_item) {
+                        let payload = JSON.parse(JSON.stringify(this.currentPrescriptionTransmit));
+                        $.post('/prescription-transmit/' + payload.uid, payload, _data => {
+                            if(!hasResponseError(_data)) {
+                                toastr.success('Transmission initiated');
+                                closeStagPopup();
+                                fastReload();
+                            }
+                        }, 'json');
+                        closeStagPopup();
+                    },
+
+                    // cancel, etc.
+
+                    initFdbMedSuggest: function() {
+
+                        let self = this;
+
+                        let parentSegment = $('#prescriptions-{{$patient->id}} [stag-popup-key="prescription-popup-DRUG"]>form').first();
+
+                        parentSegment.find('input.prescription-medication').off('stag-suggest-selected');
+                        parentSegment.find('input.prescription-medication').on('stag-suggest-selected', (_e, _input, _data) => {
+
+                            // _input is the textbox
+                            // _data is {med_name_id: "50567", text: "Children's Tylenol"}
+
+                            // set vue values
+                            self.currentPrescription_DRUG.clinicalDetailJson.medication = _data.text;
+
+                        });
+                    }
+                },
+                mounted: function() {
+                    let self = this;
+                    $(document).on('pro-changed', '.erx-hcp-pro-select', function() {
+                        self.currentPrescriptionHcpPro.newHcpProUid = this.value;
+                    });
+                }
+            });
+
+        }
+        addMCInitializer('prescriptions-{{$patient->id}}', init, '#prescriptions-{{$patient->id}}')
+    }).call(window);
+</script>

+ 16 - 9
resources/views/app/patient/tickets.blade.php

@@ -51,6 +51,13 @@
 
     <link href="/select2/select2.min.css" rel="stylesheet" />
     <script src="/select2/select2.min.js"></script>
+
+    <div class="alert alert-warning border-warning">
+        <b>Deprecated:</b> 
+        This ERx / Orders feature has been deprecated, and is now read-only. For new prescriptions, please use
+        <a href="{{ route('patients.view.patient-prescriptions', ['patient' => $patient]) }}" class="font-weight-bold">Prescriptions</a>.
+    </div>
+
     <div id="ticketsApp" v-cloak>
         <div class="d-flex align-items-end pb-0">
             <h4 class="font-weight-bold m-0 font-size-16">ERx / Orders</h4>
@@ -234,15 +241,15 @@
                         <?php } ?>
                     },
                     watch: {
-                        <?php for ($i=0; $i<count($categories); $i++) { ?>
-                            {{ $categories[$i] }}CurrentItemData: { // ex: erxCurrentItemData, labCurrentItemData, etc.
-                                handler: function(val, oldVal) {
-                                    if (this.{{ $categories[$i] }}PopupMode !== 'edit' || !this.currentItemUid || this.reloading) return;
-                                    this.{{ $categories[$i] }}AutoSave();
-                                },
-                                deep: true
-                            },
-                        <?php } ?>
+{{--                        <?php for ($i=0; $i<count($categories); $i++) { ?>--}}
+{{--                            {{ $categories[$i] }}CurrentItemData: { // ex: erxCurrentItemData, labCurrentItemData, etc.--}}
+{{--                                handler: function(val, oldVal) {--}}
+{{--                                    if (this.{{ $categories[$i] }}PopupMode !== 'edit' || !this.currentItemUid || this.reloading) return;--}}
+{{--                                    this.{{ $categories[$i] }}AutoSave();--}}
+{{--                                },--}}
+{{--                                deep: true--}}
+{{--                            },--}}
+{{--                        <?php } ?>--}}
                     },
                     methods: {
 

+ 2 - 2
resources/views/app/patient/tickets/equipment.blade.php

@@ -5,8 +5,8 @@
             <span v-if="statusFilter === 'closed'" class="text-secondary font-weight-normal">(@{{ equipmentNumClosed }} closed)</span>
             <span v-if="statusFilter === 'all'" class="text-secondary font-weight-normal">(@{{ equipmentNumOpen }} open, @{{ equipmentNumClosed }} closed)</span>
         </h4>
-        <a class="px-3 c-pointer font-weight-bold"
-           v-on:click.prevent="equipmentShowPopup()">+ New</a>
+        <!--<a class="px-3 c-pointer font-weight-bold"
+           v-on:click.prevent="equipmentShowPopup()">+ New</a>-->
         <a class="py-0 font-weight-normal c-pointer flex-grow-1 text-right pr-2"
            v-if="!equipmentCollapsed"
            v-on:click.prevent="equipmentCollapsed = true">

+ 4 - 4
resources/views/app/patient/tickets/erx.blade.php

@@ -5,8 +5,8 @@
             <span v-if="statusFilter === 'closed'" class="text-secondary font-weight-normal">(@{{ erxNumClosed }} closed)</span>
             <span v-if="statusFilter === 'all'" class="text-secondary font-weight-normal">(@{{ erxNumOpen }} open, @{{ erxNumClosed }} closed)</span>
         </h4>
-        <a class="px-3 c-pointer font-weight-bold"
-           v-on:click.prevent="erxShowPopup()">+ New</a>
+        <!--<a class="px-3 c-pointer font-weight-bold"
+           v-on:click.prevent="erxShowPopup()">+ New</a>-->
         <a class="py-0 font-weight-normal c-pointer flex-grow-1 text-right pr-2"
            v-if="!erxCollapsed"
            v-on:click.prevent="erxCollapsed = true">
@@ -70,10 +70,10 @@
                 <div class="row mb-2">
                     <div class="col-12 d-flex align-items-baseline">
                         <label class="text-secondary mb-0 font-weight-normal font-size-16">ERx</label>
-                        <span class="text-secondary mx-2">|</span>
+                        <!--<span class="text-secondary mx-2">|</span>
                         <a href="#" v-on:click.prevent="addERxLineItem()">Add</a>
                         <span class="text-secondary mx-2">|</span>
-                        <a class="py-0 font-weight-normal c-pointer" onclick="showStagPopup('client-rx')">Patient Rx List</a>
+                        <a class="py-0 font-weight-normal c-pointer" onclick="showStagPopup('client-rx')">Patient Rx List</a>-->
                     </div>
                 </div>
             </div>

+ 2 - 2
resources/views/app/patient/tickets/header-end.blade.php

@@ -1,5 +1,5 @@
 <div v-if="<?=$category?>PopupMode === 'edit'" class="ml-auto mr-3">
-    <a v-if="<?=$category?>PopupItem.is_open" href="#"
+    <!--<a v-if="<?=$category?>PopupItem.is_open" href="#"
        class="btn btn-sm btn-default border bg-white text-dark text-nowrap shadow-none"
        v-on:click.prevent="closeItem(<?=$category?>PopupItem)">
         <i class="fa fa-check text-success mr-2"></i>Mark Complete
@@ -8,6 +8,6 @@
        class="btn btn-sm btn-success text-nowrap text-white shadow-none"
        v-on:click.prevent="openItem(<?=$category?>PopupItem)">
         <i class="fa fa-check mr-2"></i>Complete
-    </a>
+    </a>-->
 </div>
 <a href="#" class="text-secondary" onclick="return closeStagPopup()"><i class="fa fa-chevron-right"></i></a>

+ 12 - 12
resources/views/app/patient/tickets/imaging.blade.php

@@ -5,8 +5,8 @@
             <span v-if="statusFilter === 'closed'" class="text-secondary font-weight-normal">(@{{ imagingNumClosed }} closed)</span>
             <span v-if="statusFilter === 'all'" class="text-secondary font-weight-normal">(@{{ imagingNumOpen }} open, @{{ imagingNumClosed }} closed)</span>
         </h4>
-        <a class="px-3 c-pointer font-weight-bold"
-           v-on:click.prevent="imagingShowPopup()">+ New</a>
+        <!--<a class="px-3 c-pointer font-weight-bold"
+           v-on:click.prevent="imagingShowPopup()">+ New</a>-->
         <a class="py-0 font-weight-normal c-pointer flex-grow-1 text-right pr-2"
            v-if="!imagingCollapsed"
            v-on:click.prevent="imagingCollapsed = true">
@@ -79,8 +79,8 @@
                 <div class="mb-2">
                     <div class="d-flex align-items-center mb-1">
                         <label class="text-sm text-secondary mb-0">Tests</label>
-                        <span class="text-sm mx-2 text-secondary">|</span>
-                        <a href="#" class="text-sm" v-on:click.prevent="imagingPopupItem.data.tests.push('')">Add</a>
+                        <!--<span class="text-sm mx-2 text-secondary">|</span>
+                        <a href="#" class="text-sm" v-on:click.prevent="imagingPopupItem.data.tests.push('')">Add</a>-->
                     </div>
                     <div class="d-flex align-items-center mb-2" v-for="(test, testIndex) in imagingPopupItem.data.tests">
                         <div class="position-relative flex-grow-1">
@@ -95,25 +95,25 @@
                                 <div>PET-CT</div>
                             </div>
                         </div>
-                        <a v-if="imagingPopupItem.data.tests.length > 1" class="ml-2 text-danger" href="#" v-on:click.prevent="imagingPopupItem.data.tests.splice(testIndex, 1)">
+                        <!--<a v-if="imagingPopupItem.data.tests.length > 1" class="ml-2 text-danger" href="#" v-on:click.prevent="imagingPopupItem.data.tests.splice(testIndex, 1)">
                             <i class="fa fa-trash-alt"></i>
-                        </a>
+                        </a>-->
                     </div>
                 </div>
                 <div class="mb-2">
                     <div class="d-flex align-items-center mb-1">
                         <label class="text-sm text-secondary mb-0">ICDs</label>
-                        <span class="text-sm mx-2 text-secondary">|</span>
-                        <a href="#" class="text-sm" v-on:click.prevent="imagingAddICD()">Add</a>
+                        <!--<span class="text-sm mx-2 text-secondary">|</span>
+                        <a href="#" class="text-sm" v-on:click.prevent="imagingAddICD()">Add</a>-->
                     </div>
                     <div class="d-flex align-items-center mb-2" v-for="(icd, icdIndex) in imagingPopupItem.data.icds">
                         <div class="position-relative flex-grow-1">
                             <input required type="text" data-field="icd" :data-index="icdIndex" placeholder="ICD"
                                    v-model="imagingPopupItem.data.icds[icdIndex]" class="form-control form-control-sm">
                         </div>
-                        <a v-if="imagingPopupItem.data.icds.length > 1" class="ml-2 text-danger" href="#" v-on:click.prevent="imagingPopupItem.data.icds.splice(icdIndex, 1)">
+                        <!--<a v-if="imagingPopupItem.data.icds.length > 1" class="ml-2 text-danger" href="#" v-on:click.prevent="imagingPopupItem.data.icds.splice(icdIndex, 1)">
                             <i class="fa fa-trash-alt"></i>
-                        </a>
+                        </a>-->
                     </div>
                 </div>
                 <div class="mb-2">
@@ -124,10 +124,10 @@
 
             @include('app.patient.tickets.pharmacy', ['label' => 'Facility', 'category' => 'imaging'])
 
-            <div v-if="imagingPopupMode === 'add'" class="d-flex align-items-center justify-content-start mt-3 p-3 border-bottom">
+            <!--<div v-if="imagingPopupMode === 'add'" class="d-flex align-items-center justify-content-start mt-3 p-3 border-bottom">
                 <button type="button" class="btn btn-sm btn-primary mr-2" v-on:click.prevent="imagingSavePopupItem()">Submit</button>
                 <button type="button" class="btn btn-sm btn-default border" onclick="return closeStagPopup()">Cancel</button>
-            </div>
+            </div>-->
 
             <!-- attachments -->
             @include('app.patient.tickets.attachments', ['category' => 'imaging'])

+ 12 - 12
resources/views/app/patient/tickets/lab.blade.php

@@ -5,8 +5,8 @@
             <span v-if="statusFilter === 'closed'" class="text-secondary font-weight-normal">(@{{ labNumClosed }} closed)</span>
             <span v-if="statusFilter === 'all'" class="text-secondary font-weight-normal">(@{{ labNumOpen }} open, @{{ labNumClosed }} closed)</span>
         </h4>
-        <a class="px-3 c-pointer font-weight-bold"
-           v-on:click.prevent="labShowPopup()">+ New</a>
+        <!--<a class="px-3 c-pointer font-weight-bold"
+           v-on:click.prevent="labShowPopup()">+ New</a>-->
         <a class="py-0 font-weight-normal c-pointer flex-grow-1 text-right pr-2"
            v-if="!labCollapsed"
            v-on:click.prevent="labCollapsed = true">
@@ -80,8 +80,8 @@
                 <div class="mb-2">
                     <div class="d-flex align-items-center mb-1">
                         <label class="text-sm text-secondary mb-0">Tests</label>
-                        <span class="text-sm mx-2 text-secondary">|</span>
-                        <a href="#" class="text-sm" v-on:click.prevent="labPopupItem.data.tests.push('')">Add</a>
+                        <!--<span class="text-sm mx-2 text-secondary">|</span>
+                        <a href="#" class="text-sm" v-on:click.prevent="labPopupItem.data.tests.push('')">Add</a>-->
                     </div>
                     <div class="d-flex align-items-center mb-0" v-for="(test, testIndex) in labPopupItem.data.tests">
                         <div class="position-relative flex-grow-1">
@@ -99,25 +99,25 @@
                                 <div>Cultures</div>
                             </div>
                         </div>
-                        <a v-if="labPopupItem.data.tests.length > 1" class="ml-2 text-danger" href="#" v-on:click.prevent="labPopupItem.data.tests.splice(testIndex, 1)">
+                        <!--<a v-if="labPopupItem.data.tests.length > 1" class="ml-2 text-danger" href="#" v-on:click.prevent="labPopupItem.data.tests.splice(testIndex, 1)">
                             <i class="fa fa-trash-alt"></i>
-                        </a>
+                        </a>-->
                     </div>
                 </div>
                 <div class="mb-2">
                     <div class="d-flex align-items-center mb-1">
                         <label class="text-sm text-secondary mb-0">ICDs</label>
-                        <span class="text-sm mx-2 text-secondary">|</span>
-                        <a href="#" class="text-sm" v-on:click.prevent="labAddICD()">Add</a>
+                        <!--<span class="text-sm mx-2 text-secondary">|</span>
+                        <a href="#" class="text-sm" v-on:click.prevent="labAddICD()">Add</a>-->
                     </div>
                     <div class="d-flex align-items-center mb-0" v-for="(icd, icdIndex) in labPopupItem.data.icds">
                         <div class="position-relative flex-grow-1">
                             <input required type="text" data-field="icd" :data-index="icdIndex" placeholder="ICD"
                                    v-model="labPopupItem.data.icds[icdIndex]" class="form-control form-control-sm">
                         </div>
-                        <a v-if="labPopupItem.data.icds.length > 1" class="ml-2 text-danger" href="#" v-on:click.prevent="labPopupItem.data.icds.splice(icdIndex, 1)">
+                        <!--<a v-if="labPopupItem.data.icds.length > 1" class="ml-2 text-danger" href="#" v-on:click.prevent="labPopupItem.data.icds.splice(icdIndex, 1)">
                             <i class="fa fa-trash-alt"></i>
-                        </a>
+                        </a>-->
                     </div>
                 </div>
                 <div class="mb-2">
@@ -128,10 +128,10 @@
 
             @include('app.patient.tickets.pharmacy', ['label' => 'Facility', 'category' => 'lab'])
 
-            <div v-if="labPopupMode === 'add'" class="d-flex align-items-center justify-content-start mt-3 p-3 border-bottom">
+            <!--<div v-if="labPopupMode === 'add'" class="d-flex align-items-center justify-content-start mt-3 p-3 border-bottom">
                 <button type="button" class="btn btn-sm btn-primary mr-2" v-on:click.prevent="labSavePopupItem()">Submit</button>
                 <button type="button" class="btn btn-sm btn-default border" onclick="return closeStagPopup()">Cancel</button>
-            </div>
+            </div>-->
 
             <!-- attachments -->
             @include('app.patient.tickets.attachments', ['category' => 'lab'])

+ 2 - 2
resources/views/app/patient/tickets/other.blade.php

@@ -5,8 +5,8 @@
             <span v-if="statusFilter === 'closed'" class="text-secondary font-weight-normal">(@{{ otherNumClosed }} closed)</span>
             <span v-if="statusFilter === 'all'" class="text-secondary font-weight-normal">(@{{ otherNumOpen }} open, @{{ otherNumClosed }} closed)</span>
         </h4>
-        <a class="px-3 c-pointer font-weight-bold"
-           v-on:click.prevent="otherShowPopup()">+ New</a>
+        <!--<a class="px-3 c-pointer font-weight-bold"
+           v-on:click.prevent="otherShowPopup()">+ New</a>-->
         <a class="py-0 font-weight-normal c-pointer flex-grow-1 text-right pr-2"
            v-if="!otherCollapsed"
            v-on:click.prevent="otherCollapsed = true">

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

@@ -96,7 +96,7 @@
                         </li> */ ?>
                         <li class="nav-item">
                             <a class="nav-link {{ strpos($routeName, 'patients.view.patient-prescriptions') === 0 ? 'active' : '' }}"
-                               href="{{ route('patients.view.patient-prescriptions', ['patient' => $patient]) }}">Prescriptions **</a>
+                               href="{{ route('patients.view.patient-prescriptions', ['patient' => $patient]) }}">Prescriptions</a>
                             <?php /*
                             <ul class="m-0 p-0 nav-child-list">
                                 <li class="nav-item">

+ 1 - 0
routes/web.php

@@ -294,6 +294,7 @@ Route::middleware('pro.auth')->group(function () {
 
             // prescriptions (new)
             Route::get('prescriptions/{type?}/{currentErx?}', 'PatientController@prescriptions')->name('patient-prescriptions');
+            Route::get('prescriptions-list/{type?}/{currentErx?}', 'PatientController@prescriptionsList')->name('patient-prescriptions-list');
 
             // appointments
             Route::get('appointments/{forPro}/{status}', 'PatientController@appointments')->name('appointments');

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio