Pārlūkot izejas kodu

Exercise segments (wip)

Vijayakrishnan 3 gadi atpakaļ
vecāks
revīzija
8b26e17b34
30 mainītis faili ar 1420 papildinājumiem un 13 dzēšanām
  1. 4 0
      app/Http/Controllers/NoteController.php
  2. 15 4
      public/css/style.css
  3. BIN
      public/img/exercise-rx.png
  4. BIN
      public/img/exercise-rx/bike.png
  5. BIN
      public/img/exercise-rx/elliptical.png
  6. BIN
      public/img/exercise-rx/jog.png
  7. BIN
      public/img/exercise-rx/swim.png
  8. BIN
      public/img/exercise-rx/walk.png
  9. 12 9
      public/js/mc.js
  10. 116 0
      resources/views/app/patient/exercise-center.blade.php
  11. 10 0
      resources/views/app/patient/note/dashboard_script.blade.php
  12. 118 0
      resources/views/app/patient/segment-templates/_child_plan/exercise/AEROBIC_ACTIVITY/edit-plan.php
  13. 33 0
      resources/views/app/patient/segment-templates/_child_plan/exercise/AEROBIC_ACTIVITY/last-plan.php
  14. 118 0
      resources/views/app/patient/segment-templates/_child_plan/exercise/NEAT/edit-plan.php
  15. 33 0
      resources/views/app/patient/segment-templates/_child_plan/exercise/NEAT/last-plan.php
  16. 118 0
      resources/views/app/patient/segment-templates/_child_plan/exercise/STRENGTH_TRAINING/edit-plan.php
  17. 33 0
      resources/views/app/patient/segment-templates/_child_plan/exercise/STRENGTH_TRAINING/last-plan.php
  18. 314 0
      resources/views/app/patient/segment-templates/_child_review/exercise/AEROBIC_ACTIVITY/edit-review.php
  19. 35 0
      resources/views/app/patient/segment-templates/_child_review/exercise/AEROBIC_ACTIVITY/last-review.php
  20. 56 0
      resources/views/app/patient/segment-templates/_child_review/exercise/AEROBIC_ACTIVITY/view-review.php
  21. 118 0
      resources/views/app/patient/segment-templates/_child_review/exercise/NEAT/edit-review.php
  22. 32 0
      resources/views/app/patient/segment-templates/_child_review/exercise/NEAT/last-review.php
  23. 118 0
      resources/views/app/patient/segment-templates/_child_review/exercise/STRENGTH_TRAINING/edit-review.php
  24. 32 0
      resources/views/app/patient/segment-templates/_child_review/exercise/STRENGTH_TRAINING/last-review.php
  25. 4 0
      resources/views/app/patient/segment-templates/intake_exercise/edit.blade.php
  26. 3 0
      resources/views/app/patient/segment-templates/intake_exercise/summary.blade.php
  27. 4 0
      resources/views/app/patient/segment-templates/plan_exercise/edit.blade.php
  28. 3 0
      resources/views/app/patient/segment-templates/plan_exercise/summary.blade.php
  29. 90 0
      resources/views/app/patient/wizard-partials/common-script.blade.php
  30. 1 0
      routes/web.php

+ 4 - 0
app/Http/Controllers/NoteController.php

@@ -402,6 +402,10 @@ class NoteController extends Controller
         return view('app.patient.nutrition-center', compact('patient', 'note'));
     }
 
+    public function exerciseCenter(Request $request, Client $patient, Note $note) {
+        return view('app.patient.exercise-center', compact('patient', 'note'));
+    }
+
     public function ccmAgreement(Request $request, Note $note) {
         return view('app.patient.note.ccm-agreement', compact('note'));
     }

+ 15 - 4
public/css/style.css

@@ -192,6 +192,9 @@ body.stag_rhs_collapsed .app-right-panel {
 .mcp-theme-1 .opacity-60 {
     opacity: .6;
 }
+.mcp-theme-1 .opacity-35 {
+    opacity: .35;
+}
 .mcp-theme-1 .overflow-visible {
     overflow: visible;
 }
@@ -2107,10 +2110,9 @@ body.in-iframe .main-row > .sidebar {
 }
 [visit-moe][fixed-center] [url]:not([show]) {
     position: fixed !important;
-    top: 50% !important;
-    left: 50% !important;
-    width: 600px;
-    transform: translate(-50%, -50%) !important;
+    top: 200px !important;
+    left: calc(50% - 360px) !important;
+    width: 720px;
 }
 [visit-moe] [url][right] {
     right: 0;
@@ -2122,6 +2124,12 @@ body.in-iframe .main-row > .sidebar {
 [visit-moe][large] form, [visit-moe][large] [url] {
     width: 450px;
 }
+[visit-moe][larger] form, [visit-moe][large] [url] {
+    width: 600px;
+}
+[visit-moe][largest] form, [visit-moe][largest] [url] {
+    width: 750px;
+}
 [visit-moe][bottom] form {
     bottom: 100%;
 }
@@ -2445,6 +2453,9 @@ td.row-selection-highlight:after {
 .border-top-nutrition-rx {
     border-top: 3px solid #a4d067;
 }
+.border-top-exercise-rx {
+    border-top: 3px solid #43c2cb;
+}
 .icon-nutrition-rx-row {
     max-height: 18px;
 }

BIN
public/img/exercise-rx.png


BIN
public/img/exercise-rx/bike.png


BIN
public/img/exercise-rx/elliptical.png


BIN
public/img/exercise-rx/jog.png


BIN
public/img/exercise-rx/swim.png


BIN
public/img/exercise-rx/walk.png


+ 12 - 9
public/js/mc.js

@@ -453,16 +453,9 @@ function initPatientPresenceIndicator() {
 
 // not really the place for this!
 // find a better place to put this
-window.saveVisitForm = function(_trigger, _silent = false, _close = false, _doneCallback = null) {
-    let form = $(_trigger).closest('form');
-
-    if (!_silent && !form[0].checkValidity()) {
-        form[0].reportValidity();
-        return false;
-    }
-
+window.fillJsonDataField = function(form, field = "data") {
     // add [data-name] values to payload
-    let dataField = form.find('[name="data"]').first();
+    let dataField = form.find('[name="' + field + '"]').first();
     let parsed = null;
     if(dataField.val()) {
         parsed = JSON.parse(dataField.val());
@@ -493,6 +486,16 @@ window.saveVisitForm = function(_trigger, _silent = false, _close = false, _done
     if(parsed) {
         dataField.val(JSON.stringify(parsed));
     }
+}
+window.saveVisitForm = function(_trigger, _silent = false, _close = false, _doneCallback = null) {
+    let form = $(_trigger).closest('form');
+
+    if (!_silent && !form[0].checkValidity()) {
+        form[0].reportValidity();
+        return false;
+    }
+
+    fillJsonDataField(form);
 
     let closeOnSave = false, noteSection = form.closest('.note-section');
     if($(_trigger).closest('[visit-moe]').is('[close-on-save]')) {

+ 116 - 0
resources/views/app/patient/exercise-center.blade.php

@@ -0,0 +1,116 @@
+<?php
+
+use App\Models\Point;
+use App\Models\Client;
+use App\Models\Note;
+use App\Models\Segment;
+
+/** @var Client $patient */
+/** @var Note $note */
+
+$aerobicActivity = Point::getOnlyPointOfCategory($patient, 'AEROBIC_ACTIVITY');
+$strengthTraining = Point::getOnlyPointOfCategory($patient, 'STRENGTH_TRAINING');
+$neat = Point::getOnlyPointOfCategory($patient, 'NEAT');
+
+$points = [
+    ["category" => 'AEROBIC_ACTIVITY', "name" => 'Aerobic Activity', "point" => $aerobicActivity],
+    ["category" => 'STRENGTH_TRAINING', "name" => 'Strength Training', "point" => $strengthTraining],
+    ["category" => 'NEAT', "name" => 'Non-Exercise Activity Time (NEAT)', "point" => $neat],
+];
+?>
+
+<div class="mt-3 p-3 border-top-exercise-rx" id="exercise-center-{{$note->id}}">
+    <div class="point-table-container">
+
+        <table class="table table-sm table-bordered mb-0 bg-white mb-2 point-table">
+
+            @foreach($points as $p)
+                <?php $point = $p['point']; ?>
+                <tr class="point-row" data-uid="{{$point ? $point->uid : ''}}">
+                    <td>
+                        <div class="d-flex align-items-center">
+                            <b class="mr-2">{{$p['name']}}</b>
+                            @if($p['category'] === 'HIGH_SUGAR_BEVERAGES')
+                                <img src="/img/nutrition-rx/hsb.png" class="icon-nutrition-rx-row" alt="">
+                            @elseif($p['category'] === 'WATER_INTAKE')
+                                <img src="/img/nutrition-rx/wi.png" class="icon-nutrition-rx-row" alt="">
+                            @elseif($p['category'] === 'VEGETABLES')
+                                <img src="/img/nutrition-rx/vc.png" class="icon-nutrition-rx-row" alt="">
+                            @elseif($p['category'] === 'DAILY_INTAKE_CARBOHYDRATES' || $p['category'] === 'DAILY_INTAKE_CALORIES')
+                                <img src="/img/nutrition-rx/ig.png" class="icon-nutrition-rx-row" alt="">
+                            @endif
+                        </div>
+                        <div class="text-sm mt-1">
+                            @if($p['category'] === 'HIGH_SUGAR_BEVERAGES')
+                                E.g. soda, sweet tea, coffee, juice, etc.
+                            @elseif($p['category'] === 'WATER_INTAKE')
+                                Ounces per day
+                            @elseif($p['category'] === 'FAST_FOOD')
+                                Meals per week
+                            @elseif($p['category'] === 'PORTION_SIZES')
+                                Servings per meal
+                            @elseif($p['category'] === 'DAILY_INTAKE_CARBOHYDRATES' || $p['category'] === 'DAILY_INTAKE_CALORIES')
+
+                            @endif
+                        </div>
+                    </td>
+                    <td class="w-40">
+                        <div class="d-flex align-items-start position-relative">
+                            <div class="flex-grow-1">
+                                @if($point)
+                                    <?php
+                                    include resource_path('views/app/patient/segment-templates/_child_review/exercise/' . $p['category'] . '/last-review.php');
+                                    ?>
+                                @else
+                                    -
+                                @endif
+                            </div>
+                            <div class="d-inline-flex flex-column ml-1">
+                                <?php
+                                $segment = $note->getSegmentByInternalName('intake_exercise');
+                                if($segment) {
+                                    include resource_path('views/app/patient/segment-templates/_child_review/exercise/' . $p['category'] . '/edit-review.php');
+                                }
+                                ?>
+                            </div>
+                        </div>
+                    </td>
+                    <td class="w-40">
+                        <div class="d-flex align-items-start position-relative">
+                            <div class="flex-grow-1">
+                                @if($point)
+                                    <?php
+                                    include resource_path('views/app/patient/segment-templates/_child_plan/exercise/' . $p['category'] . '/last-plan.php');
+                                    ?>
+                                @else
+                                    -
+                                @endif
+                            </div>
+                            <div class="d-inline-flex flex-column ml-1">
+                                <?php
+                                $segment = $note->getSegmentByInternalName('plan_exercise');
+                                if($segment) {
+                                    include resource_path('views/app/patient/segment-templates/_child_plan/exercise/' . $p['category'] . '/edit-plan.php');
+                                }
+                                ?>
+                            </div>
+                        </div>
+                    </td>
+                </tr>
+            @endforeach
+
+        </table>
+
+    </div>
+</div>
+<script>
+    (function() {
+        function init() {
+            let parentSegment = $('#exercise-center-{{$note->id}}');
+            @include('app.patient.wizard-partials.common-script', ['label' => 'exercise', 'segment_part' => 'exercise'])
+            initSegmentMoes(parentSegment);
+            __initRTEs(parentSegment.find('[note-rte]:not(.ql-container)'));
+        }
+        addMCInitializer('exercise-center-{{$note->id}}', init, '#exercise-center-{{$note->id}}');
+    }).call(window);
+</script>

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

@@ -165,6 +165,16 @@
                             return false;
                         }
 
+                        if(editParent.is('[data-segment-template-name="plan_exercise"]') ||
+                            editParent.is('[data-segment-template-name="intake_exercise"]')) {
+                            openDynamicStagPopup('/exercise-center/{{$note->client->uid}}/{{$note->uid}}',
+                                'exercise-center-{{$note->id}}',
+                                '<img src="/img/exercise-rx.png" class=""/> Exercise Rx',
+                                false,
+                                "medium-large overflow-visible");
+                            return false;
+                        }
+
                         // 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');

+ 118 - 0
resources/views/app/patient/segment-templates/_child_plan/exercise/AEROBIC_ACTIVITY/edit-plan.php

@@ -0,0 +1,118 @@
+<?php
+$currentValue = '';
+$previousValue = '';
+$previousChildPlan = null;
+if (@$point) {
+    if ($point->lastChildPlan && $point->last_child_plan_point_scoped_note_id === $note->id) {
+        $parsedPlan = json_decode($point->lastChildPlan->data);
+        if(@$parsedPlan->value) {
+            $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);
+            if(@$parsedPlan->value) {
+                $previousValue = $parsedPlan->value;
+            }
+        }
+    }
+}
+?>
+<div moe wide class="d-inline">
+    <a start show href="#" class="px-1 text-center d-block" title="<?= !empty($currentValue) ? 'Edit Plan' : 'Add Plan'?>">
+        <i class="fa <?= !empty($currentValue) ? 'fa-pencil-alt' : 'fa-plus-square'?>"></i>
+    </a>
+    <?php if($point): ?>
+        <form url="/api/visitPoint/upsertChildPlan" class="mcp-theme-1 w-100 frm-upsert-review-plan-nutrition" 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 === '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 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; ?>
+
+            <p class="mb-2"><b>Change goal:</b></p>
+
+            <div class="mb-2">
+                <div note-rte
+                    <?= $segment->segmentTemplate->internal_name === 'intake_problems' ? 'use-shortcuts="hpi,user"' : '' ?>
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="value"><?= $currentValue ?></div>
+            </div>
+            <div>
+                <button type="submit"  class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    <?php else: ?>
+        <form url="/api/visitPoint/addTopLevel" class="mcp-theme-1 frm-add-review-plan-nutrition w-100" left>
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="category" value="<?= $p['category'] ?>">
+            <input type="hidden" name="additionReasonCategory" value="ON_INTAKE">
+            <input type="hidden" name="data">
+
+            <?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; ?>
+
+            <p class="mb-2"><b>Change goal:</b></p>
+
+            <div class="mb-2">
+                <div note-rte
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="planValue"><?= $currentValue ?></div>
+            </div>
+            <div>
+                <button type="submit" class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    <?php endif; ?>
+</div>
+<?php if(!empty($currentValue)): ?>
+    <div visit-moe relative class="d-inline">
+        <a start show href="#" class="px-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; ?>
+

+ 33 - 0
resources/views/app/patient/segment-templates/_child_plan/exercise/AEROBIC_ACTIVITY/last-plan.php

@@ -0,0 +1,33 @@
+<div class="mb-1 font-weight-bold text-secondary">Change Goal</div>
+<?php if ($point->lastChildPlan): ?>
+    <?php $parsedPlan = json_decode($point->lastChildPlan->data); ?>
+    <div class="<?= $point->last_child_plan_point_scoped_note_id === $note->id ? 'bg-warning-mellow p-2 rounded' : '' ?>">
+        <div class="inline-html-container"><?= $parsedPlan->value ?></div>
+        <div class="text-secondary text-sm"></div>
+
+        <?php if ($point->last_child_plan_point_scoped_note_id === $patient->core_note_id): ?>
+            <span class="text-sm">(updated on the patient's chart)</span>
+        <?php else: ?>
+            <?php if ($point->last_child_plan_point_scoped_note_id === $note->id): ?>
+                <span class="text-sm">(updated on this note)</span>
+            <?php else: ?>
+                <div class="d-inline position-relative on-click-menu">
+                    <span class="text-sm text-primary c-pointer">
+                        <?= relative_friendly_date($point->last_child_plan_effective_date) ?>
+                        <?php if($point->lastChildPlan->creatorPro): ?>
+                            by <?= $point->lastChildPlan->creatorPro->displayName() ?>
+                        <?php endif; ?>
+                    </span>
+                    <div menu right class="bg-white border">
+                        <a native target="_blank"
+                           href="<?= route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $point->lastChildPlanNote]) ?>"
+                           class="px-2 py-1 d-block text-nowrap text-sm">Go to note</a>
+                    </div>
+                </div>
+            <?php endif; ?>
+        <?php endif; ?>
+
+    </div>
+<?php else: ?>
+    <span class="text-secondary text-sm">None</span>
+<?php endif; ?>

+ 118 - 0
resources/views/app/patient/segment-templates/_child_plan/exercise/NEAT/edit-plan.php

@@ -0,0 +1,118 @@
+<?php
+$currentValue = '';
+$previousValue = '';
+$previousChildPlan = null;
+if (@$point) {
+    if ($point->lastChildPlan && $point->last_child_plan_point_scoped_note_id === $note->id) {
+        $parsedPlan = json_decode($point->lastChildPlan->data);
+        if(@$parsedPlan->value) {
+            $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);
+            if(@$parsedPlan->value) {
+                $previousValue = $parsedPlan->value;
+            }
+        }
+    }
+}
+?>
+<div moe wide class="d-inline">
+    <a start show href="#" class="px-1 text-center d-block" title="<?= !empty($currentValue) ? 'Edit Plan' : 'Add Plan'?>">
+        <i class="fa <?= !empty($currentValue) ? 'fa-pencil-alt' : 'fa-plus-square'?>"></i>
+    </a>
+    <?php if($point): ?>
+        <form url="/api/visitPoint/upsertChildPlan" class="mcp-theme-1 w-100 frm-upsert-review-plan-nutrition" 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 === '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 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; ?>
+
+            <p class="mb-2"><b>Change goal:</b></p>
+
+            <div class="mb-2">
+                <div note-rte
+                    <?= $segment->segmentTemplate->internal_name === 'intake_problems' ? 'use-shortcuts="hpi,user"' : '' ?>
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="value"><?= $currentValue ?></div>
+            </div>
+            <div>
+                <button type="submit"  class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    <?php else: ?>
+        <form url="/api/visitPoint/addTopLevel" class="mcp-theme-1 frm-add-review-plan-nutrition w-100" left>
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="category" value="<?= $p['category'] ?>">
+            <input type="hidden" name="additionReasonCategory" value="ON_INTAKE">
+            <input type="hidden" name="data">
+
+            <?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; ?>
+
+            <p class="mb-2"><b>Change goal:</b></p>
+
+            <div class="mb-2">
+                <div note-rte
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="planValue"><?= $currentValue ?></div>
+            </div>
+            <div>
+                <button type="submit" class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    <?php endif; ?>
+</div>
+<?php if(!empty($currentValue)): ?>
+    <div visit-moe relative class="d-inline">
+        <a start show href="#" class="px-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; ?>
+

+ 33 - 0
resources/views/app/patient/segment-templates/_child_plan/exercise/NEAT/last-plan.php

@@ -0,0 +1,33 @@
+<div class="mb-1 font-weight-bold text-secondary">Change Goal</div>
+<?php if ($point->lastChildPlan): ?>
+    <?php $parsedPlan = json_decode($point->lastChildPlan->data); ?>
+    <div class="<?= $point->last_child_plan_point_scoped_note_id === $note->id ? 'bg-warning-mellow p-2 rounded' : '' ?>">
+        <div class="inline-html-container"><?= $parsedPlan->value ?></div>
+        <div class="text-secondary text-sm"></div>
+
+        <?php if ($point->last_child_plan_point_scoped_note_id === $patient->core_note_id): ?>
+            <span class="text-sm">(updated on the patient's chart)</span>
+        <?php else: ?>
+            <?php if ($point->last_child_plan_point_scoped_note_id === $note->id): ?>
+                <span class="text-sm">(updated on this note)</span>
+            <?php else: ?>
+                <div class="d-inline position-relative on-click-menu">
+                    <span class="text-sm text-primary c-pointer">
+                        <?= relative_friendly_date($point->last_child_plan_effective_date) ?>
+                        <?php if($point->lastChildPlan->creatorPro): ?>
+                            by <?= $point->lastChildPlan->creatorPro->displayName() ?>
+                        <?php endif; ?>
+                    </span>
+                    <div menu right class="bg-white border">
+                        <a native target="_blank"
+                           href="<?= route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $point->lastChildPlanNote]) ?>"
+                           class="px-2 py-1 d-block text-nowrap text-sm">Go to note</a>
+                    </div>
+                </div>
+            <?php endif; ?>
+        <?php endif; ?>
+
+    </div>
+<?php else: ?>
+    <span class="text-secondary text-sm">None</span>
+<?php endif; ?>

+ 118 - 0
resources/views/app/patient/segment-templates/_child_plan/exercise/STRENGTH_TRAINING/edit-plan.php

@@ -0,0 +1,118 @@
+<?php
+$currentValue = '';
+$previousValue = '';
+$previousChildPlan = null;
+if (@$point) {
+    if ($point->lastChildPlan && $point->last_child_plan_point_scoped_note_id === $note->id) {
+        $parsedPlan = json_decode($point->lastChildPlan->data);
+        if(@$parsedPlan->value) {
+            $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);
+            if(@$parsedPlan->value) {
+                $previousValue = $parsedPlan->value;
+            }
+        }
+    }
+}
+?>
+<div moe wide class="d-inline">
+    <a start show href="#" class="px-1 text-center d-block" title="<?= !empty($currentValue) ? 'Edit Plan' : 'Add Plan'?>">
+        <i class="fa <?= !empty($currentValue) ? 'fa-pencil-alt' : 'fa-plus-square'?>"></i>
+    </a>
+    <?php if($point): ?>
+        <form url="/api/visitPoint/upsertChildPlan" class="mcp-theme-1 w-100 frm-upsert-review-plan-nutrition" 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 === '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 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; ?>
+
+            <p class="mb-2"><b>Change goal:</b></p>
+
+            <div class="mb-2">
+                <div note-rte
+                    <?= $segment->segmentTemplate->internal_name === 'intake_problems' ? 'use-shortcuts="hpi,user"' : '' ?>
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="value"><?= $currentValue ?></div>
+            </div>
+            <div>
+                <button type="submit"  class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    <?php else: ?>
+        <form url="/api/visitPoint/addTopLevel" class="mcp-theme-1 frm-add-review-plan-nutrition w-100" left>
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="category" value="<?= $p['category'] ?>">
+            <input type="hidden" name="additionReasonCategory" value="ON_INTAKE">
+            <input type="hidden" name="data">
+
+            <?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; ?>
+
+            <p class="mb-2"><b>Change goal:</b></p>
+
+            <div class="mb-2">
+                <div note-rte
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="planValue"><?= $currentValue ?></div>
+            </div>
+            <div>
+                <button type="submit" class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    <?php endif; ?>
+</div>
+<?php if(!empty($currentValue)): ?>
+    <div visit-moe relative class="d-inline">
+        <a start show href="#" class="px-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; ?>
+

+ 33 - 0
resources/views/app/patient/segment-templates/_child_plan/exercise/STRENGTH_TRAINING/last-plan.php

@@ -0,0 +1,33 @@
+<div class="mb-1 font-weight-bold text-secondary">Change Goal</div>
+<?php if ($point->lastChildPlan): ?>
+    <?php $parsedPlan = json_decode($point->lastChildPlan->data); ?>
+    <div class="<?= $point->last_child_plan_point_scoped_note_id === $note->id ? 'bg-warning-mellow p-2 rounded' : '' ?>">
+        <div class="inline-html-container"><?= $parsedPlan->value ?></div>
+        <div class="text-secondary text-sm"></div>
+
+        <?php if ($point->last_child_plan_point_scoped_note_id === $patient->core_note_id): ?>
+            <span class="text-sm">(updated on the patient's chart)</span>
+        <?php else: ?>
+            <?php if ($point->last_child_plan_point_scoped_note_id === $note->id): ?>
+                <span class="text-sm">(updated on this note)</span>
+            <?php else: ?>
+                <div class="d-inline position-relative on-click-menu">
+                    <span class="text-sm text-primary c-pointer">
+                        <?= relative_friendly_date($point->last_child_plan_effective_date) ?>
+                        <?php if($point->lastChildPlan->creatorPro): ?>
+                            by <?= $point->lastChildPlan->creatorPro->displayName() ?>
+                        <?php endif; ?>
+                    </span>
+                    <div menu right class="bg-white border">
+                        <a native target="_blank"
+                           href="<?= route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $point->lastChildPlanNote]) ?>"
+                           class="px-2 py-1 d-block text-nowrap text-sm">Go to note</a>
+                    </div>
+                </div>
+            <?php endif; ?>
+        <?php endif; ?>
+
+    </div>
+<?php else: ?>
+    <span class="text-secondary text-sm">None</span>
+<?php endif; ?>

+ 314 - 0
resources/views/app/patient/segment-templates/_child_review/exercise/AEROBIC_ACTIVITY/edit-review.php

@@ -0,0 +1,314 @@
+<?php
+
+/*
+Format:
+{
+    active: true/false,
+    walk: {
+        active: true/false,
+        frequency: 1..7,
+        intensity: light/moderate/vigorous,
+        time: number,
+    },
+    jog: {
+        active: true/false,
+        frequency: 1..7,
+        intensity: light/moderate/vigorous,
+        time: number,
+    },
+    elliptical: {
+        active: true/false,
+        frequency: 1..7,
+        intensity: light/moderate/vigorous,
+        time: number,
+    },
+    swim: {
+        active: true/false,
+        frequency: 1..7,
+        intensity: light/moderate/vigorous,
+        time: number,
+    },
+    bike: {
+        active: true/false,
+        frequency: 1..7,
+        intensity: light/moderate/vigorous,
+        time: number,
+    },
+    memo: text
+}
+ */
+
+$currentValue = '';
+$previousValue = '';
+$previousChildReview = null;
+if (@$point) {
+    if ($point->lastChildReview && $point->last_child_review_point_scoped_note_id === $note->id) {
+        $currentValue = json_decode($point->lastChildReview->data);
+        $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) {
+            $previousValue = json_decode($previousChildReview->data);
+        }
+    }
+    else {
+        $previousChildReview = \App\Models\Point::where('parent_point_id', $point->id)
+            ->where('category', 'REVIEW')
+            ->orderBy('id', 'DESC')
+            ->first();
+        if($previousChildReview && $previousChildReview->data) {
+            $previousValue = json_decode($previousChildReview->data);
+        }
+    }
+}
+?>
+<div visit-moe fixed-center largest relative class="d-inline">
+    <a start show href="#" class="px-1 text-center d-block" title="<?= !empty($currentValue) ? 'Edit Subjective' : 'Add Subjective'?>">
+        <i class="fa <?= !empty($currentValue) ? 'fa-pencil-alt' : 'fa-plus-square'?>"></i>
+    </a>
+    <form url="/api/visitPoint/<?= $point ? 'upsertChildReview' : 'addTopLevel' ?>"
+          class="mcp-theme-1 frm-review-plan-exercise" right>
+
+        <?php if($point): ?>
+            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+            <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
+        <?php else: ?>
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="category" value="<?= $p['category'] ?>">
+            <input type="hidden" name="additionReasonCategory" value="ON_INTAKE">
+        <?php endif; ?>
+
+        <?php if ($point): ?>
+            <input type="hidden" name="data">
+        <?php else: ?>
+            <input type="hidden" name="childReviewData">
+        <?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) ?>)</span>
+                </div>
+                <div class="p-2 bg-light border inline-html-container">
+                    <?php $review = $previousValue; ?>
+                    <?php include(resource_path('views/app/patient/segment-templates/_child_review/exercise/' . $p['category'] . '/view-review.php')); ?>
+                </div>
+            </div>
+        <?php endif; ?>
+
+        <p class="mb-2"><b>Current Aerobic Activity</b></p>
+
+        <label class="mb-2 d-flex align-items-center">
+            <input type="checkbox" data-name="active" <?= @($currentValue->active) ? 'checked' : ''?>>
+            <span class="ml-2">Any current aerobic activities?</span>
+        </label>
+
+        <table if-active class="table table-sm table-bordered" style="table-layout: fixed">
+            <tbody>
+            <tr>
+                <td class="align-middle">Activity</td>
+                <td class="text-left">
+                    <div class="d-flex align-items-center">
+                        <input type="checkbox" class="d-none" data-name="walk->active" <?= @($currentValue->walk->active) ? 'checked' : '' ?>>
+                        <img src="/img/exercise-rx/walk.png" class="icon-nutrition-rx-row mx-1 <?= @($currentValue->walk->active) ? '' : 'opacity-35' ?>">
+                        <button data-type="walk" class="btn-toggle-activity flex-grow-1 shadow-none btn btn-sm <?= @($currentValue->walk->active) ? 'btn-info' : 'btn-default border' ?>">
+                            Walk
+                        </button>
+                    </div>
+                </td>
+                <td class="text-left">
+                    <div class="d-flex align-items-center">
+                        <input type="checkbox" class="d-none" data-name="jog->active" <?= @($currentValue->jog->active) ? 'checked' : '' ?>>
+                        <img src="/img/exercise-rx/jog.png" class="icon-nutrition-rx-row mx-1 <?= @($currentValue->jog->active) ? '' : 'opacity-35' ?>">
+                        <button data-type="jog" class="btn-toggle-activity flex-grow-1 shadow-none btn btn-sm <?= @($currentValue->jog->active) ? 'btn-info' : 'btn-default border' ?>">
+                            Jog
+                        </button>
+                    </div>
+                </td>
+                <td class="text-left">
+                    <div class="d-flex align-items-center">
+                        <input type="checkbox" class="d-none" data-name="elliptical->active" <?= @($currentValue->elliptical->active) ? 'checked' : '' ?>>
+                        <img src="/img/exercise-rx/elliptical.png" class="icon-nutrition-rx-row mx-1 <?= @($currentValue->elliptical->active) ? '' : 'opacity-35' ?>">
+                        <button data-type="elliptical" class="btn-toggle-activity flex-grow-1 shadow-none btn btn-sm <?= @($currentValue->elliptical->active) ? 'btn-info' : 'btn-default border' ?>">
+                            Elliptical
+                        </button>
+                    </div>
+                </td>
+                <td class="text-left">
+                    <div class="d-flex align-items-center">
+                        <input type="checkbox" class="d-none" data-name="swim->active" <?= @($currentValue->swim->active) ? 'checked' : '' ?>>
+                        <img src="/img/exercise-rx/swim.png" class="icon-nutrition-rx-row mx-1 <?= @($currentValue->swim->active) ? '' : 'opacity-35' ?>">
+                        <button data-type="swim" class="btn-toggle-activity flex-grow-1 shadow-none btn btn-sm <?= @($currentValue->swim->active) ? 'btn-info' : 'btn-default border' ?>">
+                            Swim
+                        </button>
+                    </div>
+                </td>
+                <td class="text-left">
+                    <div class="d-flex align-items-center">
+                        <input type="checkbox" class="d-none" data-name="bike->active" <?= @($currentValue->bike->active) ? 'checked' : '' ?>>
+                        <img src="/img/exercise-rx/bike.png" class="icon-nutrition-rx-row mx-1 <?= @($currentValue->bike->active) ? '' : 'opacity-35' ?>">
+                        <button data-type="bike" class="btn-toggle-activity flex-grow-1 shadow-none btn btn-sm <?= @($currentValue->bike->active) ? 'btn-info' : 'btn-default border' ?>">
+                            Bike
+                        </button>
+                    </div>
+                </td>
+            </tr>
+            <tr>
+                <td>Frequency (days/wk)</td>
+                <td>
+                    <select if-walk-active class="form-control form-control-sm min-width-unset px-0" data-name="walk->frequency">
+                        <option value="">-- select --</option>
+                        <option value="1" <?= @($currentValue->walk->frequency) == 1 ? 'selected' : ''?>>1 day</option>
+                        <option value="2" <?= @($currentValue->walk->frequency) == 2 ? 'selected' : ''?>>2 days</option>
+                        <option value="3" <?= @($currentValue->walk->frequency) == 3 ? 'selected' : ''?>>3 days</option>
+                        <option value="4" <?= @($currentValue->walk->frequency) == 4 ? 'selected' : ''?>>4 days</option>
+                        <option value="5" <?= @($currentValue->walk->frequency) == 5 ? 'selected' : ''?>>5 days</option>
+                        <option value="6" <?= @($currentValue->walk->frequency) == 6 ? 'selected' : ''?>>6 days</option>
+                        <option value="7" <?= @($currentValue->walk->frequency) == 7 ? 'selected' : ''?>>7 days</option>
+                    </select>
+                </td>
+                <td>
+                    <select if-jog-active class="form-control form-control-sm min-width-unset px-0" data-name="jog->frequency">
+                        <option value="">-- select --</option>
+                        <option value="1" <?= @($currentValue->jog->frequency) == 1 ? 'selected' : ''?>>1 day</option>
+                        <option value="2" <?= @($currentValue->jog->frequency) == 2 ? 'selected' : ''?>>2 days</option>
+                        <option value="3" <?= @($currentValue->jog->frequency) == 3 ? 'selected' : ''?>>3 days</option>
+                        <option value="4" <?= @($currentValue->jog->frequency) == 4 ? 'selected' : ''?>>4 days</option>
+                        <option value="5" <?= @($currentValue->jog->frequency) == 5 ? 'selected' : ''?>>5 days</option>
+                        <option value="6" <?= @($currentValue->jog->frequency) == 6 ? 'selected' : ''?>>6 days</option>
+                        <option value="7" <?= @($currentValue->jog->frequency) == 7 ? 'selected' : ''?>>7 days</option>
+                    </select>
+                </td>
+                <td>
+                    <select if-elliptical-active class="form-control form-control-sm min-width-unset px-0" data-name="elliptical->frequency">
+                        <option value="">-- select --</option>
+                        <option value="1" <?= @($currentValue->elliptical->frequency) == 1 ? 'selected' : ''?>>1 day</option>
+                        <option value="2" <?= @($currentValue->elliptical->frequency) == 2 ? 'selected' : ''?>>2 days</option>
+                        <option value="3" <?= @($currentValue->elliptical->frequency) == 3 ? 'selected' : ''?>>3 days</option>
+                        <option value="4" <?= @($currentValue->elliptical->frequency) == 4 ? 'selected' : ''?>>4 days</option>
+                        <option value="5" <?= @($currentValue->elliptical->frequency) == 5 ? 'selected' : ''?>>5 days</option>
+                        <option value="6" <?= @($currentValue->elliptical->frequency) == 6 ? 'selected' : ''?>>6 days</option>
+                        <option value="7" <?= @($currentValue->elliptical->frequency) == 7 ? 'selected' : ''?>>7 days</option>
+                    </select>
+                </td>
+                <td>
+                    <select if-swim-active class="form-control form-control-sm min-width-unset px-0" data-name="swim->frequency">
+                        <option value="">-- select --</option>
+                        <option value="1" <?= @($currentValue->swim->frequency) == 1 ? 'selected' : ''?>>1 day</option>
+                        <option value="2" <?= @($currentValue->swim->frequency) == 2 ? 'selected' : ''?>>2 days</option>
+                        <option value="3" <?= @($currentValue->swim->frequency) == 3 ? 'selected' : ''?>>3 days</option>
+                        <option value="4" <?= @($currentValue->swim->frequency) == 4 ? 'selected' : ''?>>4 days</option>
+                        <option value="5" <?= @($currentValue->swim->frequency) == 5 ? 'selected' : ''?>>5 days</option>
+                        <option value="6" <?= @($currentValue->swim->frequency) == 6 ? 'selected' : ''?>>6 days</option>
+                        <option value="7" <?= @($currentValue->swim->frequency) == 7 ? 'selected' : ''?>>7 days</option>
+                    </select>
+                </td>
+                <td>
+                    <select if-bike-active class="form-control form-control-sm min-width-unset px-0" data-name="bike->frequency">
+                        <option value="">-- select --</option>
+                        <option value="1" <?= @($currentValue->bike->frequency) == 1 ? 'selected' : ''?>>1 day</option>
+                        <option value="2" <?= @($currentValue->bike->frequency) == 2 ? 'selected' : ''?>>2 days</option>
+                        <option value="3" <?= @($currentValue->bike->frequency) == 3 ? 'selected' : ''?>>3 days</option>
+                        <option value="4" <?= @($currentValue->bike->frequency) == 4 ? 'selected' : ''?>>4 days</option>
+                        <option value="5" <?= @($currentValue->bike->frequency) == 5 ? 'selected' : ''?>>5 days</option>
+                        <option value="6" <?= @($currentValue->bike->frequency) == 6 ? 'selected' : ''?>>6 days</option>
+                        <option value="7" <?= @($currentValue->bike->frequency) == 7 ? 'selected' : ''?>>7 days</option>
+                    </select>
+                </td>
+            </tr>
+            <tr>
+                <td>Intensity</td>
+                <td>
+                    <select if-walk-active class="form-control form-control-sm min-width-unset px-0" data-name="walk->intensity">
+                        <option value="">-- select --</option>
+                        <option value="Light" <?= @($currentValue->walk->intensity) == 'Light' ? 'selected' : ''?>>Light</option>
+                        <option value="Moderate" <?= @($currentValue->walk->intensity) == 'Moderate' ? 'selected' : ''?>>Moderate</option>
+                        <option value="Vigorous" <?= @($currentValue->walk->intensity) == 'Vigorous' ? 'selected' : ''?>>Vigorous</option>
+                    </select>
+                </td>
+                <td>
+                    <select if-jog-active class="form-control form-control-sm min-width-unset px-0" data-name="jog->intensity">
+                        <option value="">-- select --</option>
+                        <option value="Light" <?= @($currentValue->jog->intensity) == 'Light' ? 'selected' : ''?>>Light</option>
+                        <option value="Moderate" <?= @($currentValue->jog->intensity) == 'Moderate' ? 'selected' : ''?>>Moderate</option>
+                        <option value="Vigorous" <?= @($currentValue->jog->intensity) == 'Vigorous' ? 'selected' : ''?>>Vigorous</option>
+                    </select>
+                </td>
+                <td>
+                    <select if-elliptical-active class="form-control form-control-sm min-width-unset px-0" data-name="elliptical->intensity">
+                        <option value="">-- select --</option>
+                        <option value="Light" <?= @($currentValue->elliptical->intensity) == 'Light' ? 'selected' : ''?>>Light</option>
+                        <option value="Moderate" <?= @($currentValue->elliptical->intensity) == 'Moderate' ? 'selected' : ''?>>Moderate</option>
+                        <option value="Vigorous" <?= @($currentValue->elliptical->intensity) == 'Vigorous' ? 'selected' : ''?>>Vigorous</option>
+                    </select>
+                </td>
+                <td>
+                    <select if-swim-active class="form-control form-control-sm min-width-unset px-0" data-name="swim->intensity">
+                        <option value="">-- select --</option>
+                        <option value="Light" <?= @($currentValue->swim->intensity) == 'Light' ? 'selected' : ''?>>Light</option>
+                        <option value="Moderate" <?= @($currentValue->swim->intensity) == 'Moderate' ? 'selected' : ''?>>Moderate</option>
+                        <option value="Vigorous" <?= @($currentValue->swim->intensity) == 'Vigorous' ? 'selected' : ''?>>Vigorous</option>
+                    </select>
+                </td>
+                <td>
+                    <select if-bike-active class="form-control form-control-sm min-width-unset px-0" data-name="bike->intensity">
+                        <option value="">-- select --</option>
+                        <option value="Light" <?= @($currentValue->bike->intensity) == 'Light' ? 'selected' : ''?>>Light</option>
+                        <option value="Moderate" <?= @($currentValue->bike->intensity) == 'Moderate' ? 'selected' : ''?>>Moderate</option>
+                        <option value="Vigorous" <?= @($currentValue->bike->intensity) == 'Vigorous' ? 'selected' : ''?>>Vigorous</option>
+                    </select>
+                </td>
+            </tr>
+            <tr>
+                <td>Time (mins/day)</td>
+                <td>
+                    <input if-walk-active class="form-control form-control-sm min-width-unset px-1" type="text" data-name="walk->time" value="<?= @($currentValue->walk->time) ?>">
+                </td>
+                <td>
+                    <input if-jog-active class="form-control form-control-sm min-width-unset px-1" type="text" data-name="jog->time" value="<?= @($currentValue->jog->time) ?>">
+                </td>
+                <td>
+                    <input if-elliptical-active class="form-control form-control-sm min-width-unset px-1" type="text" data-name="elliptical->time" value="<?= @($currentValue->elliptical->time) ?>">
+                </td>
+                <td>
+                    <input if-swim-active class="form-control form-control-sm min-width-unset px-1" type="text" data-name="swim->time" value="<?= @($currentValue->swim->time) ?>">
+                </td>
+                <td>
+                    <input if-bike-active class="form-control form-control-sm min-width-unset px-1" type="text" data-name="bike->time" value="<?= @($currentValue->bike->time) ?>">
+                </td>
+            </tr>
+            </tbody>
+        </table>
+
+        <div if-active class="mb-2">
+            <label for="" class="mb-1">Memo</label>
+            <div note-rte slim-rte
+                 class="form-group mb-2 border-left border-right rte-holder"
+                 data-field-name="memo"><?= @($currentValue->memo) ?></div>
+        </div>
+        <div>
+            <button type="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="px-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; ?>
+

+ 35 - 0
resources/views/app/patient/segment-templates/_child_review/exercise/AEROBIC_ACTIVITY/last-review.php

@@ -0,0 +1,35 @@
+<div class="mb-1 font-weight-bold text-secondary">Current Aerobic Activity</div>
+<?php if ($point->lastChildReview): ?>
+    <?php $parsedReview = json_decode($point->lastChildReview->data); ?>
+    <div class="<?= $point->last_child_review_point_scoped_note_id === $note->id ? 'bg-warning-mellow p-2 rounded' : '' ?>">
+        <div class="inline-html-container">
+            <?php $review = $parsedReview; ?>
+            <?php include(resource_path('views/app/patient/segment-templates/_child_review/exercise/' . $p['category'] . '/view-review.php')); ?>
+        </div>
+
+        <?php if ($point->last_child_review_point_scoped_note_id === $patient->core_note_id): ?>
+            <span class="text-sm">(updated on the patient's chart)</span>
+        <?php else: ?>
+            <?php if ($point->last_child_review_point_scoped_note_id === $note->id): ?>
+                <span class="text-sm">(updated on this note)</span>
+            <?php else: ?>
+                <div class="d-inline position-relative on-click-menu">
+                    <span class="text-sm text-primary c-pointer">
+                        <?= relative_friendly_date($point->last_child_review_effective_date) ?>
+                        <?php if($point->lastChildReview->creatorPro): ?>
+                        by <?= $point->lastChildReview->creatorPro->displayName() ?>
+                        <?php endif; ?>
+                    </span>
+                    <div menu right class="bg-white border">
+                        <a native target="_blank"
+                           href="<?= route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $point->lastChildReviewNote]) ?>"
+                           class="px-2 py-1 d-block text-nowrap text-sm">Go to note</a>
+                    </div>
+                </div>
+            <?php endif; ?>
+        <?php endif; ?>
+
+    </div>
+<?php else: ?>
+    <span class="text-secondary text-sm">None</span>
+<?php endif; ?>

+ 56 - 0
resources/views/app/patient/segment-templates/_child_review/exercise/AEROBIC_ACTIVITY/view-review.php

@@ -0,0 +1,56 @@
+<?php
+if(@$review && @($review->active)) {
+    if (@($review->walk->active)) {
+    ?>
+        <div class="mb-1 d-flex align-items-baseline">
+            <span><?= @($review->walk->intensity) ?: '-' ?> Walk</span>
+            <span class="ml-2 text-sm"><?= @($review->walk->frequency) ?: '-' ?> day(s)/week</span>
+            <span class="ml-2 text-sm"><?= @($review->walk->time) ?: '-' ?> min(s)/day</span>
+        </div>
+    <?php
+    }
+    if (@($review->jog->active)) {
+        ?>
+        <div class="mb-1 d-flex align-items-baseline">
+            <span><?= @($review->jog->intensity) ?: '-' ?> Walk</span>
+            <span class="ml-2 text-sm"><?= @($review->jog->frequency) ?: '-' ?> day(s)/week</span>
+            <span class="ml-2 text-sm"><?= @($review->jog->time) ?: '-' ?> min(s)/day</span>
+        </div>
+        <?php
+    }
+    if (@($review->elliptical->active)) {
+        ?>
+        <div class="mb-1 d-flex align-items-baseline">
+            <span><?= @($review->elliptical->intensity) ?: '-' ?> Walk</span>
+            <span class="ml-2 text-sm"><?= @($review->elliptical->frequency) ?: '-' ?> day(s)/week</span>
+            <span class="ml-2 text-sm"><?= @($review->elliptical->time) ?: '-' ?> min(s)/day</span>
+        </div>
+        <?php
+    }
+    if (@($review->swim->active)) {
+        ?>
+        <div class="mb-1 d-flex align-items-baseline">
+            <span><?= @($review->swim->intensity) ?: '-' ?> Walk</span>
+            <span class="ml-2 text-sm"><?= @($review->swim->frequency) ?: '-' ?> day(s)/week</span>
+            <span class="ml-2 text-sm"><?= @($review->swim->time) ?: '-' ?> min(s)/day</span>
+        </div>
+        <?php
+    }
+    if (@($review->bike->active)) {
+        ?>
+        <div class="mb-1 d-flex align-items-baseline">
+            <span><?= @($review->bike->intensity) ?: '-' ?> Walk</span>
+            <span class="ml-2 text-sm"><?= @($review->bike->frequency) ?: '-' ?> day(s)/week</span>
+            <span class="ml-2 text-sm"><?= @($review->bike->time) ?: '-' ?> min(s)/day</span>
+        </div>
+        <?php
+    }
+    ?>
+    <div class="text-secondary"><?= @($review->memo) ?: '' ?></div>
+    <?php
+}
+else {
+    ?> - <?php
+}
+?>
+

+ 118 - 0
resources/views/app/patient/segment-templates/_child_review/exercise/NEAT/edit-review.php

@@ -0,0 +1,118 @@
+<?php
+$currentValue = '';
+$previousValue = '';
+$previousChildReview = null;
+if (@$point) {
+    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 moe wide class="d-inline">
+    <a start show href="#" class="px-1 text-center d-block" title="<?= !empty($currentValue) ? 'Edit Subjective' : 'Add Subjective'?>">
+        <i class="fa <?= !empty($currentValue) ? 'fa-pencil-alt' : 'fa-plus-square'?>"></i>
+    </a>
+    <?php if($point): ?>
+        <form url="/api/visitPoint/upsertChildReview" class="mcp-theme-1 w-100 frm-upsert-review-plan-nutrition" 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 === '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; ?>
+
+            <p class="mb-2"><b>Current Daily Calories</b></p>
+
+            <div class="mb-2">
+                <div note-rte
+                     <?= $segment->segmentTemplate->internal_name === 'intake_problems' ? 'use-shortcuts="hpi,user"' : '' ?>
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="value"><?= $currentValue ?></div>
+            </div>
+            <div>
+                <button type="submit"  class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    <?php else: ?>
+        <form url="/api/visitPoint/addTopLevel" class="mcp-theme-1 frm-add-review-plan-nutrition w-100" left>
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="category" value="<?= $p['category'] ?>">
+            <input type="hidden" name="additionReasonCategory" value="ON_INTAKE">
+            <input type="hidden" name="data">
+
+            <?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; ?>
+
+            <p class="mb-2"><b>Current Daily Calories</b></p>
+
+            <div class="mb-2">
+                <div note-rte
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="reviewValue"><?= $currentValue ?></div>
+            </div>
+            <div>
+                <button type="submit" class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    <?php endif; ?>
+</div>
+<?php if(!empty($currentValue)): ?>
+    <div visit-moe relative class="d-inline">
+        <a start show href="#" class="px-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; ?>
+

+ 32 - 0
resources/views/app/patient/segment-templates/_child_review/exercise/NEAT/last-review.php

@@ -0,0 +1,32 @@
+<div class="mb-1 font-weight-bold text-secondary">Current Daily Calories</div>
+<?php if ($point->lastChildReview): ?>
+    <?php $parsedReview = json_decode($point->lastChildReview->data); ?>
+    <div class="<?= $point->last_child_review_point_scoped_note_id === $note->id ? 'bg-warning-mellow p-2 rounded' : '' ?>">
+        <div class="inline-html-container"><?= @$parsedReview->value ?></div>
+
+        <?php if ($point->last_child_review_point_scoped_note_id === $patient->core_note_id): ?>
+            <span class="text-sm">(updated on the patient's chart)</span>
+        <?php else: ?>
+            <?php if ($point->last_child_review_point_scoped_note_id === $note->id): ?>
+                <span class="text-sm">(updated on this note)</span>
+            <?php else: ?>
+                <div class="d-inline position-relative on-click-menu">
+                    <span class="text-sm text-primary c-pointer">
+                        <?= relative_friendly_date($point->last_child_review_effective_date) ?>
+                        <?php if($point->lastChildReview->creatorPro): ?>
+                        by <?= $point->lastChildReview->creatorPro->displayName() ?>
+                        <?php endif; ?>
+                    </span>
+                    <div menu right class="bg-white border">
+                        <a native target="_blank"
+                           href="<?= route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $point->lastChildReviewNote]) ?>"
+                           class="px-2 py-1 d-block text-nowrap text-sm">Go to note</a>
+                    </div>
+                </div>
+            <?php endif; ?>
+        <?php endif; ?>
+
+    </div>
+<?php else: ?>
+    <span class="text-secondary text-sm">None</span>
+<?php endif; ?>

+ 118 - 0
resources/views/app/patient/segment-templates/_child_review/exercise/STRENGTH_TRAINING/edit-review.php

@@ -0,0 +1,118 @@
+<?php
+$currentValue = '';
+$previousValue = '';
+$previousChildReview = null;
+if (@$point) {
+    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 moe wide class="d-inline">
+    <a start show href="#" class="px-1 text-center d-block" title="<?= !empty($currentValue) ? 'Edit Subjective' : 'Add Subjective'?>">
+        <i class="fa <?= !empty($currentValue) ? 'fa-pencil-alt' : 'fa-plus-square'?>"></i>
+    </a>
+    <?php if($point): ?>
+        <form url="/api/visitPoint/upsertChildReview" class="mcp-theme-1 w-100 frm-upsert-review-plan-nutrition" 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 === '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; ?>
+
+            <p class="mb-2"><b>Current Daily Calories</b></p>
+
+            <div class="mb-2">
+                <div note-rte
+                     <?= $segment->segmentTemplate->internal_name === 'intake_problems' ? 'use-shortcuts="hpi,user"' : '' ?>
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="value"><?= $currentValue ?></div>
+            </div>
+            <div>
+                <button type="submit"  class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    <?php else: ?>
+        <form url="/api/visitPoint/addTopLevel" class="mcp-theme-1 frm-add-review-plan-nutrition w-100" left>
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="category" value="<?= $p['category'] ?>">
+            <input type="hidden" name="additionReasonCategory" value="ON_INTAKE">
+            <input type="hidden" name="data">
+
+            <?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; ?>
+
+            <p class="mb-2"><b>Current Daily Calories</b></p>
+
+            <div class="mb-2">
+                <div note-rte
+                     class="form-group mb-2 border-left border-right rte-holder"
+                     data-field-name="reviewValue"><?= $currentValue ?></div>
+            </div>
+            <div>
+                <button type="submit" class="btn btn-sm btn-primary mr-2">Save</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    <?php endif; ?>
+</div>
+<?php if(!empty($currentValue)): ?>
+    <div visit-moe relative class="d-inline">
+        <a start show href="#" class="px-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; ?>
+

+ 32 - 0
resources/views/app/patient/segment-templates/_child_review/exercise/STRENGTH_TRAINING/last-review.php

@@ -0,0 +1,32 @@
+<div class="mb-1 font-weight-bold text-secondary">Current Daily Calories</div>
+<?php if ($point->lastChildReview): ?>
+    <?php $parsedReview = json_decode($point->lastChildReview->data); ?>
+    <div class="<?= $point->last_child_review_point_scoped_note_id === $note->id ? 'bg-warning-mellow p-2 rounded' : '' ?>">
+        <div class="inline-html-container"><?= @$parsedReview->value ?></div>
+
+        <?php if ($point->last_child_review_point_scoped_note_id === $patient->core_note_id): ?>
+            <span class="text-sm">(updated on the patient's chart)</span>
+        <?php else: ?>
+            <?php if ($point->last_child_review_point_scoped_note_id === $note->id): ?>
+                <span class="text-sm">(updated on this note)</span>
+            <?php else: ?>
+                <div class="d-inline position-relative on-click-menu">
+                    <span class="text-sm text-primary c-pointer">
+                        <?= relative_friendly_date($point->last_child_review_effective_date) ?>
+                        <?php if($point->lastChildReview->creatorPro): ?>
+                        by <?= $point->lastChildReview->creatorPro->displayName() ?>
+                        <?php endif; ?>
+                    </span>
+                    <div menu right class="bg-white border">
+                        <a native target="_blank"
+                           href="<?= route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $point->lastChildReviewNote]) ?>"
+                           class="px-2 py-1 d-block text-nowrap text-sm">Go to note</a>
+                    </div>
+                </div>
+            <?php endif; ?>
+        <?php endif; ?>
+
+    </div>
+<?php else: ?>
+    <span class="text-secondary text-sm">None</span>
+<?php endif; ?>

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

@@ -0,0 +1,4 @@
+<?php
+$category = 'ROS';
+$endPoint = 'upsertNoteSingleton';
+include resource_path('views/app/patient/segment-templates/_simple_text_segment/edit.php');

+ 3 - 0
resources/views/app/patient/segment-templates/intake_exercise/summary.blade.php

@@ -0,0 +1,3 @@
+<?php
+$category = 'ROS';
+include resource_path('views/app/patient/segment-templates/_simple_text_segment/summary.php');

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

@@ -0,0 +1,4 @@
+<?php
+$category = 'ROS';
+$endPoint = 'upsertNoteSingleton';
+include resource_path('views/app/patient/segment-templates/_simple_text_segment/edit.php');

+ 3 - 0
resources/views/app/patient/segment-templates/plan_exercise/summary.blade.php

@@ -0,0 +1,3 @@
+<?php
+$category = 'ROS';
+include resource_path('views/app/patient/segment-templates/_simple_text_segment/summary.php');

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

@@ -568,6 +568,96 @@ parentSegment.find('.frm-upsert-review-plan-{{$label}}')
         return false;
     });
 
+/* exercise specific */
+parentSegment.find('.frm-review-plan-exercise [data-name="active"]')
+    .off('change')
+    .on('change', function () {
+        let form = $(this).closest('form');
+        form.find('[if-active]')[this.checked ? 'removeClass' : 'addClass']('d-none');
+        return false;
+    })
+    .trigger('change');
+parentSegment.find('.frm-review-plan-exercise [data-name="walk->active"]')
+    .off('change')
+    .on('change', function () {
+        let form = $(this).closest('form');
+        form.find('[if-walk-active]')[this.checked ? 'removeClass' : 'addClass']('d-none');
+        return false;
+    })
+    .trigger('change');
+parentSegment.find('.frm-review-plan-exercise [data-name="jog->active"]')
+    .off('change')
+    .on('change', function () {
+        let form = $(this).closest('form');
+        form.find('[if-jog-active]')[this.checked ? 'removeClass' : 'addClass']('d-none');
+        return false;
+    })
+    .trigger('change');
+parentSegment.find('.frm-review-plan-exercise [data-name="elliptical->active"]')
+    .off('change')
+    .on('change', function () {
+        let form = $(this).closest('form');
+        form.find('[if-elliptical-active]')[this.checked ? 'removeClass' : 'addClass']('d-none');
+        return false;
+    })
+    .trigger('change');
+parentSegment.find('.frm-review-plan-exercise [data-name="swim->active"]')
+    .off('change')
+    .on('change', function () {
+        let form = $(this).closest('form');
+        form.find('[if-swim-active]')[this.checked ? 'removeClass' : 'addClass']('d-none');
+        return false;
+    })
+    .trigger('change');
+parentSegment.find('.frm-review-plan-exercise [data-name="bike->active"]')
+    .off('change')
+    .on('change', function () {
+        let form = $(this).closest('form');
+        form.find('[if-bike-active]')[this.checked ? 'removeClass' : 'addClass']('d-none');
+        return false;
+    })
+    .trigger('change');
+parentSegment.find('.frm-review-plan-exercise .btn-toggle-activity[data-type]')
+    .off('click')
+    .on('click', function () {
+        let form = $(this).closest('form'),
+            checkbox = form.find('[data-name="' + $(this).attr('data-type') + '->active"]'),
+            current = checkbox.prop('checked');
+        if(!current) {
+            checkbox.prop('checked', true).trigger('change');
+            $(this).removeClass('btn-default border').addClass('btn-info');
+            $(this).closest('td').find('img').removeClass('opacity-35');
+        }
+        else {
+            checkbox.prop('checked', false).trigger('change');
+            $(this).removeClass('btn-info').addClass('btn-default border');
+            $(this).closest('td').find('img').addClass('opacity-35');
+        }
+        return false;
+    });
+parentSegment.find('.frm-review-plan-exercise')
+    .off('submit')
+    .on('submit', function () {
+        let form = $(this);
+        if (!form[0].checkValidity()) {
+            form[0].reportValidity();
+            return false;
+        }
+        fillJsonDataField(form, form.find('[name="childReviewData"]').length ? 'childReviewData' : 'data');
+        showMask();
+        $.post(form.attr('url'), form.serialize(), _data => {
+            if(!hasResponseError(_data)) {
+                $('.visit-segment[data-segment-template-name="intake_{{$segment_part}}"]').find('.refresh-segment').trigger('click');
+                $('.visit-segment[data-segment-template-name="plan_{{$segment_part}}"]').find('.refresh-segment').trigger('click');
+                refreshDynamicStagPopup();
+            }
+        }).then(() => {
+            hideMask();
+        });
+        return false;
+    });
+/* end of exercise specific */
+
 parentSegment.find('.toggle-relevance')
     .off('click.toggle-relevance')
     .on('click.toggle-relevance', function () {

+ 1 - 0
routes/web.php

@@ -474,6 +474,7 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('/messages-thread/{patient}', 'PatientController@messagesThread')->name('messages-thread');
 
     Route::get('/nutrition-center/{patient}/{note}', 'NoteController@nutritionCenter')->name('nutrition-center');
+    Route::get('/exercise-center/{patient}/{note}', 'NoteController@exerciseCenter')->name('exercise-center');
 
     Route::get('/problems-quick-add/{patient}/{note}', 'NoteController@problemsQuickAdd')->name('problems-quick-add');