Browse Source

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

= 3 năm trước cách đây
mục cha
commit
742c7cfe54
46 tập tin đã thay đổi với 1255 bổ sung521 xóa
  1. 1 1
      app/Http/Controllers/NoteController.php
  2. 1 1
      config/app.php
  3. 26 12
      public/css/style.css
  4. 2 1
      public/js/mc.js
  5. 1 1
      public/js/stag-popup.js
  6. 90 55
      public/js/stag-suggest.js
  7. 8 3
      public/js/stag-table-filter.js
  8. 7 0
      resources/views/app/new-patient.blade.php
  9. 100 44
      resources/views/app/patient/allergies-center.blade.php
  10. 101 45
      resources/views/app/patient/careteam-center.blade.php
  11. 100 44
      resources/views/app/patient/goals-center.blade.php
  12. 97 48
      resources/views/app/patient/medications-center.blade.php
  13. 146 0
      resources/views/app/patient/note/_create-bill-only.blade.php
  14. 11 16
      resources/views/app/patient/note/dashboard.blade.php
  15. 20 0
      resources/views/app/patient/note/dashboard_script.blade.php
  16. 1 1
      resources/views/app/patient/note/segment.blade.php
  17. 28 6
      resources/views/app/patient/prescriptions/list.blade.php
  18. 92 54
      resources/views/app/patient/problems-center.blade.php
  19. 77 0
      resources/views/app/patient/segment-templates/_child_plan/edit-plan-in-place.php
  20. 83 0
      resources/views/app/patient/segment-templates/_child_review/edit-review-in-place.php
  21. 23 8
      resources/views/app/patient/segment-templates/history_family/summary.blade.php
  22. 18 15
      resources/views/app/patient/segment-templates/history_screenings/summary.blade.php
  23. 2 3
      resources/views/app/patient/segment-templates/history_social/summary.blade.php
  24. 2 3
      resources/views/app/patient/segment-templates/history_surgical/summary.blade.php
  25. 6 5
      resources/views/app/patient/segment-templates/intake_allergies/summary.blade.php
  26. 16 15
      resources/views/app/patient/segment-templates/intake_behavior/summary.blade.php
  27. 4 3
      resources/views/app/patient/segment-templates/intake_care_team/summary.blade.php
  28. 7 8
      resources/views/app/patient/segment-templates/intake_exercise/summary.blade.php
  29. 4 3
      resources/views/app/patient/segment-templates/intake_goals/summary.blade.php
  30. 6 5
      resources/views/app/patient/segment-templates/intake_medications/summary.blade.php
  31. 4 3
      resources/views/app/patient/segment-templates/intake_nutrition/summary.blade.php
  32. 4 3
      resources/views/app/patient/segment-templates/intake_problems/summary.blade.php
  33. 2 3
      resources/views/app/patient/segment-templates/past_medical_history/summary.blade.php
  34. 4 4
      resources/views/app/patient/segment-templates/plan_allergies/summary.blade.php
  35. 22 21
      resources/views/app/patient/segment-templates/plan_behavior/summary.blade.php
  36. 11 10
      resources/views/app/patient/segment-templates/plan_care_team/summary.blade.php
  37. 19 20
      resources/views/app/patient/segment-templates/plan_exercise/summary.blade.php
  38. 4 3
      resources/views/app/patient/segment-templates/plan_goals/summary.blade.php
  39. 4 3
      resources/views/app/patient/segment-templates/plan_medications/summary.blade.php
  40. 21 18
      resources/views/app/patient/segment-templates/plan_nutrition/summary.blade.php
  41. 4 3
      resources/views/app/patient/segment-templates/plan_problems/summary.blade.php
  42. 53 15
      resources/views/app/patient/segment-templates/ros/edit.blade.php
  43. 2 3
      resources/views/app/patient/segment-templates/ros/summary.blade.php
  44. 4 4
      resources/views/app/patient/segment-templates/vitals/edit.blade.php
  45. 8 8
      resources/views/app/patient/wizard-partials/common-script.blade.php
  46. 9 0
      resources/views/app/video/call-minimal.blade.php

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

@@ -357,7 +357,7 @@ class NoteController extends Controller
     public function noteSegmentView(Request $request, Client $patient, Note $note, Segment $segment, $segmentInternalName, $view) {
         return view("app.patient.segment-templates.{$segmentInternalName}.{$view}", [
             'patient' => $patient,
-            'note' => $patient->coreNote,
+            'note' => $note,
             'segment' => $segment,
             'segmentInternalName' => $segmentInternalName
         ]);

+ 1 - 1
config/app.php

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

+ 26 - 12
public/css/style.css

@@ -361,6 +361,9 @@ body>nav.navbar {
 .mcp-theme-1 .min-width-70px {
     min-width: 70px !important;
 }
+.mcp-theme-1 .min-width-80px {
+    min-width: 80px !important;
+}
 .mcp-theme-1 .width-90px {
     width: 90px !important;
 }
@@ -2493,22 +2496,28 @@ table.table-cage {
 }
 
 table.table-cage tr:first-child td {
-	border-top: 0px;
+    border-top: 0;
 }
 
 table.table-cage tr:last-child td {
-	border-bottom: 0px;
+    border-bottom: 0;
 }
 
 table.table-cage tr td:first-child {
-	border-left: 0px;
+    border-left: 0;
 }
 
 table.table-cage tr td:last-child {
-	border-right: 0px;
+    border-right: 0;
+    border-left: 0 !important;
+}
+
+table.table-cage tr td:nth-last-child(2) {
+    border-right: 0 !important;
 }
+
 table.table-xs tr td {
-	padding: 0.15rem;
+    padding: 0.15rem;
 }
 
 [if-edit-mode], [if-read-mode] {
@@ -2520,25 +2529,30 @@ table.table-xs tr td {
 .read [if-read-mode] {
     display: block;
 }
-.rspace input[type="radio"]:checked {
+
+/* colored radios */
+.rspace input[type="radio"][value="-"]:checked,
+.rspace input[type="radio"][value="+"]:checked{
     position: relative;
 }
-.rspace input[type="radio"]:checked:before,
-.rspace input[type="radio"]:checked:after {
+.rspace input[type="radio"][value="-"]:checked:before,
+.rspace input[type="radio"][value="+"]:checked:before,
+.rspace input[type="radio"][value="-"]:checked:after,
+.rspace input[type="radio"][value="+"]:checked:after{
     content: '';
     position: absolute;
     border-radius: 100%;
     background:#fff;
 }
-
-/* colored radios */
-.rspace input[type="radio"]:checked:before {
+.rspace input[type="radio"][value="-"]:checked:before,
+.rspace input[type="radio"][value="+"]:checked:before{
     top: 0;
     left: 0;
     width: 100%;
     height: 100%;
 }
-.rspace input[type="radio"]:checked:after {
+.rspace input[type="radio"][value="-"]:checked:after,
+.rspace input[type="radio"][value="+"]:checked:after{
     top: 3px;
     left: 3px;
     width: calc(100% - 6px);

+ 2 - 1
public/js/mc.js

@@ -489,6 +489,7 @@ window.fillJsonDataField = function(form, field = "data") {
     if(parsed) {
         dataField.val(JSON.stringify(parsed));
     }
+    return parsed;
 }
 window.saveVisitForm = function(_trigger, _silent = false, _close = false, _doneCallback = null) {
     let form = $(_trigger).closest('form');
@@ -498,7 +499,7 @@ window.saveVisitForm = function(_trigger, _silent = false, _close = false, _done
         return false;
     }
 
-    fillJsonDataField(form);
+    let parsed = fillJsonDataField(form);
 
     let closeOnSave = false, noteSection = form.closest('.note-section');
     if($(_trigger).closest('[visit-moe]').is('[close-on-save]')) {

+ 1 - 1
public/js/stag-popup.js

@@ -230,7 +230,7 @@ function hasResponseError(_data) {
                 if(e.which === 27) {
                     if(!isEventConsumed(e)) {
                         if(stagPopupsQueue.length) {
-                            if($('.stag-popup.show [moe] [url]:visible').length || $('.stag-popup.show [visit-moe] [url]:visible').length) {
+                            if($('.stag-popup.show [moe] [url]:not([show]):visible').length || $('.stag-popup.show [visit-moe] [url]:not([show]):visible').length) {
                                 return;
                             }
                             closeStagPopup();

+ 90 - 55
public/js/stag-suggest.js

@@ -18,71 +18,99 @@
         var lastTerm = '';
         var returnedFunction = debounce(function (elem) {
             let term = elem.val();
-            if (!!term) {
-                let ep = $(elem).attr('stag-suggest-ep');
-                $.get(ep + '?term=' + $.trim(term), function (_data) {
-
-                    /*
-                    expected return format:
-                    {
-                        success: true,
-                        data: [
-                            {
-                                x: ...,
-                                y: ...,
-                                text: ...    // "text" key is "mandatory"
-                            },
-                            {
-                                x: ...,
-                                y: ...,
-                                text: ...    // "text" key is "mandatory"
-                            },
-                            ...
-                        ]
-                    }
-                     */
+            let ep = $(elem).attr('stag-suggest-ep');
+            if(!!ep) { // remote lookup
+                if (!!term) {
 
-                    suggestionsOuter.empty();
-                    if(!hasResponseError(_data) && _data.data && _data.data.length) {
-                        for (let i = 0; i < _data.data.length; i++) {
-                            let item = $('<a native href="#" class="d-block suggest-item stag-suggest text-nowrap"/>');
-                            for(let x in _data.data[i]) {
-                                if(_data.data[i].hasOwnProperty(x) && x !== 'text') {
-                                    item.attr('data-' + x, _data.data[i][x]);
+                    $.get(ep + '?term=' + $.trim(term), function (_data) {
+
+                        /*
+                        expected return format:
+                        {
+                            success: true,
+                            data: [
+                                {
+                                    x: ...,
+                                    y: ...,
+                                    text: ...    // "text" key is "mandatory"
+                                },
+                                {
+                                    x: ...,
+                                    y: ...,
+                                    text: ...    // "text" key is "mandatory"
+                                },
+                                ...
+                            ]
+                        }
+                         */
+
+                        suggestionsOuter.empty();
+                        if(!hasResponseError(_data) && _data.data && _data.data.length) {
+                            for (let i = 0; i < _data.data.length; i++) {
+                                let item = $('<a native href="#" class="d-block suggest-item stag-suggest text-nowrap"/>');
+                                for(let x in _data.data[i]) {
+                                    if(_data.data[i].hasOwnProperty(x) && x !== 'text') {
+                                        item.attr('data-' + x, _data.data[i][x]);
+                                    }
                                 }
+                                item.data('suggest-data', _data.data[i]);
+                                item.html(_data.data[i].text);
+                                if(_data.data[i].sub_text) {
+                                    item.append($('<span/>')
+                                        .addClass('ml-1 text-sm text-secondary')
+                                        .append(' (')
+                                        .append(_data.data[i].sub_text)
+                                        .append(')')
+                                    );
+                                }
+                                if(_data.data[i].text2) {
+                                    item.append($('<div/>')
+                                        .addClass('text-sm text-secondary')
+                                        .html(_data.data[i].text2)
+                                    );
+                                }
+                                if(_data.data[i].tooltip) {
+                                    item.attr('title', _data.data[i].tooltip);
+                                }
+                                suggestionsOuter.append(item);
                             }
-                            item.data('suggest-data', _data.data[i]);
-                            item.html(_data.data[i].text);
-                            if(_data.data[i].sub_text) {
-                                item.append($('<span/>')
-                                    .addClass('ml-1 text-sm text-secondary')
-                                    .append(' (')
-                                    .append(_data.data[i].sub_text)
-                                    .append(')')
-                                );
-                            }
-                            if(_data.data[i].text2) {
-                                item.append($('<div/>')
-                                    .addClass('text-sm text-secondary')
-                                    .html(_data.data[i].text2)
-                                );
-                            }
-                            if(_data.data[i].tooltip) {
-                                item.attr('title', _data.data[i].tooltip);
-                            }
+                        }
+                        else {
+                            suggestionsOuter.html('<span class="d-block no-suggest-items">No matches!</span>');
+                        }
+
+                        suggestionsOuter.removeClass('d-none');
+                    }, 'json');
+                    lastTerm = term;
+                } else {
+                    suggestionsOuter.addClass('d-none');
+                }
+            }
+            else { // local lookup
+                let optionList = $(elem).next().next('.data-option-list');
+                if(optionList.length) {
+                    let matches = [];
+                    optionList.find('>div').each(function() {
+                        if(!term || $(this).text().toLowerCase().indexOf(term.toLowerCase()) !== -1) {
+                            matches.push($(this).text());
+                        }
+                    });
+                    suggestionsOuter.empty();
+                    if(matches.length) {
+                        for (let i = 0; i < matches.length; i++) {
+                            let item = $('<a native href="#" class="d-block suggest-item stag-suggest text-nowrap"/>');
+                            item.data('suggest-data', {});
+                            item.html(matches[i]);
                             suggestionsOuter.append(item);
                         }
                     }
                     else {
                         suggestionsOuter.html('<span class="d-block no-suggest-items">No matches!</span>');
                     }
-
                     suggestionsOuter.removeClass('d-none');
-                }, 'json');
-                lastTerm = term;
-            } else {
-                suggestionsOuter.addClass('d-none');
+                }
             }
+
         }, 250);
 
         function handleKeydown(elem, e) {
@@ -135,7 +163,7 @@
 
         function handleKeypress(elem, e) {
             var term = $.trim(elem.val());
-            if (!!term) {
+            if (!!term || !$(elem).is('[stag-suggest-ep]')) {
                 suggestionsOuter
                     .html('<span class="d-block no-suggest-items">Searching...</span>')
                     .removeClass('d-none');
@@ -153,6 +181,13 @@
                 '</div>').insertAfter(elem);
 
             elem
+                .off('focus.stag-suggest')
+                .on('focus.stag-suggest', function (e) {
+                    if(!$(this).is('[stag-suggest-ep]')) {
+                        suggestionsOuter = $(this).next('.stag-suggestions-container').find('>.suggestions-outer');
+                        return handleKeypress($(this), e);
+                    }
+                })
                 .off('keydown.stag-suggest')
                 .on('keydown.stag-suggest', function (e) {
                     suggestionsOuter = $(this).next('.stag-suggestions-container').find('>.suggestions-outer');

+ 8 - 3
public/js/stag-table-filter.js

@@ -51,9 +51,14 @@
             .off('keyup.stag-table-filter')
             .on('keyup.stag-table-filter', 'input[stag-table-filter]', function(_e) {
                 if(_e.which === 27) {
-                    $(this).val('');
-                    applyFilter($(this));
-                    return false;
+                    if(!isEventConsumed(e)) {
+                        if ($(this).val() !== '') {
+                            $(this).val('');
+                            applyFilter($(this));
+                            markEventAsConsumed(_e);
+                            return false;
+                        }
+                    }
                 }
             })
     }

+ 7 - 0
resources/views/app/new-patient.blade.php

@@ -162,6 +162,13 @@ $medicaidStates = Config::get('constants.medicaid_states');
 								<input class='form-control' type='text' required="" name='initiative' />
 							</div>
 
+							<div class='form-group mb-3 checkbox'>
+								<label>
+									<input type='checkbox' name='isTestRecord' />	
+									This is a test record
+								</label>
+							</div>
+
 						</div>
 						<div class="col-md-7">
 							<div class="border-lighter">

+ 100 - 44
resources/views/app/patient/allergies-center.blade.php

@@ -41,7 +41,7 @@ function isFavoriteAllergy($_allergy, $_favorites) {
             </label>
         </div>
 
-        <table class="table table-sm table-bordered mb-0 bg-white mb-2 point-table">
+        <table class="table table-sm table-bordered mb-0 bg-white mb-2 point-table read">
             <thead>
             <tr class="">
                 @if($patient->core_note_id !== $note->id)
@@ -149,55 +149,73 @@ function isFavoriteAllergy($_allergy, $_favorites) {
                     </div>
                 </td>
                 <td>
-                    <div class="d-flex align-items-start">
-                        <div class="flex-grow-1">
-                            <?php
-                            $point = $allergy;
-                            include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
-                            ?>
-                        </div>
-                        <div class="d-inline-flex flex-column ml-1">
-                            <a class="px-1 view-review-log"
-                               native target="_blank"
-                               open-in-stag-popup
-                               popup-style="stag-popup-md"
-                               title="Subjective log<?= !!@($allergy->data->name) ? ' for ' . @($allergy->data->name) : '' ?>"
-                               href="/point/review-log/<?= $allergy->uid ?>?popupmode=1">
-                                <i class="fa fa-history"></i>
-                            </a>
-                            <?php
-                            $segment = $note->getSegmentByInternalName('intake_allergies');
-                            if($segment) {
-                                include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
-                            }
-                            ?>
+                    <?php $segment = $note->getSegmentByInternalName('intake_allergies'); ?>
+                    <div if-read-mode>
+                        <div class="d-flex align-items-start">
+                            <div class="flex-grow-1">
+                                <?php
+                                $point = $allergy;
+                                include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
+                                ?>
+                            </div>
+                            <div class="d-inline-flex flex-column ml-1">
+                                <a class="px-1 view-review-log"
+                                   native target="_blank"
+                                   open-in-stag-popup
+                                   popup-style="stag-popup-md"
+                                   title="Subjective log<?= !!@($allergy->data->name) ? ' for ' . @($allergy->data->name) : '' ?>"
+                                   href="/point/review-log/<?= $allergy->uid ?>?popupmode=1">
+                                    <i class="fa fa-history"></i>
+                                </a>
+                                <?php
+                                if($segment) {
+                                    include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
+                                }
+                                ?>
+                            </div>
                         </div>
                     </div>
+                    <div if-edit-mode>
+                        <?php
+                        if($segment) {
+                            include resource_path('views/app/patient/segment-templates/_child_review/edit-review-in-place.php');
+                        }
+                        ?>
+                    </div>
                 </td>
                 <td>
-                    <div class="d-flex align-items-start position-relative">
-                        <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-column ml-1">
-                            <a class="px-1 view-review-log"
-                               native target="_blank"
-                               open-in-stag-popup
-                               popup-style="stag-popup-md"
-                               title="Plan log<?= !!@($allergy->data->name) ? ' for ' . @($allergy->data->name) : '' ?>"
-                               href="/point/plan-log/<?= $allergy->uid ?>?popupmode=1">
-                                <i class="fa fa-history"></i>
-                            </a>
-                            <?php
-                            $segment = $note->getSegmentByInternalName('plan_allergies');
-                            if($segment) {
-                                include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
-                            }
-                            ?>
+                    <?php $segment = $note->getSegmentByInternalName('plan_allergies'); ?>
+                    <div if-read-mode>
+                        <div class="d-flex align-items-start position-relative">
+                            <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-column ml-1">
+                                <a class="px-1 view-review-log"
+                                   native target="_blank"
+                                   open-in-stag-popup
+                                   popup-style="stag-popup-md"
+                                   title="Plan log<?= !!@($allergy->data->name) ? ' for ' . @($allergy->data->name) : '' ?>"
+                                   href="/point/plan-log/<?= $allergy->uid ?>?popupmode=1">
+                                    <i class="fa fa-history"></i>
+                                </a>
+                                <?php
+                                if($segment) {
+                                    include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
+                                }
+                                ?>
+                            </div>
                         </div>
                     </div>
+                    <div if-edit-mode>
+                        <?php
+                        if($segment) {
+                            include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan-in-place.php');
+                        }
+                        ?>
+                    </div>
                 </td>
                 <td>
                     <div class="position-relative c-pointer stag-tooltip">
@@ -325,6 +343,44 @@ function isFavoriteAllergy($_allergy, $_favorites) {
                     $(this).closest('.on-click-menu').find('[menu]').hide();
                     return false;
                 });
+
+            let mode = 'read';
+
+            // custom buttons on title bar
+            $('.button-container').remove();
+            let buttonContainer = $('<div/>').addClass('button-container ml-4 mr-auto');
+            let titleElem = $('#allergies-center-{{$note->id}}').closest('.stag-popup').find('.stag-popup-title>span');
+            titleElem.next().removeClass('ml-auto');
+            titleElem.parent().addClass('align-items-center');
+
+            // add button for "Edit Mode"
+            $('.btn-toggle-edit-mode').remove();
+            let button = $('<a href="#" native target="_blank" data-mode="read" ' +
+                'class="btn-toggle-edit-mode btn btn-sm mr-2 btn-info text-white font-weight-bold shadow-none">Switch to Edit Mode</a>')
+                .appendTo(buttonContainer);
+
+            $('<div class="d-inline-flex align-self-stretch align-items-center">' +
+                '<span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>' +
+                '<span class="autosave-indicator saved text-sm text-secondary">' +
+                '<i class="fa fa-check"></i>' +
+                ' Saved' +
+                '</span>' +
+                '</div>').appendTo(buttonContainer);
+
+            button
+                .off('click.toggle-edit')
+                .on('click.toggle-edit', function () {
+                    if (mode === 'read') {
+                        mode = 'edit';
+                        $(this).text('Back to Read Mode');
+                        $('#allergies-center-{{$note->id}} .point-table').removeClass('read').addClass('edit');
+                    } else {
+                        refreshDynamicStagPopup();
+                    }
+                    return false;
+                });
+
+            buttonContainer.insertAfter(titleElem);
         }
         addMCInitializer('allergies-center-{{$note->id}}', init, '#allergies-center-{{$note->id}}');
     }).call(window);

+ 101 - 45
resources/views/app/patient/careteam-center.blade.php

@@ -14,7 +14,7 @@ list($careTeamMembers, $counts) = Point::getPointsOfCategoryExtended($patient, '
 <div class="mt-3 p-3 border-top min-height-500px" id="careteam-center-{{$note->id}}">
     <div class="point-table-container">
 
-        <table class="table table-sm table-bordered mb-0 bg-white mb-2 point-table">
+        <table class="table table-sm table-bordered mb-0 bg-white mb-2 point-table read">
             <thead>
             <tr class="">
                 @if($patient->core_note_id !== $note->id)
@@ -153,55 +153,73 @@ list($careTeamMembers, $counts) = Point::getPointsOfCategoryExtended($patient, '
                     </div>
                 </td>
                 <td>
-                    <div class="d-flex align-items-start">
-                        <div class="flex-grow-1">
-                            <?php
-                            $point = $careTeamMember;
-                            include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
-                            ?>
-                        </div>
-                        <div class="d-inline-flex flex-column ml-1">
-                            <a class="px-1 view-review-log"
-                               native target="_blank"
-                               open-in-stag-popup
-                               popup-style="stag-popup-md"
-                               title="Subjective log<?= !!@($careTeamMember->data->name) ? ' for ' . @($careTeamMember->data->name) : '' ?>"
-                               href="/point/review-log/<?= $careTeamMember->uid ?>?popupmode=1">
-                                <i class="fa fa-history"></i>
-                            </a>
-                            <?php
-                            $segment = $note->getSegmentByInternalName('intake_care_team');
-                            if($segment) {
-                                include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
-                            }
-                            ?>
+                    <?php $segment = $note->getSegmentByInternalName('intake_care_team'); ?>
+                    <div if-read-mode>
+                        <div class="d-flex align-items-start">
+                            <div class="flex-grow-1">
+                                <?php
+                                $point = $careTeamMember;
+                                include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
+                                ?>
+                            </div>
+                            <div class="d-inline-flex flex-column ml-1">
+                                <a class="px-1 view-review-log"
+                                   native target="_blank"
+                                   open-in-stag-popup
+                                   popup-style="stag-popup-md"
+                                   title="Subjective log<?= !!@($careTeamMember->data->name) ? ' for ' . @($careTeamMember->data->name) : '' ?>"
+                                   href="/point/review-log/<?= $careTeamMember->uid ?>?popupmode=1">
+                                    <i class="fa fa-history"></i>
+                                </a>
+                                <?php
+                                if($segment) {
+                                    include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
+                                }
+                                ?>
+                            </div>
                         </div>
                     </div>
+                    <div if-edit-mode>
+                        <?php
+                        if($segment) {
+                            include resource_path('views/app/patient/segment-templates/_child_review/edit-review-in-place.php');
+                        }
+                        ?>
+                    </div>
                 </td>
                 <td>
-                    <div class="d-flex align-items-start position-relative">
-                        <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-column ml-1">
-                            <a class="px-1 view-review-log"
-                               native target="_blank"
-                               open-in-stag-popup
-                               popup-style="stag-popup-md"
-                               title="Plan log<?= !!@($careTeamMember->data->name) ? ' for ' . @($careTeamMember->data->name) : '' ?>"
-                               href="/point/plan-log/<?= $careTeamMember->uid ?>?popupmode=1">
-                                <i class="fa fa-history"></i>
-                            </a>
-                            <?php
-                            $segment = $note->getSegmentByInternalName('plan_care_team');
-                            if($segment) {
-                                include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
-                            }
-                            ?>
+                    <?php $segment = $note->getSegmentByInternalName('plan_care_team'); ?>
+                    <div if-read-mode>
+                        <div class="d-flex align-items-start position-relative">
+                            <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-column ml-1">
+                                <a class="px-1 view-review-log"
+                                   native target="_blank"
+                                   open-in-stag-popup
+                                   popup-style="stag-popup-md"
+                                   title="Plan log<?= !!@($careTeamMember->data->name) ? ' for ' . @($careTeamMember->data->name) : '' ?>"
+                                   href="/point/plan-log/<?= $careTeamMember->uid ?>?popupmode=1">
+                                    <i class="fa fa-history"></i>
+                                </a>
+                                <?php
+                                if($segment) {
+                                    include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
+                                }
+                                ?>
+                            </div>
                         </div>
                     </div>
+                    <div if-edit-mode>
+                        <?php
+                        if($segment) {
+                            include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan-in-place.php');
+                        }
+                        ?>
+                    </div>
                 </td>
                 <td>
                     <?= '<span class="text-secondary">Ph: </span>' . (!!@($careTeamMember->data->phone) ? @($careTeamMember->data->phone) : '-') ?><br>
@@ -250,7 +268,7 @@ list($careTeamMembers, $counts) = Point::getPointsOfCategoryExtended($patient, '
                                 <div class="col-6">
                                     <label class="text-sm mb-1 font-weight-bold">Specialty</label>
                                     <input type="text" class="form-control form-control-sm min-width-unset"
-                                           data-option-list="specialty"
+                                           stag-suggest
                                            data-name="specialty">
                                     <div class="data-option-list">
                                         <div>Allergy and immunology</div>
@@ -331,6 +349,44 @@ list($careTeamMembers, $counts) = Point::getPointsOfCategoryExtended($patient, '
 
             initSegmentMoes($('#careteam-center-{{$note->id}}'));
             __initRTEs(parentSegment.find('[note-rte]:not(.ql-container)'));
+
+            let mode = 'read';
+
+            // custom buttons on title bar
+            $('.button-container').remove();
+            let buttonContainer = $('<div/>').addClass('button-container ml-4 mr-auto');
+            let titleElem = $('#careteam-center-{{$note->id}}').closest('.stag-popup').find('.stag-popup-title>span');
+            titleElem.next().removeClass('ml-auto');
+            titleElem.parent().addClass('align-items-center');
+
+            // add button for "Edit Mode"
+            $('.btn-toggle-edit-mode').remove();
+            let button = $('<a href="#" native target="_blank" data-mode="read" ' +
+                'class="btn-toggle-edit-mode btn btn-sm mr-2 btn-info text-white font-weight-bold shadow-none">Switch to Edit Mode</a>')
+                .appendTo(buttonContainer);
+
+            $('<div class="d-inline-flex align-self-stretch align-items-center">' +
+                '<span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>' +
+                '<span class="autosave-indicator saved text-sm text-secondary">' +
+                '<i class="fa fa-check"></i>' +
+                ' Saved' +
+                '</span>' +
+                '</div>').appendTo(buttonContainer);
+
+            button
+                .off('click.toggle-edit')
+                .on('click.toggle-edit', function () {
+                    if (mode === 'read') {
+                        mode = 'edit';
+                        $(this).text('Back to Read Mode');
+                        $('#careteam-center-{{$note->id}} .point-table').removeClass('read').addClass('edit');
+                    } else {
+                        refreshDynamicStagPopup();
+                    }
+                    return false;
+                });
+
+            buttonContainer.insertAfter(titleElem);
         }
         addMCInitializer('careteam-center-{{$note->id}}', init, '#careteam-center-{{$note->id}}');
     }).call(window);

+ 100 - 44
resources/views/app/patient/goals-center.blade.php

@@ -14,7 +14,7 @@ list($goals, $counts) = Point::getPointsOfCategoryExtended($patient, 'GOAL', $no
 <div class="mt-3 p-3 border-top min-height-500px" id="goals-center-{{$note->id}}">
     <div class="point-table-container">
 
-        <table class="table table-sm table-bordered mb-0 bg-white mb-2 point-table">
+        <table class="table table-sm table-bordered mb-0 bg-white mb-2 point-table read">
             <thead>
             <tr class="">
                 @if($patient->core_note_id !== $note->id)
@@ -96,55 +96,73 @@ list($goals, $counts) = Point::getPointsOfCategoryExtended($patient, 'GOAL', $no
                     </div>
                 </td>
                 <td>
-                    <div class="d-flex align-items-start">
-                        <div class="flex-grow-1">
-                            <?php
-                            $point = $goal;
-                            include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
-                            ?>
-                        </div>
-                        <div class="d-inline-flex flex-column ml-1">
-                            <a class="px-1 view-review-log"
-                               native target="_blank"
-                               open-in-stag-popup
-                               popup-style="stag-popup-md"
-                               title="Subjective log<?= !!@($goal->data->goal) ? ' for ' . @($goal->data->goal) : '' ?>"
-                               href="/point/review-log/<?= $goal->uid ?>?popupmode=1">
-                                <i class="fa fa-history"></i>
-                            </a>
-                            <?php
-                            $segment = $note->getSegmentByInternalName('intake_goals');
-                            if($segment) {
-                                include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
-                            }
-                            ?>
+                    <?php $segment = $note->getSegmentByInternalName('intake_goals'); ?>
+                    <div if-read-mode>
+                        <div class="d-flex align-items-start">
+                            <div class="flex-grow-1">
+                                <?php
+                                $point = $goal;
+                                include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
+                                ?>
+                            </div>
+                            <div class="d-inline-flex flex-column ml-1">
+                                <a class="px-1 view-review-log"
+                                   native target="_blank"
+                                   open-in-stag-popup
+                                   popup-style="stag-popup-md"
+                                   title="Subjective log<?= !!@($goal->data->goal) ? ' for ' . @($goal->data->goal) : '' ?>"
+                                   href="/point/review-log/<?= $goal->uid ?>?popupmode=1">
+                                    <i class="fa fa-history"></i>
+                                </a>
+                                <?php
+                                if($segment) {
+                                    include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
+                                }
+                                ?>
+                            </div>
                         </div>
                     </div>
+                    <div if-edit-mode>
+                        <?php
+                        if($segment) {
+                            include resource_path('views/app/patient/segment-templates/_child_review/edit-review-in-place.php');
+                        }
+                        ?>
+                    </div>
                 </td>
                 <td>
-                    <div class="d-flex align-items-start position-relative">
-                        <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-column ml-1">
-                            <a class="px-1 view-review-log"
-                               native target="_blank"
-                               open-in-stag-popup
-                               popup-style="stag-popup-md"
-                               title="Plan log<?= !!@($goal->data->goal) ? ' for ' . @($goal->data->goal) : '' ?>"
-                               href="/point/plan-log/<?= $goal->uid ?>?popupmode=1">
-                                <i class="fa fa-history"></i>
-                            </a>
-                            <?php
-                            $segment = $note->getSegmentByInternalName('plan_goals');
-                            if($segment) {
-                                include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
-                            }
-                            ?>
+                    <?php $segment = $note->getSegmentByInternalName('plan_goals'); ?>
+                    <div if-read-mode>
+                        <div class="d-flex align-items-start position-relative">
+                            <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-column ml-1">
+                                <a class="px-1 view-review-log"
+                                   native target="_blank"
+                                   open-in-stag-popup
+                                   popup-style="stag-popup-md"
+                                   title="Plan log<?= !!@($goal->data->goal) ? ' for ' . @($goal->data->goal) : '' ?>"
+                                   href="/point/plan-log/<?= $goal->uid ?>?popupmode=1">
+                                    <i class="fa fa-history"></i>
+                                </a>
+                                <?php
+                                if($segment) {
+                                    include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
+                                }
+                                ?>
+                            </div>
                         </div>
                     </div>
+                    <div if-edit-mode>
+                        <?php
+                        if($segment) {
+                            include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan-in-place.php');
+                        }
+                        ?>
+                    </div>
                 </td>
                 <td>
                     <div class="position-relative c-pointer stag-tooltip">
@@ -226,6 +244,44 @@ list($goals, $counts) = Point::getPointsOfCategoryExtended($patient, 'GOAL', $no
 
             initSegmentMoes($('#goals-center-{{$note->id}}'));
             __initRTEs(parentSegment.find('[note-rte]:not(.ql-container)'));
+
+            let mode = 'read';
+
+            // custom buttons on title bar
+            $('.button-container').remove();
+            let buttonContainer = $('<div/>').addClass('button-container ml-4 mr-auto');
+            let titleElem = $('#goals-center-{{$note->id}}').closest('.stag-popup').find('.stag-popup-title>span');
+            titleElem.next().removeClass('ml-auto');
+            titleElem.parent().addClass('align-items-center');
+
+            // add button for "Edit Mode"
+            $('.btn-toggle-edit-mode').remove();
+            let button = $('<a href="#" native target="_blank" data-mode="read" ' +
+                'class="btn-toggle-edit-mode btn btn-sm mr-2 btn-info text-white font-weight-bold shadow-none">Switch to Edit Mode</a>')
+                .appendTo(buttonContainer);
+
+            $('<div class="d-inline-flex align-self-stretch align-items-center">' +
+                '<span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>' +
+                '<span class="autosave-indicator saved text-sm text-secondary">' +
+                '<i class="fa fa-check"></i>' +
+                ' Saved' +
+                '</span>' +
+                '</div>').appendTo(buttonContainer);
+
+            button
+                .off('click.toggle-edit')
+                .on('click.toggle-edit', function () {
+                    if (mode === 'read') {
+                        mode = 'edit';
+                        $(this).text('Back to Read Mode');
+                        $('#goals-center-{{$note->id}} .point-table').removeClass('read').addClass('edit');
+                    } else {
+                        refreshDynamicStagPopup();
+                    }
+                    return false;
+                });
+
+            buttonContainer.insertAfter(titleElem);
         }
         addMCInitializer('goals-center-{{$note->id}}', init, '#goals-center-{{$note->id}}');
     }).call(window);

+ 97 - 48
resources/views/app/patient/medications-center.blade.php

@@ -35,7 +35,7 @@ function isFavoriteMedication($_medication, $_favorites) {
             </label>
         </div>
 
-        <table class="table table-sm table-bordered mb-0 bg-white mb-2 point-table">
+        <table class="table table-sm table-bordered mb-0 bg-white mb-2 point-table read">
             <thead>
             <tr class="">
                 @if($patient->core_note_id !== $note->id)
@@ -147,55 +147,73 @@ function isFavoriteMedication($_medication, $_favorites) {
                         </div>
                     </td>
                     <td>
-                        <div class="d-flex align-items-start">
-                            <div class="flex-grow-1">
-                                <?php
-                                $point = $medication;
-                                include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
-                                ?>
-                            </div>
-                            <div class="d-inline-flex flex-column ml-1">
-                                <a class="px-1 view-review-log"
-                                   native target="_blank"
-                                   open-in-stag-popup
-                                   popup-style="stag-popup-md"
-                                   title="Subjective log<?= !!@($medication->data->name) ? ' for ' . @($medication->data->name) : '' ?>"
-                                   href="/point/review-log/<?= $medication->uid ?>?popupmode=1">
-                                    <i class="fa fa-history"></i>
-                                </a>
-                                <?php
-                                $segment = $note->getSegmentByInternalName('intake_medications');
-                                if($segment) {
-                                    include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
-                                }
-                                ?>
+                        <?php $segment = $note->getSegmentByInternalName('intake_medications'); ?>
+                        <div if-read-mode>
+                            <div class="d-flex align-items-start">
+                                <div class="flex-grow-1">
+                                    <?php
+                                    $point = $medication;
+                                    include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
+                                    ?>
+                                </div>
+                                <div class="d-inline-flex flex-column ml-1">
+                                    <a class="px-1 view-review-log"
+                                       native target="_blank"
+                                       open-in-stag-popup
+                                       popup-style="stag-popup-md"
+                                       title="Subjective log<?= !!@($medication->data->name) ? ' for ' . @($medication->data->name) : '' ?>"
+                                       href="/point/review-log/<?= $medication->uid ?>?popupmode=1">
+                                        <i class="fa fa-history"></i>
+                                    </a>
+                                    <?php
+                                    if($segment) {
+                                        include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
+                                    }
+                                    ?>
+                                </div>
                             </div>
                         </div>
+                        <div if-edit-mode>
+                            <?php
+                            if($segment) {
+                                include resource_path('views/app/patient/segment-templates/_child_review/edit-review-in-place.php');
+                            }
+                            ?>
+                        </div>
                     </td>
                     <td>
-                        <div class="d-flex align-items-start position-relative">
-                            <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-column ml-1">
-                                <a class="px-1 view-review-log"
-                                   native target="_blank"
-                                   open-in-stag-popup
-                                   popup-style="stag-popup-md"
-                                   title="Plan log<?= !!@($medication->data->name) ? ' for ' . @($medication->data->name) : '' ?>"
-                                   href="/point/plan-log/<?= $medication->uid ?>?popupmode=1">
-                                    <i class="fa fa-history"></i>
-                                </a>
-                                <?php
-                                $segment = $note->getSegmentByInternalName('plan_medications');
-                                if($segment) {
-                                    include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
-                                }
-                                ?>
+                        <?php $segment = $note->getSegmentByInternalName('plan_medications'); ?>
+                        <div if-read-mode>
+                            <div class="d-flex align-items-start position-relative">
+                                <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-column ml-1">
+                                    <a class="px-1 view-review-log"
+                                       native target="_blank"
+                                       open-in-stag-popup
+                                       popup-style="stag-popup-md"
+                                       title="Plan log<?= !!@($medication->data->name) ? ' for ' . @($medication->data->name) : '' ?>"
+                                       href="/point/plan-log/<?= $medication->uid ?>?popupmode=1">
+                                        <i class="fa fa-history"></i>
+                                    </a>
+                                    <?php
+                                    if($segment) {
+                                        include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
+                                    }
+                                    ?>
+                                </div>
                             </div>
                         </div>
+                        <div if-edit-mode>
+                            <?php
+                            if($segment) {
+                                include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan-in-place.php');
+                            }
+                            ?>
+                        </div>
                     </td>
                     <td>
                         <div class="position-relative c-pointer stag-tooltip">
@@ -337,11 +355,25 @@ function isFavoriteMedication($_medication, $_favorites) {
 
         // custom buttons on title bar
         $('.button-container').remove();
-        let buttonContainer = $('<div/>').addClass('button-container ml-auto mr-3');
+        let buttonContainer = $('<div/>').addClass('button-container ml-4 mr-2 d-inline-flex align-items-center flex-grow-1');
         let titleElem = $('#medications-center-{{$note->id}}').closest('.stag-popup').find('.stag-popup-title>span');
-        titleElem.next().removeClass('ml-auto');
+        titleElem.next().removeClass('ml-4');
         titleElem.parent().addClass('align-items-baseline');
 
+        // add button for "Edit Mode"
+        $('.btn-toggle-edit-mode').remove();
+        let button = $('<a href="#" native target="_blank" data-mode="read" ' +
+            'class="btn-toggle-edit-mode btn btn-sm btn-info text-white font-weight-bold shadow-none">Switch to Edit Mode</a>')
+            .appendTo(buttonContainer);
+
+        $('<div class="d-inline-flex align-self-stretch align-items-center ml-3 mr-auto">' +
+            '<span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>' +
+            '<span class="autosave-indicator saved text-sm text-secondary">' +
+            '<i class="fa fa-check"></i>' +
+            ' Saved' +
+            '</span>' +
+            '</div>').appendTo(buttonContainer);
+
         // add button for "reconcile active medications"
         if($('.active-record').length) {
             $('.btn-reconcile-active').remove();
@@ -352,7 +384,7 @@ function isFavoriteMedication($_medication, $_favorites) {
                 'open-in-stag-popup ' +
                 'mc-initer="medications-reconcile-{{$note->id}}" ' +
                 'popup-style="medium" ' +
-                'class="btn-reconcile-active btn btn-sm mr-2 btn-info text-white font-weight-bold">Reconcile Active Medications</a>')
+                'class="btn-reconcile-active btn btn-sm mr-2 btn-primary text-white font-weight-bold">Reconcile Active Medications</a>')
                 .appendTo(buttonContainer);
         }
 
@@ -361,7 +393,7 @@ function isFavoriteMedication($_medication, $_favorites) {
         $('<a ' +
             'href="#" ' +
             'data-non-segment-target="Prescriptions" ' +
-            'class="btn-manage-erx btn btn-sm mr-2 btn-info text-white font-weight-bold">Manage eRx</a>')
+            'class="btn-manage-erx btn btn-sm mr-2 btn-primary text-white font-weight-bold">Manage eRx</a>')
             .appendTo(buttonContainer);
 
         buttonContainer.insertAfter(titleElem);
@@ -385,6 +417,23 @@ function isFavoriteMedication($_medication, $_favorites) {
                 $(this).closest('.on-click-menu').find('[menu]').hide();
                 return false;
             });
+
+        let mode = 'read';
+
+        button
+            .off('click.toggle-edit')
+            .on('click.toggle-edit', function () {
+                if (mode === 'read') {
+                    mode = 'edit';
+                    $(this).text('Back to Read Mode');
+                    $('#medications-center-{{$note->id}} .point-table').removeClass('read').addClass('edit');
+                } else {
+                    refreshDynamicStagPopup();
+                }
+                return false;
+            });
+
+        buttonContainer.insertAfter(titleElem);
     }
     addMCInitializer('medications-center-{{$note->id}}', init, '#medications-center-{{$note->id}}');
 }).call(window);

+ 146 - 0
resources/views/app/patient/note/_create-bill-only.blade.php

@@ -0,0 +1,146 @@
+<?php $noteRates = $note->hcpPro->noteRates(); ?>
+@if($note->hasTreatmentServicesBillByHCP())
+    <div class="text-secondary">
+        <i class="fa fa-check"></i>
+        Bill Created
+    </div>
+@else
+    @if(!$note->is_bill_closed && !$note->is_billing_marked_done)
+        <div moe wide class="">
+            <a class="font-weight-bold text-info" href="" show start>+ Bill</a>
+            <form url="/api/bill/createForNote" right>
+                <?php $maxMinutes = 30; ?>
+                @if($noteRates && count($noteRates))
+                    <input type="hidden" name="noteUid" value="{{$note->uid}}">
+                    <div class="mb-2">
+                        <label for="" class="text-secondary text-sm">Effective Date</label>
+                        <input type="date" name="effectiveDate" class="form-control form-control-sm" value="{{$note->effective_dateest ? $note->effective_dateest : date('Y-m-d')}}" required>
+                    </div>
+                    <div class="mb-2">
+                        @if($noteRates && count($noteRates))
+                            @if(count($noteRates) === 1)
+                                <input type="hidden" name="code" value="{{$noteRates[0]->code}}">
+                                <p class="mb-2">Service: <b>{{ $noteRates[0]->code }} (${{ $noteRates[0]->amount }}/hr)</b></p>
+                            @else
+                                <select autofocus class="form-control" name="code" onchange="switchCoNumberOfUnitsByType(this)">
+                                    <option value="">-- Select Code --</option>
+                                    @foreach($noteRates as $noteRate)
+                                        <option data-amount="{{ $noteRate->amount }}" value="{{ $noteRate->code }}">
+                                            {{ $noteRate->code }} (${{ $noteRate->amount }}{{ $noteRate->code === 'Treatment Services' ? '/hr' : '' }})
+                                        </option>
+                                    @endforeach
+                                </select>
+                            @endif
+                        @endif
+                    </div>
+
+                    <?php
+                        $maxMinutes = 120;
+                        if($note->new_or_fu_or_na === 'NEW') {
+                            $maxMinutes = 90;
+                        }
+                        else if($note->new_or_fu_or_na === 'FU') {
+                            if($note->method === 'VIDEO') {
+                                $maxMinutes = 75;
+                            }
+                            else if($note->method === 'AUDIO') {
+                                $maxMinutes = 60;
+                            }
+                        }
+                    ?>
+
+                    @if($noteRates && count($noteRates) && count($noteRates) === 1)
+                        @if(strpos(strtolower($noteRates[0]->code), "treatment services") !== FALSE)
+                            <div class="mb-2">
+                                <select name="numberOfUnits" class="form-control form-control-sm"
+                                        onchange="calculateCoBillAmount(this)">
+                                    <option value=""> -- select -- </option>
+                                    <?php for ($i = 5; $i <= $maxMinutes; $i+=5) { ?>
+                                    <option value="{{ $i/60 }}" {{ $i === 30 ? 'selected' : '' }}>{{ $i }} minutes</option>
+                                    <?php } ?>
+                                </select>
+                            </div>
+                            <div class="mb-2" calculated-co-amount></div>
+                        @else
+                            <input type="hidden" name="numberOfUnits" value="1">
+                        @endif
+                    @endif
+                    <div class="bill-conditional">
+
+                    </div>
+
+                    @if(@$note && $note->hcpPro->id === $pro->id)
+                    <div class="my-3">
+                        <input type="checkbox" name="signAndMarkBillingDone" checked>&nbsp;Sign and Mark Billing Done
+                    </div>
+                    @endif
+
+                    <div class="">
+                        <button class="btn btn-primary btn-sm" submit>Submit</button>
+                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                    </div>
+                @else
+                    <div class="border rounded bg-aliceblue p-2 width-200px">
+                        <i class="fa fa-exclamation-triangle text-warning-mellow mr-1"></i>
+                        Payment rates not yet set for Treatment Services. Please contact admin.
+                    </div>
+                @endif
+            </form>
+            <div class="d-none" hourly-co-template>
+                <div class="mb-2">
+                    <select name="numberOfUnits" class="form-control form-control-sm"
+                            onchange="calculateCoBillAmount(this)">
+                        <option value=""> -- select -- </option>
+                        <?php for ($i = 5; $i <= $maxMinutes; $i+=5) { ?>
+                            <option value="{{ $i/60 }}" {{ $i === 30 ? 'selected' : '' }}>{{ $i }} minutes</option>
+                        <?php } ?>
+                    </select>
+                </div>
+                <div class="mb-2" calculated-co-amount></div>
+            </div>
+            <div class="d-none" non-hourly-co-template>
+                <input type="hidden" name="numberOfUnits" value="1">
+            </div>
+        </div>
+    @endif
+
+    <script>
+        (function() {
+            let selectedCodeHourlyRate = 0;
+            @if($noteRates && count($noteRates) && count($noteRates) === 1)
+                selectedCodeHourlyRate = {{ $noteRates[0]->amount }};
+            @endif
+            window.switchCoNumberOfUnitsByType = function(_trigger) {
+                let container = $('.bill-conditional').empty();
+                let selected  = $(_trigger).find('option:selected');
+                if(!selected.length) return;
+                let clone = null;
+                selectedCodeHourlyRate = +selected.attr('data-amount');
+                $('[calculated-co-amount]').text('');
+                if(selected.text().toLowerCase().indexOf('treatment services') !== -1) {
+                    clone = $('[hourly-co-template]').clone()
+                        .removeAttr('hourly-co-template')
+                        .removeClass('d-none');
+                }
+                else {
+                    clone = $('[non-hourly-co-template]').clone()
+                        .removeAttr('non-hourly-co-template')
+                        .removeClass('d-none');
+                }
+                clone.appendTo(container)
+                clone.focus();
+            }
+            window.calculateCoBillAmount = function(_trigger) {
+                let amountTarget = $('[calculated-co-amount]');
+                _trigger = $(_trigger);
+                if(!_trigger.find('option:selected').length) {
+                    amountTarget.text('');
+                    return;
+                }
+                let hours = +_trigger.find('option:selected').attr('value');
+                amountTarget.html('<b>Reimbursable Amount:</b> $' + (hours * selectedCodeHourlyRate).toFixed(2));
+            }
+        })();
+
+    </script>
+@endif

+ 11 - 16
resources/views/app/patient/note/dashboard.blade.php

@@ -340,9 +340,16 @@
                     <div>
 
                         @if($note->is_signed_by_hcp )
-                            <div class="text-secondary">
-                                <i class="fa fa-check"></i>
-                                Note Signed
+                            <div class="d-flex align-items-baseline">
+                                <div class="text-secondary">
+                                    <i class="fa fa-check"></i>
+                                    Note Signed
+                                </div>
+                                @if($pro->pro_type === 'ADMIN' || ($note->hcpPro && $pro->id === $note->hcpPro->id))
+                                    <div class="ml-3">
+                                        @include('app/patient/note/_create-bill-only')
+                                    </div>
+                                @endif
                             </div>
                         @endif
                         @if(!$note->is_signed_by_hcp )
@@ -379,7 +386,7 @@
                     </div>
                 </div>
                 @if($note->allyPro && $pro->id === $note->allyPro->id)
-                <div class="mx-4">
+                <div class="mx-3">
                     <div>
                         @if($note->is_signed_by_ally)
                             <span class="text-secondary">
@@ -2435,18 +2442,6 @@
                                 <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="medium-large 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"

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

@@ -185,6 +185,20 @@
                             return false;
                         }
 
+                        <?php
+                        $rosSegment = $note->getSegmentByInternalName('ros');
+                        ?>
+                        @if($rosSegment)
+                        if(editParent.is('[data-segment-template-name="ros"]')) {
+                            openDynamicStagPopup('/note-segment-view/{{$note->client->uid}}/{{$note->uid}}/{{$rosSegment->uid}}/ros/edit',
+                                'init-ros-{{$note->id}}',
+                                'Review of Systems',
+                                false,
+                                "medium-large overflow-visible");
+                            return false;
+                        }
+                        @endif
+
                         // OPEN popup for if note-segment-view exists
                         if($('.' + editParent.attr('data-segment-template-name') + '-trigger').length) {
                             $('.' + editParent.attr('data-segment-template-name') + '-trigger').trigger('click');
@@ -197,6 +211,12 @@
                         else {
                             $('.note-section.edit').removeClass('edit');
                             editParent.addClass('edit');
+                            editParent[0].scrollIntoView({
+                                behavior: 'auto',
+                                block: "start",
+                                inline: "center"
+                            });
+                            $('html').scrollTop($('html').scrollTop() - 60);
                             if(editParent.find('[autofocus]').length) {
                                 editParent.find('[autofocus]').first().focus();
                             }

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

@@ -119,7 +119,7 @@
         'intake_supplements',
         'plan_supplements',
     ];
-    if(!in_array($iName, $wizardPowered)) { ?>
+    if(!in_array($iName, $wizardPowered) && $iName !== 'ros') { ?>
     <div class="d-none if-edit edit-container">
         {!! $segment->edit_html !!}
     </div>

+ 28 - 6
resources/views/app/patient/prescriptions/list.blade.php

@@ -208,16 +208,38 @@
                     <a href="#" v-on:click.prevent="setAddMode('')" class="ml-auto">Close</a>
                 </div>
                 <table class="m-0 table table-sm border bg-white table-hover table-bordered">
-                    <tr>
-                        <th class="align-bottom">Medication</th>
-                        <th class="align-bottom">Instructions<br>To Pharmacist</th>
+                    <tr class="bg-light">
+                        <th class="align-bottom text-secondary">Medication</th>
+                        <!--<th class="align-bottom">Instructions<br>To Pharmacist</th>
                         <th class="align-bottom">Dispense</th>
-                        <th class="align-bottom">Refills</th>
+                        <th class="align-bottom">Refills</th>-->
+                        <th class="align-bottom text-secondary">Instructions/Dispense/Refills</th>
                         <th class="align-bottom">&nbsp;</th>
                     </tr>
                     <tr v-for="drug in existingDrugs" v-if="notAlreadyAdded(drug.data.name)">
                         <td class="width-200px">@{{ drug.data.name }}</td>
-                        <td class="bg-white py-0 px-0">
+                        <td>
+                            <div class="d-flex align-items-center mb-1">
+                                <span class="text-sm min-width-80px">Instructions<br>to Pharmacist</span>
+                                <input type="text" class="form-control form-control-sm min-width-unset shadow-none flex-grow-1" v-model="drug.data.instructions">
+                            </div>
+                            <div class="row mb-1">
+                                <div class="col-6 pr-0">
+                                    <div class="d-flex align-items-center">
+                                        <span class="text-sm min-width-80px">Dispense</span>
+                                        <input type="text" class="form-control form-control-sm min-width-unset shadow-none" v-model="drug.data.dispense">
+                                    </div>
+                                </div>
+                                <div class="col-6">
+                                    <div class="d-flex align-items-center">
+                                        <span class="text-sm">Refills</span>
+                                        <input type="text" class="form-control form-control-sm min-width-unset shadow-none ml-2" v-model="drug.data.refills">
+                                    </div>
+                                </div>
+                            </div>
+
+                        </td>
+                        <!--<td class="bg-white py-0 px-0">
                             <input type="text" class="form-control form-control-sm min-width-unset rounded-0 border-0 shadow-none" v-model="drug.data.instructions">
                         </td>
                         <td class="width-70px bg-white py-0 px-0">
@@ -225,7 +247,7 @@
                         </td>
                         <td class="width-70px bg-white py-0 pl-0">
                             <input type="text" class="form-control form-control-sm min-width-unset rounded-0 border-0 shadow-none" v-model="drug.data.refills">
-                        </td>
+                        </td>-->
                         <td class="width-70px text-right">
                             <a href="#" v-on:click.prevent="addExistingDrugToERx(drug.uid)" class="text-nowrap">Add to eRx</a>
                         </td>

+ 92 - 54
resources/views/app/patient/problems-center.blade.php

@@ -55,7 +55,7 @@ function isFavoriteProblem($_problem, $_favorites) {
         @endif
 
         <div class="mb-2 font-weight-bold font-size-14 text-secondary">Problems</div>
-        <table class="table table-sm table-bordered mb-0 bg-white mb-2 point-table">
+        <table class="table table-sm table-bordered mb-0 bg-white mb-2 point-table read">
             <thead>
             <tr class="">
                 @if($patient->core_note_id !== $note->id)
@@ -186,55 +186,73 @@ function isFavoriteProblem($_problem, $_favorites) {
                     </div>
                 </td>
                 <td>
-                    <div class="d-flex align-items-start">
-                        <div class="flex-grow-1">
-                            <?php
-                            $point = $problem;
-                            include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
-                            ?>
-                        </div>
-                        <div class="d-inline-flex flex-column ml-1">
-                            <a class="px-1 view-review-log"
-                               native target="_blank"
-                               open-in-stag-popup
-                               popup-style="stag-popup-md"
-                               title="Subjective log<?= !!@($problem->data->name) ? ' for ' . @($problem->data->name) : '' ?>"
-                               href="/point/review-log/<?= $problem->uid ?>?popupmode=1">
-                                <i class="fa fa-history"></i>
-                            </a>
-                            <?php
-                            $segment = $note->getSegmentByInternalName('intake_problems');
-                            if($segment) {
-                                include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
-                            }
-                            ?>
+                    <?php $segment = $note->getSegmentByInternalName('intake_problems'); ?>
+                    <div if-read-mode>
+                        <div class="d-flex align-items-start">
+                            <div class="flex-grow-1">
+                                <?php
+                                $point = $problem;
+                                include resource_path('views/app/patient/segment-templates/_child_review/last-review.php');
+                                ?>
+                            </div>
+                            <div class="d-inline-flex flex-column ml-1">
+                                <a class="px-1 view-review-log"
+                                   native target="_blank"
+                                   open-in-stag-popup
+                                   popup-style="stag-popup-md"
+                                   title="Subjective log<?= !!@($problem->data->name) ? ' for ' . @($problem->data->name) : '' ?>"
+                                   href="/point/review-log/<?= $problem->uid ?>?popupmode=1">
+                                    <i class="fa fa-history"></i>
+                                </a>
+                                <?php
+                                if($segment) {
+                                    include resource_path('views/app/patient/segment-templates/_child_review/edit-review.php');
+                                }
+                                ?>
+                            </div>
                         </div>
                     </div>
+                    <div if-edit-mode>
+                        <?php
+                        if($segment) {
+                            include resource_path('views/app/patient/segment-templates/_child_review/edit-review-in-place.php');
+                        }
+                        ?>
+                    </div>
                 </td>
                 <td>
-                    <div class="d-flex align-items-start position-relative">
-                        <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-column ml-1">
-                            <a class="px-1 view-review-log"
-                               native target="_blank"
-                               open-in-stag-popup
-                               popup-style="stag-popup-md"
-                               title="Plan log<?= !!@($problem->data->name) ? ' for ' . @($problem->data->name) : '' ?>"
-                               href="/point/plan-log/<?= $problem->uid ?>?popupmode=1">
-                                <i class="fa fa-history"></i>
-                            </a>
-                            <?php
-                            $segment = $note->getSegmentByInternalName('plan_problems');
-                            if($segment) {
-                                include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
-                            }
-                            ?>
+                    <?php $segment = $note->getSegmentByInternalName('plan_problems'); ?>
+                    <div if-read-mode>
+                        <div class="d-flex align-items-start position-relative">
+                            <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-column ml-1">
+                                <a class="px-1 view-review-log"
+                                   native target="_blank"
+                                   open-in-stag-popup
+                                   popup-style="stag-popup-md"
+                                   title="Plan log<?= !!@($problem->data->name) ? ' for ' . @($problem->data->name) : '' ?>"
+                                   href="/point/plan-log/<?= $problem->uid ?>?popupmode=1">
+                                    <i class="fa fa-history"></i>
+                                </a>
+                                <?php
+                                if($segment) {
+                                    include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan.php');
+                                }
+                                ?>
+                            </div>
                         </div>
                     </div>
+                    <div if-edit-mode>
+                        <?php
+                        if($segment) {
+                            include resource_path('views/app/patient/segment-templates/_child_plan/edit-plan-in-place.php');
+                        }
+                        ?>
+                    </div>
                 </td>
                 <td>
                     <div class="position-relative c-pointer stag-tooltip">
@@ -414,14 +432,36 @@ function isFavoriteProblem($_problem, $_favorites) {
                     return false;
                 });
 
-            setTimeout(() => {
-                // custom buttons on title bar
-                $('.button-container').remove();
-                let buttonContainer = $('<div/>').addClass('button-container ml-4 mr-auto');
-                let titleElem = $('#problems-center-{{$note->id}}').closest('.stag-popup').find('.stag-popup-title>span');
-                titleElem.next().removeClass('ml-auto');
-                titleElem.parent().addClass('align-items-center');
+            let mode = 'read';
+
+            $('.button-container').remove();
+            let buttonContainer = $('<div/>').addClass('button-container ml-4 mr-auto');
+            let titleElem = $('#problems-center-{{$note->id}}').closest('.stag-popup').find('.stag-popup-title>span');
+            titleElem.next().removeClass('ml-auto');
+            titleElem.parent().addClass('align-items-center');
+
+            // add button for "Edit Mode"
+            $('.btn-toggle-edit-mode').remove();
+            let button = $('<a href="#" native target="_blank" data-mode="read" ' +
+                'class="btn-toggle-edit-mode btn btn-sm mr-2 btn-info text-white font-weight-bold shadow-none">Switch to Edit Mode</a>')
+                .appendTo(buttonContainer);
+
+            button
+                .off('click.toggle-edit')
+                .on('click.toggle-edit', function () {
+                    if (mode === 'read') {
+                        mode = 'edit';
+                        $(this).text('Back to Read Mode');
+                        $('#problems-center-{{$note->id}} .point-table').removeClass('read').addClass('edit');
+                    } else {
+                        refreshDynamicStagPopup();
+                    }
+                    return false;
+                });
 
+            buttonContainer.insertAfter(titleElem);
+
+            setTimeout(() => {
                 $('<div class="d-inline-flex align-self-stretch align-items-center">' +
                     '<span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>' +
                     '<span class="autosave-indicator saved text-sm text-secondary">' +
@@ -429,9 +469,7 @@ function isFavoriteProblem($_problem, $_favorites) {
                     ' Saved' +
                     '</span>' +
                     '</div>').appendTo(buttonContainer);
-
-                buttonContainer.insertAfter(titleElem);
-            }, 1000); // HACK - don't autosave the init-time induced 'change' events
+            }, 1000);
         }
         addMCInitializer('problems-center-{{$note->id}}', init, '#problems-center-{{$note->id}}');
     }).call(window);

+ 77 - 0
resources/views/app/patient/segment-templates/_child_plan/edit-plan-in-place.php

@@ -0,0 +1,77 @@
+<?php
+$currentValue = '';
+$previousValue = '';
+$previousChildPlan = null;
+if ($point->lastChildPlan && $point->last_child_plan_point_scoped_note_id === $note->id) {
+    $parsedPlan = json_decode($point->lastChildPlan->data);
+    $currentValue = $parsedPlan->value;
+    $previousChildPlan = \App\Models\Point::where('id', '<', $point->lastChildPlan->id)
+        ->where('category', 'PLAN')
+        ->where('parent_point_id', $point->id)
+        ->orderBy('id', 'DESC')
+        ->first();
+    if($previousChildPlan && $previousChildPlan->data) {
+        $parsedPlan = json_decode($previousChildPlan->data);
+        $previousValue = $parsedPlan->value;
+    }
+}
+else {
+    $previousChildPlan = \App\Models\Point::where('parent_point_id', $point->id)
+        ->where('category', 'PLAN')
+        ->orderBy('id', 'DESC')
+        ->first();
+    if($previousChildPlan && $previousChildPlan->data) {
+        $parsedPlan = json_decode($previousChildPlan->data);
+        $previousValue = $parsedPlan->value;
+    }
+}
+?>
+<div class="d-flex align-items-start">
+    <div visit-moe relative class="d-block flex-grow-1">
+        <form show url="/api/visitPoint/upsertChildPlan" class="mcp-theme-1 w-100" left>
+            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+            <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+            <input type="hidden" name="data">
+
+            <?php if($segment->segmentTemplate->internal_name === 'plan_problems' && $previousValue): ?>
+            <div class="d-none disallow-if-value-same-as"><?= str_compact($previousValue) ?></div>
+            <?php endif; ?>
+
+            <?php if($previousValue): ?>
+            <div class="mb-2">
+                <div class="d-flex align-items-baseline mb-1">
+                    <span class="text-sm text-secondary">Previous Plan / <?= friendlier_date($previousChildPlan->created_at) ?> (click to copy)</span>
+                </div>
+                <div class="p-2 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+            </div>
+            <?php endif; ?>
+
+            <div class="mb-0">
+                <div note-rte slim-rte
+                     class="form-group mb-0 border-left border-right rte-holder"
+                     data-field-name="value"><?= $currentValue ?></div>
+            </div>
+            <div class="d-none">
+                <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+    <?php if(!empty($currentValue)): ?>
+        <div visit-moe relative class="d-inline">
+            <a start show href="#" class="pl-2 pr-1 text-center d-block" title="Delete Plan">
+                <i class="fa fa-trash-alt text-danger on-hover-opaque"></i>
+            </a>
+            <form url="/api/visitPoint/destroyCurrentChildPlan" class="mcp-theme-1" right>
+                <input type="hidden" name="uid" value="<?= $point->uid ?>">
+
+                <p class="mb-2">Delete this plan?</p>
+
+                <div>
+                    <button submit class="btn btn-sm btn-danger mr-2">Delete</button>
+                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                </div>
+            </form>
+        </div>
+    <?php endif; ?>
+</div>

+ 83 - 0
resources/views/app/patient/segment-templates/_child_review/edit-review-in-place.php

@@ -0,0 +1,83 @@
+<?php
+$currentValue = '';
+$previousValue = '';
+$previousChildReview = null;
+if ($point->lastChildReview && $point->last_child_review_point_scoped_note_id === $note->id) {
+    $parsedReview = json_decode($point->lastChildReview->data);
+    if(@$parsedReview->value) {
+        $currentValue = $parsedReview->value;
+        $previousChildReview = \App\Models\Point::where('id', '<', $point->lastChildReview->id)
+            ->where('category', 'REVIEW')
+            ->where('parent_point_id', $point->id)
+            ->orderBy('id', 'DESC')
+            ->first();
+        if($previousChildReview && $previousChildReview->data) {
+            $parsedReview = json_decode($previousChildReview->data);
+            $previousValue = $parsedReview->value;
+        }
+    }
+}
+else {
+    $previousChildReview = \App\Models\Point::where('parent_point_id', $point->id)
+        ->where('category', 'REVIEW')
+        ->orderBy('id', 'DESC')
+        ->first();
+    if($previousChildReview && $previousChildReview->data) {
+        $parsedReview = json_decode($previousChildReview->data);
+        if(@$parsedReview->value) {
+            $previousValue = $parsedReview->value;
+        }
+    }
+}
+?>
+<div class="d-flex align-items-start">
+    <div visit-moe relative class="d-block flex-grow-1">
+        <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1" right>
+            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+            <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+            <input type="hidden" name="data">
+
+            <?php if($segment->segmentTemplate->internal_name === 'intake_problems' && $previousValue): ?>
+                <div class="d-none disallow-if-value-same-as"><?= str_compact($previousValue) ?></div>
+            <?php endif; ?>
+
+            <?php if($previousValue): ?>
+                <div class="mb-2">
+                    <div class="d-flex align-items-baseline mb-1">
+                        <span class="text-sm text-secondary">Previous Subjective / <?= friendlier_date($previousChildReview->created_at) ?> (click to copy)</span>
+                    </div>
+                    <div class="p-2 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+                </div>
+            <?php endif; ?>
+
+            <div class="mb-0">
+                <div note-rte slim-rte
+                     <?= $segment->segmentTemplate->internal_name === 'intake_problems' ? 'use-shortcuts="hpi,user"' : '' ?>
+                     class="form-group mb-0 border-left border-right rte-holder"
+                     data-field-name="value"><?= $currentValue ?></div>
+            </div>
+            <div class="d-none">
+                <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+    <?php if(!empty($currentValue)): ?>
+        <div visit-moe relative class="d-inline">
+            <a start show href="#" class="pl-2 pr-1 text-center d-block" title="Delete Subjective">
+                <i class="fa fa-trash-alt text-danger on-hover-opaque"></i>
+            </a>
+            <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1" right>
+                <input type="hidden" name="uid" value="<?= $point->uid ?>">
+
+                <p class="mb-2">Delete this subjective?</p>
+
+                <div>
+                    <button submit class="btn btn-sm btn-danger mr-2">Delete</button>
+                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                </div>
+            </form>
+        </div>
+    <?php endif; ?>
+</div>
+

+ 23 - 8
resources/views/app/patient/segment-templates/history_family/summary.blade.php

@@ -45,21 +45,36 @@ if(!$contentData['unknown'] && !!$contentData['count']) {
     for ($i = 0; $i < $contentData['count']; $i++) {
 ?>
 <div class="<?= $i > 0 ? 'mt-2' : '' ?>">
-    <div class="pb-1">
+    <div class="">
         <b><?= isset($contentData['items'][$i]['relationship']) ? $contentData['items'][$i]['relationship'] : '--' ?></b>
         <?php if(isset($contentData['items'][$i]['status']) && !empty($contentData['items'][$i]['status'])): ?>
         <span class="ml-1 text-secondary">(<?= $contentData['items'][$i]['status'] ?>)</span>
         <?php endif; ?>
     </div>
-    <div class="d-flex ml-3">
-        <?php foreach ($labels as $k => $v): ?>
-                    <?php if(isset($contentData['items'][$i][$k])): ?>
-                        <div class="mr-3"><b class="text-secondary"><?= $v ?></b> <?= $contentData['items'][$i][$k] ?></div>
-                    <?php endif; ?>
-                <?php endforeach; ?>
+    <div class="ml-3">
+        <?php
+        $positives = [];
+        $negatives = [];
+        foreach ($labels as $k => $v) {
+            if(isset($contentData['items'][$i][$k])) {
+                if(strtolower($contentData['items'][$i][$k]) === 'yes') {
+                    $positives[] = $v;
+                }
+                else {
+                    $negatives[] = $v;
+                }
+            }
+        }
+        ?>
+        @if(count($positives))
+            <div class="pt-1"><b>Positive for</b>: {!!  implode(', ', $positives) !!}</div>
+        @endif
+        @if(count($negatives))
+            <div class="pt-1"><b>Negative for</b>: {!!  implode(', ', $negatives) !!}</div>
+        @endif
     </div>
     <?php if(isset($contentData['items'][$i]['comments']) && !empty($contentData['items'][$i]['comments'])): ?>
-    <div class="ml-3 pt-1 text-secondary client-rs-contents">
+    <div class="ml-3 pt-1 client-rs-contents">
         <b>Comments: </b><?= $contentData['items'][$i]['comments'] ?>
     </div>
     <?php endif; ?>

+ 18 - 15
resources/views/app/patient/segment-templates/history_screenings/summary.blade.php

@@ -17,21 +17,24 @@ $point = Point::getGlobalSingletonOfCategory($patient, 'SCREENINGS_HISTORY', tru
 if ($point && @$point->data) {
     $contentData = $point->data;
     ?>
-    <table class="table table-bordered table-sm mb-0">
-    <?php
-    for ($i = 0; $i < $contentData['count']; $i++) {
-    ?>
-    <tr>
-    <td><b><?= isset($contentData['items'][$i]['screening']) ? $contentData['items'][$i]['screening'] : '--' ?></b></td>
-    <td>
-        <?php if(isset($contentData['items'][$i]['comments']) && !empty($contentData['items'][$i]['comments'])): ?>
-            <span class="ml-1 text-secondary">(<?= $contentData['items'][$i]['comments'] ?>)</span>
-        <?php endif; ?>
-    </td>
-    </tr>
-    <?php
-    }
-    ?>
+    <table class="table table-bordered table-sm mb-0 table-cage">
+        <?php
+        for ($i = 0; $i < $contentData['count']; $i++) {
+        ?>
+        <tr>
+            <td class="width-300px">
+                <?= isset($contentData['items'][$i]['screening']) ? $contentData['items'][$i]['screening'] : '--' ?>
+            </td>
+            <td class="width-300px pl-3">
+                <?php if(isset($contentData['items'][$i]['comments']) && !empty($contentData['items'][$i]['comments'])): ?>
+                <span class="ml-1 text-secondary">(<?= $contentData['items'][$i]['comments'] ?>)</span>
+                <?php endif; ?>
+            </td>
+            <td></td>
+        </tr>
+        <?php
+        }
+        ?>
     </table>
     <?php
 }

+ 2 - 3
resources/views/app/patient/segment-templates/history_social/summary.blade.php

@@ -78,9 +78,8 @@ if ($point && @$point->data) {
     endif;
 
     if(isset($contentData['comments']) && !empty(trim($contentData['comments']))) { ?>
-        <div class="d-flex align-items-start mt-2 mb-1">
-            <div class="font-weight-bold mr-3">Comments:</div>
-            <div><?= $contentData['comments'] ?></div>
+        <div class="mt-2 mb-1">
+            <b>Comments: </b><?= $contentData['comments'] ?>
         </div>
     <?php }
 }

+ 2 - 3
resources/views/app/patient/segment-templates/history_surgical/summary.blade.php

@@ -75,9 +75,8 @@ if ($point && @$point->data) {
     endif;
 
     if(isset($contentData['comments']) && !empty(trim($contentData['comments']))) { ?>
-        <div class="d-flex aslign-items-start mt-2 mb-1">
-            <div class="font-weight-bold mr-2">Comments:</div>
-            <div><?= $contentData['comments'] ?></div>
+        <div class="mt-2 mb-1">
+            <b>Comments: </b><?= $contentData['comments'] ?>
         </div>
     <?php }
 }

+ 6 - 5
resources/views/app/patient/segment-templates/intake_allergies/summary.blade.php

@@ -25,7 +25,7 @@ $plural = 'Allergies';
     <?php $j = 0; foreach ($points as $point): $j++; ?>
 	<?php $rel = $point->relevanceToNote($note); ?>
         <tr>
-            <td class="fit px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
+            <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
                     {{ $j }}.*
@@ -33,14 +33,14 @@ $plural = 'Allergies';
                     {{ $j }}.
                 @endif
             </td>
-            <td class="px-2" style="max-width: 300px;">
+            <td class="px-2 width-300px">
                 <div class="font-weight-bold <?= $point->is_removed ? 'strike-through' : '' ?>">
                     <?= !!@($point->data->name) ? @($point->data->name) : '-' ?>
                     
                 </div>
 		    </td>
-            <td class="px-2" style="max-width: 300px;">
-                <div class="">
+            <td class="width-300px">
+                <div class="pl-3">
                     <?php $review = $point->childReviewAddedInNote($note); ?>
                     <?php if(!!$review): ?>
                             <span>{!! $review->data->value !!}</span>
@@ -48,7 +48,7 @@ $plural = 'Allergies';
                         <div class="relevant-without-review text-warning-mellow mt-1 text-sm" data-target-segment="<?= $segment->segmentTemplate->internal_name ?>"><i class="fa fa-exclamation-triangle mr-1"></i>Subjective missing</div>
                     <?php endif; ?>
                 </div>	
-                <div>
+                <div class="pl-3">
                     <?php if ($point->is_removed): ?>
                             @if($point->removal_reason_category === 'DURING_VISIT')
                                 <span class="text-sm text-secondary">Removed during visit</span>
@@ -65,6 +65,7 @@ $plural = 'Allergies';
                 </div>	
 
             </td>
+            <td></td>
         </tr>
     <?php endforeach; ?>
 </table>

+ 16 - 15
resources/views/app/patient/segment-templates/intake_behavior/summary.blade.php

@@ -16,25 +16,26 @@ $points = [
     ["category" => 'SLEEP_HABITS', "name" => 'Sleep Habits', "point" => $sleepHabits],
 ];
 ?>
-
+<table class="table table-bordered table-sm mb-0 table-cage">
 <?php foreach ($points as $p): ?>
 <?php $point = $p['point']; ?>
 <?php if(!!$point): ?>
 <?php $review = $point->lastChildReview; ?>
 <?php if ($review && @($review->data)) $review->data = json_decode($review->data); ?>
-<div class="mb-2">
-    <div class="d-flex align-items-baseline">
-        <b><?= $p['name'] ?></b>
-    </div>
-    <?php if(!!$review): ?>
-    <div class="pl-3 mt-1 d-flex align-items-baseline">
-        <span class="text-secondary font-weight-bold mr-2">Subjective:</span>
-        <div class="inline-html-container">
-            <?php $review = $review->data; ?>
-            <?php include(resource_path('views/app/patient/segment-templates/_child_review/behavior/' . $p['category'] . '/view-review.php')); ?>
-        </div>
-    </div>
-    <?php endif; ?>
-</div>
+<tr>
+    <td class="width-300px">
+        <?= $p['name'] ?>
+    </td>
+    <td class="width-300px">
+        <?php if(!!$review): ?>
+            <div class="pl-3 inline-html-container">
+                <?php $review = $review->data; ?>
+                <?php include(resource_path('views/app/patient/segment-templates/_child_review/behavior/' . $p['category'] . '/view-review.php')); ?>
+            </div>
+        <?php endif; ?>
+    </td>
+    <td></td>
+</tr>
 <?php endif; ?>
 <?php endforeach; ?>
+</table>

+ 4 - 3
resources/views/app/patient/segment-templates/intake_care_team/summary.blade.php

@@ -16,7 +16,7 @@ $plural = 'Care team members';
     <?php $j = 0; foreach ($points as $point): $j++; ?>
         <?php $rel = $point->relevanceToNote($note); ?>
         <tr>
-            <td class="fit px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
+            <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
                     {{ $j }}.*
@@ -24,7 +24,7 @@ $plural = 'Care team members';
                     {{ $j }}.
                 @endif
             </td>
-            <td class="px-2" style="max-width: 300px;">
+            <td class="px-2 width-300px">
                 <div class="<?= $point->is_removed ? 'strike-through' : '' ?>">
                     <b><?= !!@($point->data->name) ? @($point->data->name) : '-' ?></b>
                     <?= !!@($point->data->specialty) ? '/&nbsp;' . @($point->data->specialty) . '' : '' ?>
@@ -34,7 +34,7 @@ $plural = 'Care team members';
                     <?= !!@($point->data->date) ? '&nbsp;/&nbsp;Date: ' . @($point->data->date) : '' ?>
                 </div>
             </td>
-            <td class="px-2" style="max-width:300px;">
+            <td class="px-2 width-300px">
                 <div>
                     <?php $review = $point->childReviewAddedInNote($note); ?>
                     <?php if(!!$review): ?>
@@ -61,6 +61,7 @@ $plural = 'Care team members';
                     <?php endif; ?>
                 </div>
             </td>
+            <td></td>
         </tr>
     <?php endforeach; ?>
     </table>

+ 7 - 8
resources/views/app/patient/segment-templates/intake_exercise/summary.blade.php

@@ -18,26 +18,25 @@ $points = [
 <?php if(!count($points)): ?>
     <span>-</span>
 <?php endif ?>
-<table class="table table-bordered table-sm mb-0">
+<table class="table table-bordered table-sm mb-0 table-cage">
 <?php foreach ($points as $p): ?>
 <?php $point = $p['point']; ?>
 <?php if(!!$point): ?>
 <?php $review = $point->lastChildReview; ?>
 <?php if ($review && @($review->data)) $review->data = json_decode($review->data); ?>
 <tr>
-    <td  style="max-width: 300px;"><b><?= $p['name'] ?></b></td>
-    <td>
+    <td class="width-300px">
+        <?= $p['name'] ?>
+    </td>
+    <td class="width-300px">
         <?php if(!!$review): ?>
-        <div class="pl-3 mt-1 d-flex align-items-baseline">
-            <span class="text-secondary font-weight-bold mr-2">Subjective:</span>
-            <div class="inline-html-container">
+            <div class="pl-3 inline-html-container">
                 <?php $review = $review->data; ?>
                 <?php include(resource_path('views/app/patient/segment-templates/_child_review/exercise/' . $p['category'] . '/view-review.php')); ?>
             </div>
-        </div>
         <?php endif; ?>
     </td>
-    
+    <td></td>
 </tr>
 <?php endif; ?>
 <?php endforeach; ?>

+ 4 - 3
resources/views/app/patient/segment-templates/intake_goals/summary.blade.php

@@ -16,7 +16,7 @@ $plural = 'Goals';
     <?php $j = 0; foreach ($points as $point): $j++; ?>
         <?php $rel = $point->relevanceToNote($note); ?>
         <tr>
-            <td class="fit px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
+            <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
                     {{ $j }}.*
@@ -24,12 +24,12 @@ $plural = 'Goals';
                     {{ $j }}.
                 @endif
             </td>
-            <td class="px-2" style="max-width: 300px;">
+            <td class="px-2 width-300px">
                 <div class="<?= $point->is_removed ? 'strike-through' : '' ?>">
                     <b><?= !!@($point->data->goal) ? @($point->data->goal) : '-' ?></b>
                 </div>
             </td>
-            <td class="px-2" style="max-width:300px;">
+            <td class="px-2 width-300px">
                 <div>
                     <?php $review = $point->childReviewAddedInNote($note); ?>
                     <?php if(!!$review): ?>
@@ -56,6 +56,7 @@ $plural = 'Goals';
                     <?php endif; ?>
                 </div>
             </td>
+            <td></td>
         </tr>
     <?php endforeach; ?>
     </table>

+ 6 - 5
resources/views/app/patient/segment-templates/intake_medications/summary.blade.php

@@ -21,7 +21,7 @@ $plural = 'Medications';
     <?php $j = 0; foreach ($points as $point): $j++; ?>
         <?php $rel = $point->relevanceToNote($note); ?>
 	<tr>
-		<td class="fit px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
+		<td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
 			@if($rel)
 				<?php $numRelevant++; ?>
 				{{ $j }}.*
@@ -29,13 +29,13 @@ $plural = 'Medications';
 				{{ $j }}.
 			@endif
 		</td>
-		<td class="px-2" style="max-width: 300px;">
+		<td class="px-2 width-300px">
 			<div class="font-weight-bold <?= $point->is_removed ? 'strike-through' : '' ?>">
 				<?= !!@($point->data->name) ? @($point->data->name) : '-' ?>
 			</div>
 		</td>
-		<td class="px-2" style="max-width:300px;">
-			<div class="">
+		<td class="width-300px">
+			<div class="pl-3">
 				<?php $review = $point->childReviewAddedInNote($note); ?>
 				<?php if(!!$review): ?>
 					<div class="d-flex align-items-baseline">
@@ -45,7 +45,7 @@ $plural = 'Medications';
 					<div class="relevant-without-review text-warning-mellow mt-1 text-sm" data-target-segment="<?= $segment->segmentTemplate->internal_name ?>"><i class="fa fa-exclamation-triangle mr-1"></i>Subjective missing</div>
 				<?php endif; ?>
 			</div>
-			<div class="d-flex align-items-baseline">
+			<div class="pl-3 d-flex align-items-baseline">
 				<?php if ($point->is_removed): ?>
 					@if($point->removal_reason_category === 'DURING_VISIT')
 						<span class="text-sm text-secondary">Removed during visit</span>
@@ -61,6 +61,7 @@ $plural = 'Medications';
 				<?php endif; ?>
 			</div>
 		</td>
+		<td></td>
 	</tr>
     <?php endforeach; ?>
 	</table>

+ 4 - 3
resources/views/app/patient/segment-templates/intake_nutrition/summary.blade.php

@@ -29,17 +29,17 @@ $points = [
     <span>-</span>
 <?php endif ?>
 
-<table class="table table-bordered table-sm mb-0">
+<table class="table table-bordered table-sm mb-0 table-cage">
 <?php foreach ($points as $p): ?>
 <?php $point = $p['point']; ?>
 <?php if(!!$point): ?>
 <?php $review = $point->lastChildReview; ?>
 <?php if ($review && @($review->data)) $review->data = json_decode($review->data); ?>
 <tr>
-<td>
+<td class="width-300px">
 	<?= $p['name'] ?>
 </td>
-<td>
+<td class="width-300px">
 <?php if(!!$review): ?>
     <div class="pl-3 d-flex align-items-baseline">
         <div>
@@ -56,6 +56,7 @@ $points = [
     </div>
 <?php endif; ?>
 </td>
+<td></td>
 </tr>
 <?php endif; ?>
 <?php endforeach; ?>

+ 4 - 3
resources/views/app/patient/segment-templates/intake_problems/summary.blade.php

@@ -16,7 +16,7 @@ $plural = 'Problems';
     <?php $j = 0; foreach ($points as $point): $j++; ?>
         <?php $rel = $point->relevanceToNote($note); ?>
        <tr>
-            <td class="fit px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
+            <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
                     {{ $j }}.*
@@ -24,12 +24,12 @@ $plural = 'Problems';
                     {{ $j }}.
                 @endif
             </td>
-            <td class="px-2" style="max-width: 300px;">
+            <td class="px-2 width-300px">
                 <div class="font-weight-bold <?= $point->is_removed ? 'strike-through' : '' ?>">
                     <?= !!@($point->data->name) ? @($point->data->name) : '-' ?>
                 </div>
             </td>
-            <td class="px-2" style="max-width:300px;">
+            <td class="px-2 width-300px">
                 <div>
                     <?php $review = $point->childReviewAddedInNote($note); ?>
                     <?php if(!!$review): ?>
@@ -56,6 +56,7 @@ $plural = 'Problems';
                     <?php endif; ?>
                 </div>
             </td>
+           <td></td>
         </tr>
     <?php endforeach; ?>
     </table>

+ 2 - 3
resources/views/app/patient/segment-templates/past_medical_history/summary.blade.php

@@ -102,9 +102,8 @@ if ($point && @$point->data) {
     endif;
 
     if(isset($contentData['comments']) && !empty(trim($contentData['comments']))) { ?>
-        <div class="d-flex align-items-start mt-2 mb-1">
-            <div class="font-weight-bold mr-2">Comments:</div>
-            <div><?= $contentData['comments'] ?></div>
+        <div class="mt-2 mb-1">
+            <b>Comments: </b><?= $contentData['comments'] ?>
         </div>
     <?php }
 

+ 4 - 4
resources/views/app/patient/segment-templates/plan_allergies/summary.blade.php

@@ -30,7 +30,7 @@ $plural = 'Allergies';
         <?php if($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
         <?php $numVisible++; ?>
         <tr>
-            <td class="fit px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
+            <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
                     {{ $j }}.*
@@ -38,16 +38,15 @@ $plural = 'Allergies';
                     {{ $j }}.
                 @endif
             </td>
-            <td class="px-2" style="max-width: 300px;">
+            <td class="px-2 width-300px">
                 <div class="<?= $point->is_removed ? 'strike-through' : '' ?>">
                     <b><?= !!@($point->data->name) ? @($point->data->name) : '-' ?></b>
                 </div>
             </td>
-            <td class="px-2" style="max-width: 300px;">
+            <td class="px-2 width-300px">
                 <div>
                     <?php if(!!$plan): ?>
                         <div class="pl-3 mt-1 d-flex align-items-baseline">
-                            <span class="text-secondary font-weight-bold mr-2">Plan:</span>
                             <span>{!! $plan->data->value !!}</span>
                         </div>
                     <?php elseif($rel): ?>
@@ -70,6 +69,7 @@ $plural = 'Allergies';
                     <?php endif; ?>
                 </div>
             </td>
+            <td></td>
         </tr>
     <?php endforeach; ?>
     </table>

+ 22 - 21
resources/views/app/patient/segment-templates/plan_behavior/summary.blade.php

@@ -16,25 +16,26 @@ $points = [
     ["category" => 'SLEEP_HABITS', "name" => 'Sleep Habits', "point" => $sleepHabits],
 ];
 ?>
-
-<?php foreach ($points as $p): ?>
-<?php $point = $p['point']; ?>
-<?php if(!!$point): ?>
-<?php $plan = $point->lastChildPlan; ?>
-<?php if ($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
-<div class="mb-2">
-    <div class="d-flex align-items-baseline">
-        <b><?= $p['name'] ?></b>
-    </div>
-    <?php if(!!$plan): ?>
-    <div class="pl-3 mt-1 d-flex align-items-baseline">
-        <span class="text-secondary font-weight-bold mr-2">Plan:</span>
-        <div class="inline-html-container">
-            <?php $plan = $plan->data; ?>
-            <?php include(resource_path('views/app/patient/segment-templates/_child_plan/behavior/' . $p['category'] . '/view-plan.php')); ?>
-        </div>
-    </div>
+<table class="table table-bordered table-sm mb-0 table-cage">
+    <?php foreach ($points as $p): ?>
+    <?php $point = $p['point']; ?>
+    <?php if(!!$point): ?>
+    <?php $plan = $point->lastChildPlan; ?>
+    <?php if ($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
+    <tr>
+        <td class="width-300px">
+            <?= $p['name'] ?>
+        </td>
+        <td class="width-300px">
+            <?php if(!!$plan): ?>
+            <div class="ml-3 inline-html-container">
+                <?php $plan = $plan->data; ?>
+                <?php include(resource_path('views/app/patient/segment-templates/_child_plan/behavior/' . $p['category'] . '/view-plan.php')); ?>
+            </div>
+            <?php endif; ?>
+        </td>
+        <td></td>
+    </tr>
     <?php endif; ?>
-</div>
-<?php endif; ?>
-<?php endforeach; ?>
+    <?php endforeach; ?>
+</table>

+ 11 - 10
resources/views/app/patient/segment-templates/plan_care_team/summary.blade.php

@@ -21,7 +21,7 @@ $plural = 'Care team members';
         <?php if($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
         <?php $numVisible++; ?>
         <tr>
-            <td class="fit px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
+            <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
                     {{ $j }}.*
@@ -29,7 +29,7 @@ $plural = 'Care team members';
                     {{ $j }}.
                 @endif
             </td>
-            <td class="px-2" style="max-width: 300px;">
+            <td class="px-2 width-300px">
                 <div class="<?= $point->is_removed ? 'strike-through' : '' ?>">
                     <b><?= !!@($point->data->name) ? @($point->data->name) : '-' ?></b>
                     <?= !!@($point->data->specialty) ? '/&nbsp;' . @($point->data->specialty) . '' : '' ?>
@@ -39,32 +39,33 @@ $plural = 'Care team members';
                     <?= !!@($point->data->date) ? '&nbsp;/&nbsp;Date: ' . @($point->data->date) : '' ?>
                 </div>
             </td>
-            <td class="px-2" style="max-width:300px;">
-                <div>
+            <td class="px-2 width-300px">
+                <div class="pl-3">
                     <?php if(!!$plan): ?>
-                        <div class="pl-3 mt-1 d-flex align-items-baseline">
+                        <div class="mt-1 d-flex align-items-baseline">
                             <span>{!! $plan->data->value !!}</span>
                         </div>
                     <?php elseif($rel): ?>
                         <div class="relevant-without-plan text-warning-mellow 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>
-                <div class="d-flex align-items-baseline">
+                <div class="pl-3 d-flex align-items-baseline">
                     <?php if ($point->is_removed): ?>
                         @if($point->removal_reason_category === 'DURING_VISIT')
-                            <span class="ml-2 text-sm text-secondary">Removed during visit</span>
+                            <span class="mt-1 text-sm text-secondary">Removed during visit</span>
                         @elseif($point->removal_reason_category === 'ON_INTAKE')
-                            <span class="ml-2 text-sm text-secondary">Removed on intake</span>
+                            <span class="mt-1 text-sm text-secondary">Removed on intake</span>
                         @endif
                     <?php elseif ($point->added_in_note_id === $note->id): ?>
                         <?php if ($point->addition_reason_category === 'DURING_VISIT'): ?>
-                            <span class="ml-2 text-sm text-success">* Added during visit</span>
+                            <span class="mt-1 text-sm text-success">* Added during visit</span>
                         <?php else: ?>
-                            <span class="ml-2 text-sm text-info">* Added on intake</span>
+                            <span class="mt-1 text-sm text-info">* Added on intake</span>
                         <?php endif;?>
                     <?php endif; ?>
                 </div>
             </td>
+            <td></td>
         </tr>
     <?php endforeach; ?>
     </table>

+ 19 - 20
resources/views/app/patient/segment-templates/plan_exercise/summary.blade.php

@@ -18,27 +18,26 @@ $points = [
 <?php if(!count($points)): ?>
     <span>-</span>
 <?php endif ?>
-<table class="table table-bordered table-sm mb-0">
-<?php foreach ($points as $p): ?>
-<?php $point = $p['point']; ?>
-<?php if(!!$point): ?>
-<?php $plan = $point->lastChildPlan; ?>
-<?php if ($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
-<tr>
-    <td style="width: 300px;"><b><?= $p['name'] ?></b></td>
-    <td>
-        <?php if(!!$plan): ?>
-        <div class="pl-3 mt-1 d-flex align-items-baseline">
-            <span class="text-secondary font-weight-bold mr-2">Plan:</span>
-            <div class="inline-html-container">
+<table class="table table-bordered table-sm mb-0 table-cage">
+    <?php foreach ($points as $p): ?>
+    <?php $point = $p['point']; ?>
+    <?php if(!!$point): ?>
+    <?php $plan = $point->lastChildPlan; ?>
+    <?php if ($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
+    <tr>
+        <td class="width-300px">
+            <?= $p['name'] ?>
+        </td>
+        <td class="width-300px">
+            <?php if(!!$plan): ?>
+            <div class="ml-3 inline-html-container">
                 <?php $plan = $plan->data; ?>
                 <?php include(resource_path('views/app/patient/segment-templates/_child_plan/exercise/' . $p['category'] . '/view-plan.php')); ?>
             </div>
-        </div>
-        <?php endif; ?>
-    </td>
-    
-</tr>
-<?php endif; ?>
-<?php endforeach; ?>
+            <?php endif; ?>
+        </td>
+        <td></td>
+    </tr>
+    <?php endif; ?>
+    <?php endforeach; ?>
 </table>

+ 4 - 3
resources/views/app/patient/segment-templates/plan_goals/summary.blade.php

@@ -21,7 +21,7 @@ $plural = 'Goals';
         <?php if($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
         <?php $numVisible++; ?>
         <tr>
-            <td class="fit px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
+            <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
                     {{ $j }}.*
@@ -29,12 +29,12 @@ $plural = 'Goals';
                     {{ $j }}.
                 @endif
             </td>
-            <td class="px-2" style="max-width: 300px;">
+            <td class="px-2 width-300px">
                 <div class="<?= $point->is_removed ? 'strike-through' : '' ?>">
                     <b><?= !!@($point->data->goal) ? @($point->data->goal) : '-' ?></b>
                 </div>
             </td>
-            <td class="px-2" style="max-width:300px;">
+            <td class="px-2 width-300px">
                 <div>
                     <?php if(!!$plan): ?>
                         <div class="pl-3 mt-1 d-flex align-items-baseline">
@@ -60,6 +60,7 @@ $plural = 'Goals';
                     <?php endif; ?>
                 </div>
             </td>
+            <td></td>
         </tr>
     <?php endforeach; ?>
     </table>

+ 4 - 3
resources/views/app/patient/segment-templates/plan_medications/summary.blade.php

@@ -26,7 +26,7 @@ $plural = 'Medications';
         <?php if($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
         <?php $numVisible++; ?>
         <tr>
-            <td class="fit px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
+            <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
                     {{ $j }}.*
@@ -34,12 +34,12 @@ $plural = 'Medications';
                     {{ $j }}.
                 @endif
             </td>
-            <td class="px-2" style="max-width: 300px;">
+            <td class="px-2 width-300px">
                 <div class="font-weight-bold <?= $point->is_removed ? 'strike-through' : '' ?>">
                     <?= !!@($point->data->name) ? @($point->data->name) : '-' ?>
                 </div>
             </td>
-            <td class="px-2" style="max-width:300px;">
+            <td class="px-2 width-300px">
                 <div>
                     <?php if(!!$plan): ?>
                     <div class="pl-3 mt-1 d-flex align-items-baseline">
@@ -65,6 +65,7 @@ $plural = 'Medications';
                     <?php endif; ?>
                 </div>
             </td>
+            <td></td>
         </tr>
     <?php endforeach; ?>
     </table>

+ 21 - 18
resources/views/app/patient/segment-templates/plan_nutrition/summary.blade.php

@@ -28,22 +28,25 @@ $points = [
 <?php if(!count($points)): ?>
     <span>-</span>
 <?php endif ?>
-
-<?php foreach ($points as $p): ?>
-<?php $point = $p['point']; ?>
-<?php if(!!$point): ?>
-<?php $plan = $point->lastChildPlan; ?>
-<?php if($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
-<div class="mb-2">
-    <div class="d-flex align-items-baseline">
-        <b><?= $p['name'] ?></b>
-    </div>
-    <?php if(!!$plan): ?>
-    <div class="pl-3 mt-1 d-flex align-items-baseline">
-        <span class="text-secondary font-weight-bold mr-2">Plan:</span>
-        <span>{!! $plan->data->value ? strip_tags($plan->data->value) : '-' !!}</span>
-    </div>
+<table class="table table-bordered table-sm mb-0 table-cage">
+    <?php foreach ($points as $p): ?>
+    <?php $point = $p['point']; ?>
+    <?php if(!!$point): ?>
+    <?php $plan = $point->lastChildPlan; ?>
+    <?php if ($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
+    <tr>
+        <td class="width-300px">
+            <?= $p['name'] ?>
+        </td>
+        <td class="width-300px">
+            <?php if(!!$plan): ?>
+            <div class="ml-3">
+                <span>{!! $plan->data->value ? strip_tags($plan->data->value) : '-' !!}</span>
+            </div>
+            <?php endif; ?>
+        </td>
+        <td></td>
+    </tr>
     <?php endif; ?>
-</div>
-<?php endif; ?>
-<?php endforeach; ?>
+    <?php endforeach; ?>
+</table>

+ 4 - 3
resources/views/app/patient/segment-templates/plan_problems/summary.blade.php

@@ -21,7 +21,7 @@ $plural = 'Problems';
         <?php if($plan && @($plan->data)) $plan->data = json_decode($plan->data); ?>
         <?php $numVisible++; ?>
         <tr>
-            <td class="fit px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
+            <td class="width-40px px-2 {{ $rel ? 'font-weight-bold text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
                     {{ $j }}.*
@@ -29,12 +29,12 @@ $plural = 'Problems';
                     {{ $j }}.
                 @endif
             </td>
-            <td class="px-2" style="max-width: 300px;">
+            <td class="px-2 width-300px">
                 <div class="<?= $point->is_removed ? 'strike-through' : '' ?>">
                     <b><?= !!@($point->data->name) ? @($point->data->name) : '-' ?></b>
                 </div>
             </td>
-            <td class="px-2" style="max-width:300px;">
+            <td class="px-2 width-300px">
                 <div>
                     <?php if(!!$plan): ?>
                         <div class="pl-3 mt-1 d-flex align-items-baseline">
@@ -60,6 +60,7 @@ $plural = 'Problems';
                     <?php endif; ?>
                 </div>
             </td>
+            <td></td>
         </tr>
     <?php endforeach; ?>
     </table>

+ 53 - 15
resources/views/app/patient/segment-templates/ros/edit.blade.php

@@ -232,7 +232,7 @@ for ($i = 0; $i < count($fields); $i++) {
                 <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
             @endif
             <input type="hidden" name="category" value="ROS">
-            <input type="hidden" name="data">
+            <input type="hidden" name="data" value='{!! json_encode($contentData) !!}'>
 
             <div id="edit-ros-container">
                 <div class="d-flex align-items-center mb-3">
@@ -296,15 +296,11 @@ for ($i = 0; $i < count($fields); $i++) {
                         </div>
                     @endfor
                 </div>
-                <hr class="m-neg-4">
+                <hr class="m-neg-4 mt-0">
                 <div class="mb-2">
                     <textarea class="form-control form-control-sm" v-model="comments">{!! $parsed && @$parsed->content ? @$parsed->content : '' !!}</textarea>
                 </div>
-            </div>
-
-            @if(!!$segment)
-                <div class="m-2">
-                    <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
+                <div class="mt-3">
                     <div class="d-inline-flex align-self-stretch align-items-center">
                         <span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>
                         <span class="autosave-indicator saved text-sm text-secondary">
@@ -313,12 +309,7 @@ for ($i = 0; $i < count($fields); $i++) {
                     </span>
                     </div>
                 </div>
-            @else
-                <div class="m-2">
-                    <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
-                    <button cancel class="btn btn-sm btn-default border" {!! @$closeOnSave ? 'onmousedown="return closeStagPopup()"' : '' !!}>Close</button>
-                </div>
-            @endif
+            </div>
 
         </form>
     </div>
@@ -326,7 +317,28 @@ for ($i = 0; $i < count($fields); $i++) {
 <script>
     (function() {
 
-        window.segmentInitializers.<?= !!@$segment ? $segment->segmentTemplate->internal_name : $segmentInternalName ?> = function() {
+        const debounce = (func, wait) => {
+            let timeout;
+            return function executedFunction(...args) {
+                const later = () => {
+                    clearTimeout(timeout);
+                    func(...args);
+                };
+                clearTimeout(timeout);
+                timeout = setTimeout(later, wait);
+            };
+        };
+
+        let debouncedROSSaver = debounce(function(_trigger) {
+            $(_trigger).closest('.stag-popup').find('.autosave-indicator').removeClass('show');
+            $(_trigger).closest('.stag-popup').find('.autosave-indicator.saving').addClass('show');
+            saveVisitForm(_trigger, true, false, () => {
+                $(_trigger).closest('.stag-popup').find('.autosave-indicator').removeClass('show');
+                $(_trigger).closest('.stag-popup').find('.autosave-indicator.saved').addClass('show');
+            });
+        }, 500);
+
+        function initROS() {
 
             let model = <?= $contentData ? json_encode($contentData) : '{}' ?>;
 
@@ -339,12 +351,31 @@ for ($i = 0; $i < count($fields); $i++) {
                 mounted: function() {
                     $('#edit-ros-container [moe][initialized]').removeAttr('initialized');
                     initMoes();
+
+                    // custom buttons on title bar
+                    $('.button-container').remove();
+                    let buttonContainer = $('<div/>').addClass('button-container ml-4 mr-auto');
+                    let titleElem = $('#edit-ros-container').closest('.stag-popup').find('.stag-popup-title>span');
+                    titleElem.next().removeClass('ml-auto');
+                    titleElem.parent().addClass('align-items-center');
+
+                    // add button for "Edit Mode"
+                    $('<div class="d-inline-flex align-self-stretch align-items-center">' +
+                        '<span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>' +
+                        '<span class="autosave-indicator saved text-sm text-secondary">' +
+                        '<i class="fa fa-check"></i>' +
+                        ' Saved' +
+                        '</span>' +
+                        '</div>').appendTo(buttonContainer);
+
+                    buttonContainer.insertAfter(titleElem);
                 },
                 watch: {
                     $data: {
                         handler: function(val, oldVal) {
                             let parent = $('#edit-ros-container').closest('form');
                             parent.find('[name="data"]').val(JSON.stringify(this.$data));
+                            debouncedROSSaver($('#edit-ros-container')[0]);
                         },
                         deep: true
                     }
@@ -355,11 +386,18 @@ for ($i = 0; $i < count($fields); $i++) {
                         Vue.nextTick(function() {
                             $('#edit-ros-container').find('textarea').first().trigger('input');
                         });
+                    },
+                    saveROS: function() {
+                        saveVisitForm($('#edit-ros-container')[0], false, true);
                     }
                 }
             });
 
-        };
+        }
+
+        // window.segmentInitializers.<?= !!@$segment ? $segment->segmentTemplate->internal_name : $segmentInternalName ?> = initROS;
+
+        addMCInitializer('init-ros-{{$note->id}}', initROS, '#edit-ros-container');
 
     }).call(window);
 </script>

+ 2 - 3
resources/views/app/patient/segment-templates/ros/summary.blade.php

@@ -223,9 +223,8 @@ if ($point && @$point->data && !@($point->data['free_text'])) {
     }
     ?>
     @if(isset($contentData['comments']) && !empty(trim($contentData['comments'])))
-        <div class="d-flex align-items-start mt-2 mb-1">
-            <div class="font-weight-bold mr-2">Comments:</div>
-            <div><?= $contentData['comments'] ?></div>
+        <div class="mt-2 mb-1">
+            <b>Comments: </b><?= $contentData['comments'] ?>
         </div>
     @endif
     <?php

+ 4 - 4
resources/views/app/patient/segment-templates/vitals/edit.blade.php

@@ -127,7 +127,7 @@ $copyTriggerAdded = [];
                                             @if($bmi >= 18.5 && $bmi < 25)
                                                 <span class="text-sm text-success">Healthy Weight</span>
                                             @endif
-                                            @if($bmi >= 25 && $bmi > 30)
+                                            @if($bmi >= 25 && $bmi < 30)
                                                 <span class="text-sm text-warning-mellow">Overweight</span>
                                             @endif
                                             @if($bmi >= 30)
@@ -168,7 +168,7 @@ $copyTriggerAdded = [];
                                            heightFeetInput
                                            value="{{feetFromInches($contentData['heightInInches']) ?: ''}}">
                                     <span class="pl-1 pr-2 text-secondary bg-white">ft.</span>
-                                    <input type="text" class="form-control form-control-sm min-width-unset w-auto-input width-30px border-0 edit"
+                                    <input type="text" class="form-control form-control-sm min-width-unset w-auto-input width-30px border-0 edit pr-0"
                                            heightInchesInput
                                            value="{{inchesAfterFeetFromInches($contentData['heightInInches']) ?: ''}}">
                                     <span class="pl-1 text-secondary bg-white">in.</span>
@@ -203,7 +203,7 @@ $copyTriggerAdded = [];
                                         @if($prevBMI >= 18.5 && $prevBMI < 25)
                                             <span class="text-sm text-success ml-1">Healthy Weight</span>
                                         @endif
-                                        @if($prevBMI >= 25 && $prevBMI > 30)
+                                        @if($prevBMI >= 25 && $prevBMI < 30)
                                             <span class="text-sm text-warning-mellow ml-1">Overweight</span>
                                         @endif
                                         @if($prevBMI >= 30)
@@ -253,7 +253,7 @@ $copyTriggerAdded = [];
                 else if(bmi >= 18.5 && bmi < 25) {
                     bmiCategory = '<span class="text-sm text-success">Healthy Weight</span>';
                 }
-                else if(bmi >= 25 && bmi > 30) {
+                else if(bmi >= 25 && bmi < 30) {
                     bmiCategory = '<span class="text-sm text-warning-mellow">Overweight</span>';
                 }
                 else if(bmi >= 30) {

+ 8 - 8
resources/views/app/patient/wizard-partials/common-script.blade.php

@@ -708,7 +708,7 @@ const debounce = (func, wait) => {
     };
 };
 
-let debouncedLifestyleSaver = debounce(function(_trigger) {
+let debouncedWizardEditModeSaver = debounce(function(_trigger) {
     $(_trigger).closest('.stag-popup').find('.autosave-indicator').removeClass('show');
     $(_trigger).closest('.stag-popup').find('.autosave-indicator.saving').addClass('show');
     saveVisitForm(_trigger, true, false, () => {
@@ -721,44 +721,44 @@ let debouncedLifestyleSaver = debounce(function(_trigger) {
 $(document).off('input.auto-save-input', '[if-edit-mode] [visit-moe] form input[type="text"]');
 $(document).on('input.auto-save-input', '[if-edit-mode] [visit-moe] form input[type="text"]', function () {
     if($(this).closest('.point-table').is('.edit')) {
-        debouncedLifestyleSaver(this);
+        debouncedWizardEditModeSaver(this);
     }
 });
 $(document).off('change.auto-save-select-change', '[if-edit-mode] [visit-moe] form select');
 $(document).on('change.auto-save-select-change', '[if-edit-mode] [visit-moe] form select', function () {
     if($(this).closest('.point-table').is('.edit')) {
-        debouncedLifestyleSaver(this);
+        debouncedWizardEditModeSaver(this);
     }
 });
 $(document).off('change.auto-save-checkbox-change', '[if-edit-mode] [visit-moe] form input[type="checkbox"]');
 $(document).on('change.auto-save-checkbox-change', '[if-edit-mode] [visit-moe] form input[type="checkbox"]', function () {
     if($(this).closest('.point-table').is('.edit')) {
-        debouncedLifestyleSaver(this);
+        debouncedWizardEditModeSaver(this);
     }
 });
 $(document).off('change.auto-save-radio-change', '[if-edit-mode] [visit-moe] form input[type="radio"]');
 $(document).on('change.auto-save-radio-change', '[if-edit-mode] [visit-moe] form input[type="radio"]', function () {
     if($(this).closest('.point-table').is('.edit')) {
-        debouncedLifestyleSaver(this);
+        debouncedWizardEditModeSaver(this);
     }
 });
 $(document).off('input.auto-save-textarea-input', '[if-edit-mode] [visit-moe] form textarea');
 $(document).on('input.auto-save-textarea-input', '[if-edit-mode] [visit-moe] form textarea', function () {
     if($(this).closest('.point-table').is('.edit')) {
-        debouncedLifestyleSaver(this);
+        debouncedWizardEditModeSaver(this);
     }
 });
 
 $(document).off('rich-text-input.auto-save-rich-text-input', '[if-edit-mode] [visit-moe] form [note-rte]');
 $(document).on('rich-text-input.auto-save-rich-text-input', '[if-edit-mode] [visit-moe] form [note-rte]', function () {
     if($(this).closest('.point-table').is('.edit')) {
-        debouncedLifestyleSaver(this);
+        debouncedWizardEditModeSaver(this);
     }
 });
 
 $(document).off('rich-text-input.auto-save-rich-text-input', '#frm-cc-regenerate [note-rte]');
 $(document).on('rich-text-input.auto-save-rich-text-input', '#frm-cc-regenerate [note-rte]', function () {
-    debouncedLifestyleSaver(this);
+    debouncedWizardEditModeSaver(this);
 });
 
 initStagSuggest();

+ 9 - 0
resources/views/app/video/call-minimal.blade.php

@@ -139,6 +139,8 @@
             $btnMuteAudio: null,
             $btnUnmuteAudio: null,
 
+            initializing: false,
+
             // methods
             init: function() {
 
@@ -299,6 +301,13 @@
             // init media
             initMedia: function() {
 
+                if(this.initializing) {
+                    console.log('Init already in progress.');
+                    return;
+                }
+
+                this.initializing = true;
+
                 // create client
                 this.mediaServiceClient = AgoraRTC.createClient({mode: 'rtc', codec: 'vp8'});