瀏覽代碼

Integrate wizards into patient dashboard

Vijayakrishnan 3 年之前
父節點
當前提交
48713c60c0

+ 1 - 1
config/app.php

@@ -65,7 +65,7 @@ return [
 
     'hrm2_url' => env('HRM2_URL'),
 
-    'asset_version' => 18,
+    'asset_version' => 19,
 
     'temp_dir' => env('TEMP_DIR'),
 

+ 143 - 0
public/js/mc.js

@@ -408,3 +408,146 @@ function initPatientPresenceIndicator() {
         }, 15000); // once in 15 seconds
     }
 }
+
+// not really the place for this!
+// find a better place to put this
+window.saveVisitForm = function(_trigger, _silent = false, _close = false) {
+    let form = $(_trigger).closest('form');
+
+    if (!_silent && !form[0].checkValidity()) {
+        form[0].reportValidity();
+        return false;
+    }
+
+    // add [data-name] values to payload
+    let dataField = form.find('[name="data"]').first();
+    let parsed = null;
+    if(dataField.val()) {
+        parsed = JSON.parse(dataField.val());
+    }
+    form.find('[data-name]').each(function() {
+        if(!parsed) parsed = {};
+
+        let keys = $(this).attr('data-name').split('->');
+        let currentNode = parsed;
+        for (let i = 0; i < keys.length; i++) {
+            if(i !== keys.length - 1) {
+                if(typeof currentNode[keys[i]] === 'undefined') {
+                    currentNode[keys[i]] = {};
+                }
+                currentNode = currentNode[keys[i]];
+            }
+            else {
+                if($(this).is(':checkbox')) {
+                    currentNode[keys[i]] = $(this).prop('checked');
+                }
+                else {
+                    currentNode[keys[i]] = $(this).val();
+                }
+            }
+        }
+
+    });
+    if(parsed) {
+        dataField.val(JSON.stringify(parsed));
+    }
+
+    let closeOnSave = false, noteSection = form.closest('.note-section');
+    if($(_trigger).closest('[visit-moe]').is('[close-on-save]')) {
+        closeOnSave = true;
+    }
+
+    // disallow-if-value-same-as
+    let compareWith = false;
+    if(form.find('.disallow-if-value-same-as')) {
+        compareWith = $.trim(form.find('.disallow-if-value-same-as').text());
+        if(compareWith && parsed) {
+            if(!parsed.value) {
+                alert('Value cannot be empty!');
+                return false;
+            }
+            let newValue = $('<div/>').html(parsed.value).text().replace(/[^a-zA-Z0-9]/g, '');
+            if(newValue === '') {
+                alert('Value cannot be empty!');
+                return false;
+            }
+            if(newValue === compareWith) {
+                alert('New value should be different from the previous value!');
+                return false;
+            }
+        }
+    }
+
+    if(!_silent) showMask();
+
+    $.post(form.attr('url'), form.serialize(), _data => {
+        if(!hasResponseError(_data)) {
+            if(!_silent) {
+                hideMask();
+                if(typeof updateAllSegmentsInResponse !== 'undefined' && noteSection.length) {
+                    updateAllSegmentsInResponse(_data);
+                    if (closeOnSave) {
+                        noteSection.removeClass('edit');
+                        let segmentUid = form.find('[name="segmentUid"]').first();
+                        segmentUid = segmentUid.length ? segmentUid.val() : false;
+                        if (segmentUid) {
+                            window.setTimeout(() => {
+                                $('.note-tree-node>a[data-segment-uid="' + segmentUid + '"]').trigger('click');
+                            }, 250);
+                        }
+                    }
+                }
+                if($(_trigger).closest('[visit-moe]').closest('.stag-popup').length) {
+                    refreshDynamicStagPopup();
+                }
+            }
+            if(_close) {
+                closeStagPopup();
+            }
+        }
+    }, 'json');
+    return false;
+};
+window.initSegmentMoes = function(_parent) {
+
+    $('body')
+        .off('mousedown.visit-moe-outside-click')
+        .on('mousedown.visit-moe-outside-click', function (e) {
+            if ($(e.target).closest('[visit-moe]').length ||
+                $(e.target).closest('#create-shortcut-form').length ||
+                $(e.target).is('#create-shortcut-form') ||
+                $(e.target).is('.stag-shortcuts .sc') ||
+                $(e.target).closest('.ui-datepicker').length) {
+                return;
+            }
+            $('[visit-moe] [url]:not([show])').hide();
+        });
+
+    _parent.find('[visit-moe] [submit]')
+        .off('click.visit-moe-submit')
+        .on('click.visit-moe-submit', function() {
+            saveVisitForm(this);
+            return false;
+        });
+
+    _parent.find('[visit-moe]>a[start]')
+        .off('click.visit-moe-show')
+        .on('click.visit-moe-show', function () {
+            $('[visit-moe] [url]:not([show])').hide();
+            $(this)
+                .closest('[visit-moe]')
+                .find('form[url]')
+                .show();
+            return false;
+        });
+
+    _parent.find('[visit-moe] [cancel]')
+        .off('click.visit-moe-cancel')
+        .on('click.visit-moe-cancel', function() {
+            $(this).closest('[visit-moe]').find('[url]:not([show])').hide();
+            if($(this).closest('[visit-moe]').is('[close-on-cancel]')) {
+                $(this).closest('.note-section').removeClass('edit');
+            }
+            return false;
+        });
+};

+ 27 - 6
resources/views/app/patient/allergies-center.blade.php

@@ -31,7 +31,9 @@ $allergies = $points;
         <table class="table table-sm table-bordered table-striped 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">Active?</th>
                 <th class="border-bottom-0 text-secondary">Edit</th>
@@ -52,6 +54,7 @@ $allergies = $points;
             <?php $prevRowRemoved = $allergy->is_removed; ?>
             <?php $rel = $allergy->relevanceToNote($note); ?>
             <tr class="">
+                @if($patient->core_note_id !== $note->id)
                 <td class="text-center">
                     <a href="#" class="toggle-relevance"
                        data-relevant="{{$rel ? '1' : '0'}}"
@@ -65,6 +68,7 @@ $allergies = $points;
                         @endif
                     </a>
                 </td>
+                @endif
                 <td>
                     <div class="d-flex align-items-baseline">
                         @if($allergy->is_removed)
@@ -74,8 +78,14 @@ $allergies = $points;
                         @endif
                         <div>
                             <b><?= !!@($allergy->data->name) ? @($allergy->data->name) : '-' ?></b>
-                            @if(!$allergy->is_removed && $allergy->added_in_note_id === $note->id)
-                                <div class="mt-1 text-sm text-secondary">Added during this visit
+                            @if($allergy->added_in_note_id === $note->id)
+                                <div class="mt-1 text-sm text-secondary">
+                                    Added
+                                    @if($patient->core_note_id !== $note->id)
+                                    during this visit
+                                    @else
+                                    from the patient's chart
+                                    @endif
                                     @if($allergy->addition_reason_category === 'ON_INTAKE')
                                         (existing)
                                     @elseif($allergy->addition_reason_category === 'DURING_VISIT')
@@ -84,7 +94,14 @@ $allergies = $points;
                                 </div>
                             @endif
                             @if($allergy->is_removed && $allergy->removed_in_note_id === $note->id)
-                                <div class="mt-1 text-sm text-secondary">Removed during this visit</div>
+                                <div class="mt-1 text-sm text-secondary">
+                                    Removed
+                                    @if($patient->core_note_id !== $note->id)
+                                        during this visit
+                                    @else
+                                        from the patient's chart
+                                    @endif
+                                </div>
                             @endif
                         </div>
                     </div>
@@ -112,7 +129,7 @@ $allergies = $points;
                                 <input type="hidden" data-name="damConceptIdType" value="{{@$allergy->data->damConceptIdType}}">
 
                                 <div class="mb-2">
-                                    <label class="text-sm text-secondary mb-0">Name</label>
+                                    <label class="text-sm mb-0">Name</label>
                                     <input type="text" data-name="name" class="form-control form-control-sm"
                                            value="{{@$allergy->data->name}}"
                                            stag-suggest
@@ -142,7 +159,11 @@ $allergies = $points;
                                     <p class="mb-1 font-weight-bold">
                                         {{ @$allergy->data->name }}
                                     </p>
-                                    <div class="text-secondary text-sm">Clinical details cannot be modified since the allergy was added prior to this visit.</div>
+                                    @if($patient->core_note_id !== $note->id)
+                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the allergy was added prior to this visit.</div>
+                                    @else
+                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the allergy was added on a previous visit.</div>
+                                    @endif
                                 </div>
 
                             @endif
@@ -299,7 +320,7 @@ $allergies = $points;
                         <div class="col-7">
                             <div class="row mb-2">
                                 <div class="col-12">
-                                    <label class="text-sm text-secondary mb-0">Name</label>
+                                    <label class="text-sm mb-0">Name</label>
                                     <input type="text" data-name="name" class="form-control form-control-sm"
                                            stag-suggest
                                            stag-suggest-ep="/fdb-allergy-suggest/json"

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

@@ -51,6 +51,18 @@
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Allergies</h6>
                         <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
+                        @if($patient->coreNote)
+                            <a native target="_blank"
+                                 class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
+                                 open-in-stag-popup
+                                 mc-initer="allergies-center-{{$patient->coreNote->id}}"
+                                 title="Allergies Center"
+                                 popup-style="wide overflow-visible"
+                                 href="/allergies-center/{{$patient->uid}}/{{$patient->coreNote->uid}}">
+                                <i class="fa fa-bolt mr-1"></i>
+                                <span>Manage</span>
+                            </a>
+                        @endif
                     </div>
                     <div class="bg-light border p-2 mb-3">
                         @foreach($allergies as $allergy)
@@ -84,6 +96,18 @@
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Current Medications</h6>
                         <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
+                        @if($patient->coreNote)
+                            <a native target="_blank"
+                                 class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
+                                 open-in-stag-popup
+                                 mc-initer="medications-center-{{$patient->coreNote->id}}"
+                                 title="Medications Center"
+                                 popup-style="wide overflow-visible"
+                                 href="/medications-center/{{$patient->uid}}/{{$patient->coreNote->uid}}">
+                                <i class="fa fa-bolt mr-1"></i>
+                                <span>Manage</span>
+                            </a>
+                        @endif
                     </div>
                     <div class="bg-light border p-2 mb-3">
                         @foreach($medications as $medication)
@@ -281,6 +305,18 @@
                     <div class="d-flex align-items-center pb-2">
                         <h6 class="my-0 font-weight-bold text-secondary">Current Problems / Focus Areas</h6>
                         <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
+                        @if($patient->coreNote)
+                            <a native target="_blank"
+                               class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
+                               open-in-stag-popup
+                               mc-initer="problems-center-{{$patient->coreNote->id}}"
+                               title="Problems Center"
+                               popup-style="wide overflow-visible"
+                               href="/problems-center/{{$patient->uid}}/{{$patient->coreNote->uid}}">
+                                <i class="fa fa-bolt mr-1"></i>
+                                <span>Manage</span>
+                            </a>
+                        @endif
                     </div>
                     <div class="bg-light border p-2 mb-3">
                         @foreach($problems as $problem)

+ 25 - 4
resources/views/app/patient/goals-center.blade.php

@@ -32,7 +32,9 @@ $goals = $points;
         <table class="table table-sm table-bordered table-striped 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">Goal</th>
                 <th class="border-bottom-0 text-secondary">Category</th>
                 <th class="border-bottom-0 text-secondary w-25">Directions</th>
@@ -54,6 +56,7 @@ $goals = $points;
             <?php $prevRowRemoved = $goal->is_removed; ?>
             <?php $rel = $goal->relevanceToNote($note); ?>
             <tr class="">
+                @if($patient->core_note_id !== $note->id)
                 <td class="text-center">
                     <a href="#" class="toggle-relevance"
                        data-relevant="{{$rel ? '1' : '0'}}"
@@ -67,6 +70,7 @@ $goals = $points;
                         @endif
                     </a>
                 </td>
+                @endif
                 <td>
                     <div class="d-flex align-items-baseline">
                         @if($goal->is_removed)
@@ -76,8 +80,14 @@ $goals = $points;
                         @endif
                         <div>
                             <b><?= !!@($goal->data->goal) ? @($goal->data->goal) : '-' ?></b>
-                            @if(!$goal->is_removed && $goal->added_in_note_id === $note->id)
-                                <div class="mt-1 text-sm text-secondary">Added during this visit
+                            @if($goal->added_in_note_id === $note->id)
+                                <div class="mt-1 text-sm text-secondary">
+                                    Added
+                                    @if($patient->core_note_id !== $note->id)
+                                        during this visit
+                                    @else
+                                        from the patient's chart
+                                    @endif
                                     @if($goal->addition_reason_category === 'ON_INTAKE')
                                         (existing)
                                     @elseif($goal->addition_reason_category === 'DURING_VISIT')
@@ -86,7 +96,14 @@ $goals = $points;
                                 </div>
                             @endif
                             @if($goal->is_removed && $goal->removed_in_note_id === $note->id)
-                                <div class="mt-1 text-sm text-secondary">Removed during this visit</div>
+                                <div class="mt-1 text-sm text-secondary">
+                                    Removed
+                                    @if($patient->core_note_id !== $note->id)
+                                        during this visit
+                                    @else
+                                        from the patient's chart
+                                    @endif
+                                </div>
                             @endif
                         </div>
                     </div>
@@ -240,7 +257,11 @@ $goals = $points;
                                     <p class="mb-1 font-weight-bold">
                                         {{ @$goal->data->name }}
                                     </p>
-                                    <div class="text-secondary text-sm">Clinical details cannot be modified since the goal was added prior to this visit.</div>
+                                    @if($patient->core_note_id !== $note->id)
+                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the goal was added prior to this visit.</div>
+                                    @else
+                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the goal was added on a previous visit.</div>
+                                    @endif
                                 </div>
 
                             @endif

+ 25 - 4
resources/views/app/patient/medications-center.blade.php

@@ -31,7 +31,9 @@ $medications = $points;
         <table class="table table-sm table-bordered table-striped 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">Directions</th>
                 <th class="border-bottom-0 text-secondary">Active?</th>
@@ -52,6 +54,7 @@ $medications = $points;
             <?php $prevRowRemoved = $medication->is_removed; ?>
             <?php $rel = $medication->relevanceToNote($note); ?>
             <tr class="{{$medication->is_removed ? '' : ''}}">
+                @if($patient->core_note_id !== $note->id)
                 <td class="text-center">
                     <a href="#" class="toggle-relevance"
                        data-relevant="{{$rel ? '1' : '0'}}"
@@ -65,6 +68,7 @@ $medications = $points;
                         @endif
                     </a>
                 </td>
+                @endif
                 <td>
                     <div class="d-flex align-items-baseline">
                         @if($medication->is_removed)
@@ -74,8 +78,14 @@ $medications = $points;
                         @endif
                         <div>
                             <b><?= !!@($medication->data->name) ? @($medication->data->name) : '-' ?></b>
-                            @if(!$medication->is_removed && $medication->added_in_note_id === $note->id)
-                                <div class="mt-1 text-sm text-secondary">Added during this visit
+                            @if($medication->added_in_note_id === $note->id)
+                                <div class="mt-1 text-sm text-secondary">
+                                    Added
+                                    @if($patient->core_note_id !== $note->id)
+                                        during this visit
+                                    @else
+                                        from the patient's chart
+                                    @endif
                                     @if($medication->addition_reason_category === 'ON_INTAKE')
                                         (existing)
                                     @elseif($medication->addition_reason_category === 'DURING_VISIT')
@@ -84,7 +94,14 @@ $medications = $points;
                                 </div>
                             @endif
                             @if($medication->is_removed && $medication->removed_in_note_id === $note->id)
-                                <div class="mt-1 text-sm text-secondary">Discontinued during this visit</div>
+                                <div class="mt-1 text-sm text-secondary">
+                                    Discontinued
+                                    @if($patient->core_note_id !== $note->id)
+                                        during this visit
+                                    @else
+                                        from the patient's chart
+                                    @endif
+                                </div>
                             @endif
                         </div>
                     </div>
@@ -175,7 +192,11 @@ $medications = $points;
                                     <p class="mb-1 font-weight-bold">
                                     {{ @$medication->data->name }}
                                     </p>
-                                    <div class="text-secondary text-sm">Clinical details cannot be modified since the medication was added prior to this visit.</div>
+                                    @if($patient->core_note_id !== $note->id)
+                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the medication was added prior to this visit.</div>
+                                    @else
+                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the medication was added on a previous visit.</div>
+                                    @endif
                                 </div>
 
                             @endif

+ 9 - 5
resources/views/app/patient/note/plan-log.blade.php

@@ -5,11 +5,15 @@
             <?php $numPlans++; ?>
             <div class="border mb-3">
                 <div class="border-bottom p-2">
-                    <span class="text-secondary text-sm">Created on: </span>
-                    <a native target="_blank" class="text-sm"
-                       href="<?= route('patients.view.notes.view.dashboard', ['patient' => $record->client, 'note' => $record->note]) ?>">
-                        <?= friendlier_date_time($record->created_at) ?>
-                    </a>
+                    <span class="text-secondary text-sm">Created on </span>
+                    @if($record->client->core_note_id !== $record->note->id)
+                        <a native target="_blank" class="text-sm"
+                           href="<?= route('patients.view.notes.view.dashboard', ['patient' => $record->client, 'note' => $record->note]) ?>">
+                            <?= friendlier_date_time($record->created_at) ?>
+                        </a>
+                    @else
+                        <span class="text-sm"><?= friendlier_date_time($record->created_at) ?> from the patient's chart</span>
+                    @endif
                 </div>
                 <div class="p-2">
                     <?php

+ 9 - 5
resources/views/app/patient/note/review-log.blade.php

@@ -5,11 +5,15 @@
             <?php $numReviews++; ?>
             <div class="border mb-3">
                 <div class="border-bottom p-2">
-                    <span class="text-secondary text-sm">Reviewed on: </span>
-                    <a native target="_blank" class="text-sm"
-                       href="<?= route('patients.view.notes.view.dashboard', ['patient' => $record->client, 'note' => $record->note]) ?>">
-                        <?= friendlier_date_time($record->created_at) ?>
-                    </a>
+                    <span class="text-secondary text-sm">Reviewed on </span>
+                    @if($record->client->core_note_id !== $record->note->id)
+                        <a native target="_blank" class="text-sm"
+                           href="<?= route('patients.view.notes.view.dashboard', ['patient' => $record->client, 'note' => $record->note]) ?>">
+                            <?= friendlier_date_time($record->created_at) ?>
+                        </a>
+                    @else
+                        <span class="text-sm"><?= friendlier_date_time($record->created_at) ?> from the patient's chart</span>
+                    @endif
                 </div>
                 <div class="p-2">
                     <?php

+ 0 - 140
resources/views/app/patient/note/segment_script.blade.php

@@ -90,146 +90,6 @@
             saveVisitForm(_trigger, true, true);
         };
 
-        function saveVisitForm(_trigger, _silent = false, _close = false) {
-            let form = $(_trigger).closest('form');
-
-            if (!_silent && !form[0].checkValidity()) {
-                form[0].reportValidity();
-                return false;
-            }
-
-            // add [data-name] values to payload
-            let dataField = form.find('[name="data"]').first();
-            let parsed = null;
-            if(dataField.val()) {
-                parsed = JSON.parse(dataField.val());
-            }
-            form.find('[data-name]').each(function() {
-                if(!parsed) parsed = {};
-
-                let keys = $(this).attr('data-name').split('->');
-                let currentNode = parsed;
-                for (let i = 0; i < keys.length; i++) {
-                    if(i !== keys.length - 1) {
-                        if(typeof currentNode[keys[i]] === 'undefined') {
-                            currentNode[keys[i]] = {};
-                        }
-                        currentNode = currentNode[keys[i]];
-                    }
-                    else {
-                        if($(this).is(':checkbox')) {
-                            currentNode[keys[i]] = $(this).prop('checked');
-                        }
-                        else {
-                            currentNode[keys[i]] = $(this).val();
-                        }
-                    }
-                }
-
-            });
-            if(parsed) {
-                dataField.val(JSON.stringify(parsed));
-            }
-
-            let closeOnSave = false, noteSection = form.closest('.note-section');
-            if($(_trigger).closest('[visit-moe]').is('[close-on-save]')) {
-                closeOnSave = true;
-            }
-
-            // disallow-if-value-same-as
-            let compareWith = false;
-            if(form.find('.disallow-if-value-same-as')) {
-                compareWith = $.trim(form.find('.disallow-if-value-same-as').text());
-                if(compareWith && parsed) {
-                    if(!parsed.value) {
-                        alert('Value cannot be empty!');
-                        return false;
-                    }
-                    let newValue = $('<div/>').html(parsed.value).text().replace(/[^a-zA-Z0-9]/g, '');
-                    if(newValue === '') {
-                        alert('Value cannot be empty!');
-                        return false;
-                    }
-                    if(newValue === compareWith) {
-                        alert('New value should be different from the previous value!');
-                        return false;
-                    }
-                }
-            }
-
-            if(!_silent) showMask();
-
-            $.post(form.attr('url'), form.serialize(), _data => {
-                if(!hasResponseError(_data)) {
-                    if(!_silent) {
-                        hideMask();
-                        updateAllSegmentsInResponse(_data);
-                        if (closeOnSave) {
-                            noteSection.removeClass('edit');
-                            let segmentUid = form.find('[name="segmentUid"]').first();
-                            segmentUid = segmentUid.length ? segmentUid.val() : false;
-                            if (segmentUid) {
-                                window.setTimeout(() => {
-                                    $('.note-tree-node>a[data-segment-uid="' + segmentUid + '"]').trigger('click');
-                                }, 250);
-                            }
-                        }
-                        if($(_trigger).closest('[visit-moe]').closest('.stag-popup').length) {
-                            refreshDynamicStagPopup();
-                        }
-                    }
-                    if(_close) {
-                        closeStagPopup();
-                    }
-                }
-            }, 'json');
-            return false;
-        }
-
-        window.initSegmentMoes = function(_parent) {
-
-            $('body')
-                .off('mousedown.visit-moe-outside-click')
-                .on('mousedown.visit-moe-outside-click', function (e) {
-                    if ($(e.target).closest('[visit-moe]').length ||
-                        $(e.target).closest('#create-shortcut-form').length ||
-                        $(e.target).is('#create-shortcut-form') ||
-                        $(e.target).is('.stag-shortcuts .sc') ||
-                        $(e.target).closest('.ui-datepicker').length) {
-                        return;
-                    }
-                    $('[visit-moe] [url]:not([show])').hide();
-                });
-
-            _parent.find('[visit-moe] [submit]')
-                .off('click.visit-moe-submit')
-                .on('click.visit-moe-submit', function() {
-                    saveVisitForm(this);
-                    return false;
-                });
-
-            _parent.find('[visit-moe]>a[start]')
-                .off('click.visit-moe-show')
-                .on('click.visit-moe-show', function () {
-                    $('[visit-moe] [url]:not([show])').hide();
-                    $(this)
-                        .closest('[visit-moe]')
-                        .find('form[url]')
-                        .show();
-                    return false;
-                });
-
-            _parent.find('[visit-moe] [cancel]')
-                .off('click.visit-moe-cancel')
-                .on('click.visit-moe-cancel', function() {
-                    $(this).closest('[visit-moe]').find('[url]:not([show])').hide();
-                    if($(this).closest('[visit-moe]').is('[close-on-cancel]')) {
-                        $(this).closest('.note-section').removeClass('edit');
-                    }
-                    return false;
-                });
-        }
-
         function initRTEs(_parent) {
             _parent.find('[note-rte]:not(.ql-container)').each(function() {
 

+ 27 - 4
resources/views/app/patient/problems-center.blade.php

@@ -29,6 +29,7 @@ $ccSegment = $note->getSegmentByInternalName('chief_complaint');
 <div class="mt-3 p-3 border-top min-height-500px" id="problems-center-{{$note->id}}">
     <div>
 
+        @if($patient->core_note_id !== $note->id)
         <div class="d-flex align-items-baseline">
             <div class="mb-2 font-weight-bold font-size-14 text-secondary">Chief Complaint</div>
             <span class="mx-2 text-secondary">|</span>
@@ -37,12 +38,15 @@ $ccSegment = $note->getSegmentByInternalName('chief_complaint');
         <textarea rows="3" readonly class="cc-readonly form-control form-control-sm mb-0 bg-light"><?= $ccSegment && @$ccSegment->summary_html ? trim(strip_tags($ccSegment->summary_html)) : '' ?></textarea>
 
         <hr class="m-neg-3 my-3">
+        @endif
 
         <div class="mb-2 font-weight-bold font-size-14 text-secondary">Problems</div>
         <table class="table table-sm table-bordered table-striped 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">Active?</th>
                 <th class="border-bottom-0 text-secondary">Edit</th>
@@ -63,6 +67,7 @@ $ccSegment = $note->getSegmentByInternalName('chief_complaint');
             <?php $prevRowRemoved = $problem->is_removed; ?>
             <?php $rel = $problem->relevanceToNote($note); ?>
             <tr class="">
+                @if($patient->core_note_id !== $note->id)
                 <td class="text-center">
                     <a href="#" class="toggle-relevance"
                        data-relevant="{{$rel ? '1' : '0'}}"
@@ -76,6 +81,7 @@ $ccSegment = $note->getSegmentByInternalName('chief_complaint');
                         @endif
                     </a>
                 </td>
+                @endif
                 <td>
                     <div class="d-flex align-items-baseline">
                         @if($problem->is_removed)
@@ -85,8 +91,14 @@ $ccSegment = $note->getSegmentByInternalName('chief_complaint');
                         @endif
                         <div>
                             <b><?= !!@($problem->data->name) ? @($problem->data->name) : '-' ?></b>
-                            @if(!$problem->is_removed && $problem->added_in_note_id === $note->id)
-                                <div class="mt-1 text-sm text-secondary">Added during this visit
+                            @if($problem->added_in_note_id === $note->id)
+                                <div class="mt-1 text-sm text-secondary">
+                                    Added
+                                    @if($patient->core_note_id !== $note->id)
+                                        during this visit
+                                    @else
+                                        from the patient's chart
+                                    @endif
                                     @if($problem->addition_reason_category === 'ON_INTAKE')
                                         (existing)
                                     @elseif($problem->addition_reason_category === 'DURING_VISIT')
@@ -95,7 +107,14 @@ $ccSegment = $note->getSegmentByInternalName('chief_complaint');
                                 </div>
                             @endif
                             @if($problem->is_removed && $problem->removed_in_note_id === $note->id)
-                                <div class="mt-1 text-sm text-secondary">Removed during this visit</div>
+                                <div class="mt-1 text-sm text-secondary">
+                                    Removed
+                                    @if($patient->core_note_id !== $note->id)
+                                        during this visit
+                                    @else
+                                        from the patient's chart
+                                    @endif
+                                </div>
                             @endif
                         </div>
                     </div>
@@ -161,7 +180,11 @@ $ccSegment = $note->getSegmentByInternalName('chief_complaint');
                                     <p class="mb-1 font-weight-bold">
                                         {{ @$problem->data->name }}
                                     </p>
-                                    <div class="text-secondary text-sm">Clinical details cannot be modified since the problem was added prior to this visit.</div>
+                                    @if($patient->core_note_id !== $note->id)
+                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the problem was added prior to this visit.</div>
+                                    @else
+                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the problem was added on a previous visit.</div>
+                                    @endif
                                 </div>
 
                             @endif