فهرست منبع

Supplements segment + wizard

Vijayakrishnan 3 سال پیش
والد
کامیت
16ca79b839

+ 11 - 1
app/Http/Controllers/NoteController.php

@@ -127,7 +127,9 @@ class NoteController extends Controller
                 'intake_allergies',
                 'plan_allergies',
                 'intake_care_team',
-                'plan_care_team'
+                'plan_care_team',
+                'intake_supplements',
+                'plan_supplements'
             ];
             if(!in_array($segmentTemplate->internal_name, $wizardPowered)) {
                 $editHtml = view('app.patient.segment-templates.' . $segmentTemplate->internal_name . '/edit', $data)->render();
@@ -388,6 +390,14 @@ class NoteController extends Controller
         return view('app.patient.careteam-center', compact('patient', 'note'));
     }
 
+    public function supplementsCenter(Request $request, Client $patient, Note $note) {
+        return view('app.patient.supplements-center', compact('patient', 'note'));
+    }
+
+    public function supplementsReconcile(Request $request, Client $patient, Note $note) {
+        return view('app.patient.supplements-reconcile', compact('patient', 'note'));
+    }
+
     // TODO move to utility
     private function callJava($request, $endPoint, $data, $guestAccessCode = null)
     {

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

@@ -2421,6 +2421,18 @@
                                 <span>Rx</span>
                             </div>
                         </div>
+                        <div class="nbt-container border-right border-info d-inline-flex align-self-stretch">
+                            <div native target="_blank"
+                                 class="c-pointer d-inline-flex align-items-center supplements-center-trigger px-2 py-1"
+                                 open-in-stag-popup
+                                 mc-initer="supplements-center-{{$note->id}}"
+                                 title="Supplements Center"
+                                 popup-style="wide overflow-visible"
+                                 href="/supplements-center/{{$patient->uid}}/{{$note->uid}}">
+                                <i class="fa fa-bolt mr-1"></i>
+                                <span>Supp.</span>
+                            </div>
+                        </div>
                         <div class="nbt-container border-right border-info d-inline-flex align-self-stretch">
                             <div native target="_blank"
                                  class="c-pointer d-inline-flex align-items-center problems-center-trigger px-2 py-1"

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

@@ -143,6 +143,11 @@
                             $('.note-bottom-toolbar .careteam-center-trigger').trigger('click');
                             return false;
                         }
+                        else if(editParent.is('[data-segment-template-name="plan_supplements"]') ||
+                            editParent.is('[data-segment-template-name="intake_supplements"]')) {
+                            $('.note-bottom-toolbar .supplements-center-trigger').trigger('click');
+                            return false;
+                        }
 
                         // TEMP: open in popup if LS segment
                         if(editParent.is('[data-segment-template-name^="lifestyle_"]')) {

+ 23 - 0
resources/views/app/patient/note/rhs-sidebar.blade.php

@@ -1,6 +1,7 @@
 <?php
 $allergies = \App\Models\Point::getPointsOfCategory($patient, "ALLERGY");
 $medications = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
+$supplements = \App\Models\Point::getPointsOfCategory($patient, "SUPPLEMENT");
 $problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEM");
 $goals = \App\Models\Point::getPointsOfCategory($patient, "GOAL");
 $prescriptions = $patient->prescriptionsCreatedInNote($note);
@@ -49,6 +50,28 @@ $prescriptions = $patient->prescriptionsCreatedInNote($note);
         <span class="px-1 text-secondary">None</span>
     @endif
 </div>
+<div id="active-supplements" class="p-2 border-bottom c-pointer on-hover-aliceblue"
+     open-in-stag-popup
+     mc-initer="supplements-center-{{$note->id}}"
+     title="Supplements Center"
+     popup-style="wide overflow-visible"
+     href="/supplements-center/{{$patient->uid}}/{{$note->uid}}">
+    <div class="font-weight-bold mb-2">
+        Supplements
+        <i class="fa fa-bolt text-primary ml-1"></i>
+    </div>
+    @if($supplements && count($supplements))
+        @foreach($supplements as $supplement)
+            <?php $rel = $supplement->relevanceToNote($note); ?>
+            <div class="d-inline-flex align-items-baseline px-1 {{$rel ? 'bg-warning-mellow' : ''}}">
+                <span class="mr-1">•</span>
+                <span>{{$supplement->data->name}}</span>
+            </div>
+        @endforeach
+    @else
+        <span class="px-1 text-secondary">None</span>
+    @endif
+</div>
 <div id="active-problems" class="p-2 border-bottom c-pointer on-hover-aliceblue"
      open-in-stag-popup
      mc-initer="problems-center-{{$note->id}}"

+ 14 - 1
resources/views/app/patient/note/segment.blade.php

@@ -158,6 +158,17 @@
                     <i class="fa fa-bolt mr-1"></i>
                     <span>Care Team Center</span>
                 </a>
+            @elseif($iName === 'intake_supplements' || $iName === 'plan_supplements')
+                <a native target="_blank"
+                   class="c-pointer d-inline-flex align-items-center ml-3"
+                   open-in-stag-popup
+                   mc-initer="supplements-center-{{$note->id}}"
+                   title="Supplements Center"
+                   popup-style="wide overflow-visible"
+                   href="/supplements-center/{{$patient->uid}}/{{$note->uid}}">
+                    <i class="fa fa-bolt mr-1"></i>
+                    <span>Supplements Center</span>
+                </a>
             @endif
         @endif
 
@@ -181,7 +192,9 @@
         'intake_allergies',
         'plan_allergies',
         'intake_care_team',
-        'plan_care_team'
+        'plan_care_team',
+        'intake_supplements',
+        'plan_supplements',
     ];
     if(!in_array($iName, $wizardPowered)) { ?>
     <div class="d-none if-edit edit-container">

+ 58 - 0
resources/views/app/patient/segment-templates/intake_supplements/summary.blade.php

@@ -0,0 +1,58 @@
+<?php
+
+use App\Models\Point;
+
+/** @var \App\Models\Client $patient */
+
+$supplements = Point::getIntakePointsOfCategory($patient, 'SUPPLEMENT', $note);
+
+$numRelevant = 0;
+
+?>
+
+<?php if (!count($supplements)): ?>
+    <div class="text-secondary">No supplements</div>
+<?php else: ?>
+    <?php foreach ($supplements as $supplement): ?>
+        <?php $rel = $supplement->relevanceToNote($note); ?>
+        <div class="mb-2">
+            <div class="d-flex align-items-baseline">
+                @if($rel)
+                    <span class="text-info mr-1">
+                        <i class="fa fa-star"></i>
+                    </span>
+                    <?php $numRelevant++; ?>
+                @endif
+                <div class="<?= $supplement->is_removed ? 'strike-through' : '' ?>">
+                    <b><?= !!@($supplement->data->name) ? @($supplement->data->name) : '-' ?></b>
+                    <?= !!@($supplement->data->start_date) ? '/&nbsp;From ' . @($supplement->data->start_date) : '' ?>
+                </div>
+                <?php if ($supplement->is_removed): ?>
+                    @if($supplement->removal_reason_category === 'DURING_VISIT')
+                        <span class="ml-2 text-sm text-secondary">Removed during visit</span>
+                    @elseif($supplement->removal_reason_category === 'ON_INTAKE')
+                        <span class="ml-2 text-sm text-secondary">Removed on intake</span>
+                    @endif
+                <?php elseif ($supplement->added_in_note_id === $note->id): ?>
+                <span class="ml-2 text-sm text-success">* Added on intake</span>
+                <?php endif; ?>
+            </div>
+            <?php $review = $supplement->childReviewAddedInNote($note); ?>
+            <?php if(!!$review): ?>
+            <div class="pl-3 mt-1">
+                <div class="text-secondary font-weight-bold">Review</div>
+                <div>{!! $review->data->value !!}</div>
+            </div>
+            <?php elseif($rel): ?>
+            <div class="relevant-without-review text-danger mt-1 text-sm" data-target-segment="<?= $segment->segmentTemplate->internal_name ?>"><i class="fa fa-exclamation-triangle mr-1"></i>Review missing</div>
+            <?php endif; ?>
+        </div>
+    <?php endforeach; ?>
+    @if($numRelevant)
+        <div class="d-flex align-items-baseline text-info mr-1 mt-3">
+            <span class="text-sm mr-1"><i class="fa fa-star text-sm"></i></span>
+            <span class="text-sm">Supplements relevant to this note</span>
+        </div>
+    @endif
+<?php endif; ?>
+

+ 81 - 0
resources/views/app/patient/segment-templates/plan_supplements/summary.blade.php

@@ -0,0 +1,81 @@
+<?php
+
+use App\Models\Point;
+
+/** @var \App\Models\Client $patient */
+
+list($supplements, $counts) = Point::getPointsOfCategoryExtended($patient, 'SUPPLEMENT', $note);
+
+$numRelevant = 0;
+$numVisible = 0;
+?>
+
+<?php if (!count($supplements)): ?>
+    <div class="text-secondary">No supplements</div>
+<?php else: ?>
+    <?php foreach ($supplements as $supplement): ?>
+        <?php if($supplement->is_removed && $supplement->is_removed_due_to_entry_error) continue; ?>
+        <?php $rel = $supplement->relevanceToNote($note); ?>
+        <?php $review = $supplement->childPlanAddedInNote($note); ?>
+
+        <!--show only if: relevant || added-in-note || removed-in-note || added-plan-in-note-->
+        @if($rel ||
+            (!$supplement->is_removed && $supplement->added_in_note_id === $note->id) ||
+            ($supplement->is_removed && $supplement->removed_in_note_id === $note->id) ||
+            !!$review
+            )
+
+            <?php $numVisible++; ?>
+
+        <div class="mb-2">
+            <div class="d-flex align-items-baseline">
+                @if($rel)
+                    <span class="text-info mr-1">
+                        <i class="fa fa-star"></i>
+                    </span>
+                    <?php $numRelevant++; ?>
+                @endif
+                <div class="<?= $supplement->is_removed ? 'strike-through' : '' ?>">
+                    <b><?= !!@($supplement->data->name) ? @($supplement->data->name) : '-' ?></b>
+                </div>
+                <?php if ($supplement->is_removed): ?>
+                    @if($supplement->removal_reason_category === 'DURING_VISIT')
+                        <span class="ml-2 text-sm text-secondary">Removed during visit</span>
+                    @elseif($supplement->removal_reason_category === 'ON_INTAKE')
+                        <span class="ml-2 text-sm text-secondary">Removed on intake</span>
+                    @endif
+                <?php elseif ($supplement->added_in_note_id === $note->id): ?>
+                    <?php if ($supplement->addition_reason_category === 'DURING_VISIT'): ?>
+                        <span class="ml-2 text-sm text-success">* Added during visit</span>
+                    <?php else: ?>
+                        <span class="ml-2 text-sm text-info">* Added on intake</span>
+                    <?php endif;?>
+                <?php endif; ?>
+            </div>
+            <?php $review = $supplement->childPlanAddedInNote($note); ?>
+            <?php if(!!$review): ?>
+            <div class="pl-3 mt-1">
+                <div class="text-secondary font-weight-bold">Plan</div>
+                <div>{!! $review->data->value !!}</div>
+            </div>
+            <?php elseif($rel): ?>
+            <div class="relevant-without-plan text-danger text-sm mt-1" data-target-segment="<?= $segment->segmentTemplate->internal_name ?>"><i class="fa fa-exclamation-triangle mr-1"></i>Plan missing</div>
+            <?php endif; ?>
+        </div>
+
+        @endif
+
+    <?php endforeach; ?>
+    @if(!$numVisible)
+        <div class="d-flex align-items-baseline mr-1">
+            <span class="text-secondary">No supplements</span>
+        </div>
+    @endif
+    @if($numRelevant)
+        <div class="d-flex align-items-baseline text-info mr-1 mt-3">
+            <span class="text-sm mr-1"><i class="fa fa-star text-sm"></i></span>
+            <span class="text-sm">Supplements relevant to this note</span>
+        </div>
+    @endif
+<?php endif; ?>
+

+ 307 - 0
resources/views/app/patient/supplements-center.blade.php

@@ -0,0 +1,307 @@
+<?php
+
+use App\Models\Point;
+use App\Models\Client;
+use App\Models\Note;
+use App\Models\Segment;
+
+/** @var Client $patient */
+/** @var Note $note */
+
+list($supplements, $counts) = Point::getPointsOfCategoryExtended($patient, 'SUPPLEMENT', $note);
+
+?>
+
+<div class="mt-3 p-3 border-top min-height-500px" id="supplements-center-{{$note->id}}">
+    <div>
+
+        <table class="table table-sm table-bordered mb-0 bg-white mb-2">
+            <thead>
+            <tr class="">
+                @if($patient->core_note_id !== $note->id)
+                <th class="border-bottom-0 text-secondary text-center width-30px">Rel.</th>
+                @endif
+                <th class="border-bottom-0 text-secondary">Name</th>
+                <th class="border-bottom-0 text-secondary w-25">Review</th>
+                <th class="border-bottom-0 text-secondary w-25">Directions/Plan</th>
+                <th class="border-bottom-0 text-secondary">Active?</th>
+                <th class="border-bottom-0 text-secondary">Started</th>
+                <th class="border-bottom-0 text-secondary">Ended</th>
+                <th class="border-bottom-0 text-secondary">Edit</th>
+            </tr>
+            </thead>
+            <?php $prevRowState = -1; ?>
+            <?php foreach($supplements as $supplement): ?>
+                <?php $point = $supplement; ?>
+                @if($prevRowState !== $supplement->state)
+                    @include('app.patient.wizard-partials.state-row', ['point' => $supplement])
+                @endif
+                <?php $prevRowState = $supplement->state; ?>
+                <?php $rel = $supplement->relevanceToNote($note); ?>
+                <tr class="{{$rel ? 'relevant-to-visit' : ''}}">
+                    @if($patient->core_note_id !== $note->id)
+                        @include('app.patient.wizard-partials.relevance-column', ['point' => $supplement])
+                    @endif
+                    <td>
+                        <div class="d-flex align-items-baseline">
+                            @include('app.patient.wizard-partials.state-icon', ['point' => $supplement])
+                            <div>
+                                <b><?= !!@($supplement->data->name) ? @($supplement->data->name) : '-' ?></b>
+                                @include('app.patient.wizard-partials.state-badge', ['point' => $supplement, 'addedVerb' => 'Prescribed', 'removedVerb' => 'Discontinued'])
+                            </div>
+                        </div>
+                    </td>
+                    <td>
+                        <div class="d-flex align-items-start">
+                            <div class="flex-grow-1">
+                                <?php
+                                $point = $supplement;
+                                include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
+                                ?>
+                            </div>
+                            <div class="d-inline-flex flex-nowrap">
+                                <a class="pl-2 view-review-log"
+                                   native target="_blank"
+                                   open-in-stag-popup
+                                   popup-style="stag-popup-md"
+                                   title="Review log<?= !!@($supplement->data->name) ? ' for ' . @($supplement->data->name) : '' ?>"
+                                   href="/point/review-log/<?= $supplement->uid ?>?popupmode=1">
+                                    <i class="fa fa-history"></i>
+                                </a>
+                            </div>
+                        </div>
+                    </td>
+                    <td>
+                        <div class="d-flex align-items-start">
+                            <div class="flex-grow-1">
+                                <?php
+                                include resource_path('views/app/patient/segment-templates/_child_plan/last-plan.php');
+                                ?>
+                            </div>
+                            <div class="d-inline-flex flex-nowrap">
+                                <a class="pl-2 view-review-log"
+                                   native target="_blank"
+                                   open-in-stag-popup
+                                   popup-style="stag-popup-md"
+                                   title="Plan log<?= !!@($supplement->data->name) ? ' for ' . @($supplement->data->name) : '' ?>"
+                                   href="/point/plan-log/<?= $supplement->uid ?>?popupmode=1">
+                                    <i class="fa fa-history"></i>
+                                </a>
+                                <?php
+                                /*$segment = $note->getSegmentByInternalName('plan_supplements');
+                                if($segment) {
+                                    include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
+                                }*/
+                                ?>
+                            </div>
+                        </div>
+                    </td>
+                    <td>
+                        @if($supplement->is_removed)
+                            NO
+                        @else
+                            <b>YES</b>
+                        @endif
+                    </td>
+                    <td>
+                        <?= !!@($supplement->data->start_date) ? friendly_date($supplement->data->start_date) : '-' ?>
+                        @if(!!@($supplement->data->prescriber))
+                            <div class="mt-1 text-sm text-secondary">By: <?= !!@($supplement->data->prescriber) ? @($supplement->data->prescriber) : '-' ?></div>
+                        @endif
+                    </td>
+                    <td>
+                        <?= !!@($supplement->removal_effective_date) ? friendly_date($supplement->removal_effective_date) : '-' ?>
+                        @if(!!@($supplement->removal_reason_memo))
+                            <div class="mt-1 text-sm text-secondary">By: <?= !!@($supplement->removal_reason_memo) ? @($supplement->removal_reason_memo) : '-' ?></div>
+                        @endif
+                    </td>
+                    <td>
+                        <div moe huge relative>
+                            <a start show href="#" title="Edit">Edit</a>
+                            <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-supplement" right>
+                                <input type="hidden" name="uid" value="<?= $supplement->uid ?>">
+                                <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+                                <p class="mb-2"><b>Update Supplement</b></p>
+
+                                <input type="hidden" name="data" value='{{json_encode($supplement->data)}}'>
+
+                                @if($supplement->added_in_note_id === $note->id)
+
+                                    <input type="hidden" data-name="medId" value="{{@$supplement->data->medId}}">
+                                    <input type="hidden" data-name="routedMedId" value="{{@$supplement->data->routedMedId}}">
+                                    <input type="hidden" data-name="routedDosageFormMedId" value="{{@$supplement->data->routedDosageFormMedId}}">
+                                    <input type="hidden" data-name="gcnSeqno" value="{{@$supplement->data->gcnSeqno}}">
+
+                                    <div class="mb-2">
+                                        <label class="text-sm mb-1 font-weight-bold">Drug</label>
+                                        <input type="text" class="form-control form-control-sm min-width-unset"
+                                               data-name="name"
+                                               value="{{@$supplement->data->name}}"
+                                               stag-suggest
+                                               stag-suggest-ep="/fdb-med-suggest-v2/json">
+                                    </div>
+
+                                @else
+
+                                    <div class="mb-2 bg-light p-2 border">
+                                        <p class="mb-1 font-weight-bold">
+                                        {{ @$supplement->data->name }}
+                                        </p>
+                                        @if($patient->core_note_id !== $note->id)
+                                            <div class="text-secondary text-sm">Clinical details cannot be modified since the supplement was added prior to this visit.</div>
+                                        @else
+                                            <div class="text-secondary text-sm">Clinical details cannot be modified since the supplement was added on a previous visit.</div>
+                                        @endif
+                                    </div>
+
+                                @endif
+
+                                @include('app.patient.wizard-partials.common-fields', ['label' => 'supplement', 'point' => $supplement, 'addVerbPT' => 'Prescribed', 'planLabel' => 'Directions/Plan'])
+
+                                <div class="mt-3 pt-2 d-flex align-items-center border-top">
+                                    <button type="submit" class="btn-save-supplement btn btn-sm btn-primary mr-2">Save</button>
+                                    <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                    </td>
+                </tr>
+            <?php endforeach; ?>
+    </table>
+
+    <div class="d-flex align-items-center">
+        <div class="mt-1 w-100 border p-3 bg-aliceblue border-info rounded">
+            <!--<a href="#" start show class="btn btn-sm btn btn-outline-primary">+ Add new supplement, prescribed during this visit</a>-->
+            <form action="/api/visitPoint/addTopLevel" class="mcp-theme-1 w-100" id="frm-add-supplement" novalidate>
+                <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+                <input type="hidden" name="category" value="SUPPLEMENT">
+                <input type="hidden" name="data">
+
+                <input type="hidden" data-name="medId">
+                <input type="hidden" data-name="routedMedId">
+                <input type="hidden" data-name="routedDosageFormMedId">
+                <input type="hidden" data-name="gcnSeqno">
+
+                <input type="hidden" name="isRemovedDueToEntryError" value="0">
+
+                <div class="row">
+                    <div class="col-8">
+                        <p class="mb-2"><b>Add Supplement</b></p>
+                        <div class="mb-2">
+                            <label class="mb-0 font-weight-bold">Name</label>
+                            <input type="text"
+                                   data-name="name"
+                                   class="form-control form-control-sm"
+                                   stag-suggest
+                                   stag-suggest-bottom-left
+                                   stag-suggest-ep="/fdb-med-suggest-v2/json"
+                                   required>
+                        </div>
+
+                        <?php $point = null; ?>
+                        @include('app.patient.wizard-partials.common-fields', ['label' => 'supplement', 'addVerbPT' => 'Prescribed', 'planLabel' => 'Directions/Plan'])
+
+                    </div>
+                    <div class="col-4 border-left">
+
+                        <?php
+                        $problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEM");
+                        ?>
+                        @if(count($problems))
+                            <h6 class="my-0 font-weight-bold text-secondary mb-2">Active Problems</h6>
+                            <div class="bg-light border px-2 pt-2 pb-1 mb-0">
+                                @foreach($problems as $problem)
+                                    <div class="mb-1">
+                                        <b><?= !!@($problem->data->name) ? @($problem->data->name) : '-' ?></b>
+                                    </div>
+                                @endforeach
+                            </div>
+                            <hr class="my-3 m-neg-3">
+                        @endif
+
+                        <div class="fdb-rx-vigilance max-height-400px overflow-auto">
+
+                        </div>
+                    </div>
+                </div>
+
+                <div class="d-flex align-items-center">
+                    <button type="submit" class="btn btn-sm btn-primary mr-2">Save Supplement</button>
+                    <button type="button" class="btn btn-sm btn-default border-secondary bg-white border mr-2" onclick="return closeStagPopup()">Close</button>
+                </div>
+            </form>
+        </div>
+    </div>
+</div>
+</div>
+
+<script>
+(function() {
+    function init() {
+        let parentSegment = $('#supplements-center-{{$note->id}}');
+        parentSegment.find('input[stag-suggest][data-name="name"]')
+            .off('stag-suggest-selected')
+            .on('stag-suggest-selected', (_e, _input, _data) => {
+                $(_input).closest('form').find('input[data-name="routedMedId"]').val(_data.routed_med_id);
+                $(_input).closest('form').find('input[data-name="routedDosageFormMedId"]').val(_data.routed_dosage_form_med_id);
+                $(_input).closest('form').find('input[data-name="gcnSeqno"]').val(_data.gcn_seqno);
+                $(_input).closest('form').find('input[data-name="medId"]').val(_data.medid);
+
+                $('.fdb-rx-vigilance').html('<span class="text-secondary font-italic">Please wait ...</span>');
+                $.post('/fdb-rx-vigilance/{{$patient->uid}}', {
+                    _token: '{{csrf_token()}}',
+                    medId: _data.medid,
+                    routedMedId: _data.routed_med_id,
+                    routedDosageFormMedId: _data.routed_dosage_form_med_id,
+                    gcnSeqno: _data.gcn_seqno,
+                    name: _input.val(),
+                }, _data => {
+                    $('.fdb-rx-vigilance').html(_data);
+                });
+
+                return false;
+            });
+
+        @include('app.patient.wizard-partials.common-script', ['label' => 'supplement', 'segment_part' => 'supplements'])
+
+        // custom buttons on title bar
+        $('.button-container').remove();
+        let buttonContainer = $('<div/>').addClass('button-container ml-auto mr-3');
+        let titleElem = $('#supplements-center-{{$note->id}}').closest('.stag-popup').find('.stag-popup-title>span');
+        titleElem.next().removeClass('ml-auto');
+        titleElem.parent().addClass('align-items-baseline');
+
+        // add button for "reconcile active supplements"
+        if($('.active-record').length) {
+            $('.btn-reconcile-active-supplements').remove();
+            $('<a ' +
+                'href="/supplements-reconcile/{{$patient->uid}}/{{$note->uid}}" ' +
+                'title="Reconcile Active Supplements" ' +
+                'update-parent ' +
+                'open-in-stag-popup ' +
+                'mc-initer="supplements-reconcile-{{$note->id}}" ' +
+                'popup-style="stag-popup-md" ' +
+                'class="btn-reconcile-active-supplements btn btn-sm mr-2 btn-info text-white font-weight-bold">Reconcile Active Supplements</a>')
+                .appendTo(buttonContainer);
+        }
+
+        // add button for "eRx"
+        $('.btn-manage-erx-supplements').remove();
+        $('<a ' +
+            'href="/patients/view/{{$patient->uid}}/prescriptions-popup?noteUid={{$note->uid}}&erx_category=DRUG" ' +
+            'title="Manage eRx" ' +
+            'update-parent ' +
+            'open-in-stag-popup ' +
+            'mc-initer="prescriptions-popup-{{$patient->id}}" ' +
+            'popup-style="medium" ' +
+            'class="btn-manage-erx-supplements btn btn-sm mr-2 btn-info text-white font-weight-bold">Manage eRx</a>')
+            .appendTo(buttonContainer);
+
+        buttonContainer.insertAfter(titleElem);
+
+        initSegmentMoes(parentSegment);
+        __initRTEs(parentSegment.find('[note-rte]:not(.ql-container)'));
+    }
+    addMCInitializer('supplements-center-{{$note->id}}', init, '#supplements-center-{{$note->id}}');
+}).call(window);
+</script>

+ 89 - 0
resources/views/app/patient/supplements-reconcile.blade.php

@@ -0,0 +1,89 @@
+<?php
+
+use App\Models\Point;
+use App\Models\Client;
+use App\Models\Note;
+
+/** @var Client $patient */
+/** @var Note $note */
+
+$points = Point
+    ::where('client_id', $patient->id)
+    ->where('category', 'SUPPLEMENT')
+    ->where('is_removed_due_to_entry_error', false)
+    ->where('is_removed', false)
+    ->orderBy('created_at')
+    ->get();
+foreach ($points as $point) {
+    if ($point->data) {
+        $point->data = json_decode($point->data);
+    }
+}
+$supplements = $points;
+?>
+
+<div class="mt-3 p-3 border-top" id="supplements-reconcile-{{$note->id}}">
+    <div class="mb-2 font-weight-bold text-secondary">The following supplements will be marked as reconciled</div>
+    <table class="table table-sm table-striped table-bordered">
+        <thead>
+        <tr>
+            <th class="border-bottom-0">Supplement</th>
+            <th class="border-bottom-0">Review</th>
+        </tr>
+        </thead>
+        @foreach($supplements as $supplement)
+        <tr>
+            <td class="w-50">{{$supplement->data->name}}</td>
+            <td class="p-0">
+                <input type="text" class="form-control form-control-sm border-0 rounded-0 shadow-none" data-point-uid="{{$supplement->uid}}" value="Reconciled">
+            </td>
+        </tr>
+        @endforeach
+    </table>
+    <div class="d-flex align-items-center justify-content-center">
+        <button class="btn btn-sm btn-primary mr-2 btn-save-reviews">Save</button>
+        <button class="btn btn-sm btn-default border mr-2" onclick="closeStagPopup()">Cancel</button>
+    </div>
+</div>
+
+<script>
+    (function() {
+        function init() {
+            $('#supplements-reconcile-{{$note->id}} .btn-save-reviews')
+                .off('click')
+                .on('click', function() {
+                    showMask();
+                    let payload = {
+                        noteUid: '{{$note->uid}}',
+                        reviews: []
+                    }
+                    $('#supplements-reconcile-{{$note->id}} [data-point-uid]').each(function() {
+                         payload.reviews.push({
+                             parentPointUid: $(this).attr('data-point-uid'),
+                             data: JSON.stringify({
+                                 isReconciled: true,
+                                 value: $(this).val()
+                             })
+                         });
+                    });
+
+                    $.ajax({
+                        url: '/api/visitPoint/upsertChildReviewMulti',
+                        type:"POST",
+                        data: JSON.stringify(payload),
+                        contentType:"application/json; charset=utf-8",
+                        dataType:"json",
+                        success: function(_data) {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                            }
+                        }
+                    }).then(() => {
+                        hideMask();
+                    });
+
+                });
+        }
+        addMCInitializer('supplements-reconcile-{{$note->id}}', init, '#supplements-reconcile-{{$note->id}}')
+    }).call(window);
+</script>

+ 2 - 0
routes/web.php

@@ -401,6 +401,8 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('/goals-center/{patient}/{note}', 'NoteController@goalsCenter')->name('goals-center');
     Route::get('/allergies-center/{patient}/{note}', 'NoteController@allergiesCenter')->name('allergies-center');
     Route::get('/careteam-center/{patient}/{note}', 'NoteController@careteamCenter')->name('careteam-center');
+    Route::get('/supplements-center/{patient}/{note}', 'NoteController@supplementsCenter')->name('supplements-center');
+    Route::get('/supplements-reconcile/{patient}/{note}', 'NoteController@supplementsReconcile')->name('supplements-reconcile');
     Route::get('/memos-thread/{patient}', 'PatientController@memosThread')->name('memos-thread');
     Route::get('/messages-thread/{patient}', 'PatientController@messagesThread')->name('messages-thread');