Bläddra i källkod

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

= 3 år sedan
förälder
incheckning
6cabc982d2
100 ändrade filer med 11818 tillägg och 1532 borttagningar
  1. 9 0
      app/Http/Controllers/McpController.php
  2. 9 0
      app/Http/Controllers/NoteController.php
  3. 44 14
      app/Http/Controllers/PracticeManagementController.php
  4. 6 2
      app/Models/Client.php
  5. 20 0
      app/Models/Point.php
  6. 6 0
      app/Models/Pro.php
  7. 1 1
      config/app.php
  8. 22 4
      public/css/style.css
  9. 44 0
      resources/views/app/dashboard-mcp.blade.php
  10. 37 37
      resources/views/app/mcp/dashboard/calls_memos.blade.php
  11. 4 18
      resources/views/app/mcp/dashboard/messages.blade.php
  12. 8 6
      resources/views/app/mcp/dashboard/notifications.blade.php
  13. 78 0
      resources/views/app/mcp/unsigned_incoming_reports.blade.php
  14. 53 52
      resources/views/app/patient/allergies-center.blade.php
  15. 106 102
      resources/views/app/patient/careteam-center.blade.php
  16. 47 46
      resources/views/app/patient/goals-center.blade.php
  17. 4 4
      resources/views/app/patient/handouts-list.blade.php
  18. 2 245
      resources/views/app/patient/incoming-reports.blade.php
  19. 54 56
      resources/views/app/patient/medications-center.blade.php
  20. 18 19
      resources/views/app/patient/module-specific-summary-renderers/allergy/plan.blade.php
  21. 1 1
      resources/views/app/patient/module-specific-summary-renderers/behavior/plan.blade.php
  22. 1 17
      resources/views/app/patient/module-specific-summary-renderers/behavior/subjective.blade.php
  23. 18 19
      resources/views/app/patient/module-specific-summary-renderers/care_team_member/plan.blade.php
  24. 16 0
      resources/views/app/patient/module-specific-summary-renderers/data-dump.blade.php
  25. 1 1
      resources/views/app/patient/module-specific-summary-renderers/exercise/plan.blade.php
  26. 1 17
      resources/views/app/patient/module-specific-summary-renderers/exercise/subjective.blade.php
  27. 18 19
      resources/views/app/patient/module-specific-summary-renderers/goal/plan.blade.php
  28. 23 0
      resources/views/app/patient/module-specific-summary-renderers/lifestyle_general/subjective.blade.php
  29. 23 0
      resources/views/app/patient/module-specific-summary-renderers/lifestyle_nutrition/subjective.blade.php
  30. 23 0
      resources/views/app/patient/module-specific-summary-renderers/lifestyle_physical_activity/subjective.blade.php
  31. 23 0
      resources/views/app/patient/module-specific-summary-renderers/lifestyle_sleep/subjective.blade.php
  32. 23 0
      resources/views/app/patient/module-specific-summary-renderers/lifestyle_social_relationships/subjective.blade.php
  33. 23 0
      resources/views/app/patient/module-specific-summary-renderers/lifestyle_stress/subjective.blade.php
  34. 23 0
      resources/views/app/patient/module-specific-summary-renderers/lifestyle_substance_use/subjective.blade.php
  35. 18 19
      resources/views/app/patient/module-specific-summary-renderers/medication/plan.blade.php
  36. 1 1
      resources/views/app/patient/module-specific-summary-renderers/nutrition/plan.blade.php
  37. 1 17
      resources/views/app/patient/module-specific-summary-renderers/nutrition/subjective.blade.php
  38. 18 19
      resources/views/app/patient/module-specific-summary-renderers/problem/plan.blade.php
  39. 7 0
      resources/views/app/patient/modules/_undo_changes.blade.php
  40. 459 0
      resources/views/app/patient/modules/lifestyle_general/edit.blade.php
  41. 272 0
      resources/views/app/patient/modules/lifestyle_general/summary.blade.php
  42. 1315 0
      resources/views/app/patient/modules/lifestyle_nutrition/edit.blade.php
  43. 1228 0
      resources/views/app/patient/modules/lifestyle_nutrition/summary.blade.php
  44. 427 0
      resources/views/app/patient/modules/lifestyle_physical_activity/edit.blade.php
  45. 455 0
      resources/views/app/patient/modules/lifestyle_physical_activity/summary.blade.php
  46. 823 0
      resources/views/app/patient/modules/lifestyle_sleep/edit.blade.php
  47. 534 0
      resources/views/app/patient/modules/lifestyle_sleep/summary.blade.php
  48. 307 0
      resources/views/app/patient/modules/lifestyle_social/edit.blade.php
  49. 167 0
      resources/views/app/patient/modules/lifestyle_social/summary.blade.php
  50. 712 0
      resources/views/app/patient/modules/lifestyle_stress/edit.blade.php
  51. 642 0
      resources/views/app/patient/modules/lifestyle_stress/summary.blade.php
  52. 981 0
      resources/views/app/patient/modules/lifestyle_substances/edit.blade.php
  53. 803 0
      resources/views/app/patient/modules/lifestyle_substances/summary.blade.php
  54. 5 5
      resources/views/app/patient/note/dashboard-bu-b4-pure-soap.blade.php
  55. 71 55
      resources/views/app/patient/note/dashboard.blade.php
  56. 4 4
      resources/views/app/patient/note/dashboard_script-bu-b4-oure-soap.blade.php
  57. 4 4
      resources/views/app/patient/note/dashboard_script-bu-b4-pure-soap.blade.php
  58. 5 4
      resources/views/app/patient/note/dashboard_script.blade.php
  59. 1 0
      resources/views/app/patient/note/lhs-tree.blade.php
  60. 1 1
      resources/views/app/patient/note/note-segment-list-slim.blade.php
  61. 54 9
      resources/views/app/patient/note/rhs-sidebar.blade.php
  62. 6 2
      resources/views/app/patient/note/segment-slim.blade.php
  63. 261 0
      resources/views/app/patient/partials/incoming-reports.blade.php
  64. 1 1
      resources/views/app/patient/point-based-partials/rx.blade.php
  65. 35 36
      resources/views/app/patient/prescriptions/list.blade.php
  66. 68 66
      resources/views/app/patient/problems-center.blade.php
  67. 3 3
      resources/views/app/patient/segment-templates/_child_review/delete-review.php
  68. 2 2
      resources/views/app/patient/segment-templates/_child_review/edit-review-in-place.php
  69. 2 2
      resources/views/app/patient/segment-templates/_child_review/edit-review.php
  70. 3 3
      resources/views/app/patient/segment-templates/_child_review/nutrition/DAILY_INTAKE_CALORIES/edit-review.php
  71. 3 3
      resources/views/app/patient/segment-templates/_child_review/nutrition/DAILY_INTAKE_CARBOHYDRATES/edit-review.php
  72. 3 3
      resources/views/app/patient/segment-templates/_child_review/nutrition/FAST_FOOD/edit-review.php
  73. 3 3
      resources/views/app/patient/segment-templates/_child_review/nutrition/HIGH_SUGAR_BEVERAGES/edit-review.php
  74. 3 3
      resources/views/app/patient/segment-templates/_child_review/nutrition/PORTION_SIZES/edit-review.php
  75. 3 3
      resources/views/app/patient/segment-templates/_child_review/nutrition/SNACKS/edit-review.php
  76. 3 3
      resources/views/app/patient/segment-templates/_child_review/nutrition/VEGETABLES/edit-review.php
  77. 3 3
      resources/views/app/patient/segment-templates/_child_review/nutrition/WATER_INTAKE/edit-review.php
  78. 12 1
      resources/views/app/patient/segment-templates/informed_consent/edit.blade.php
  79. 12 1
      resources/views/app/patient/segment-templates/informed_consent/summary.blade.php
  80. 6 7
      resources/views/app/patient/segment-templates/omega_allergies/summary.blade.php
  81. 2 2
      resources/views/app/patient/segment-templates/omega_assessment_system/summary.blade.php
  82. 14 16
      resources/views/app/patient/segment-templates/omega_care_team/summary.blade.php
  83. 14 16
      resources/views/app/patient/segment-templates/omega_goals/summary.blade.php
  84. 2 2
      resources/views/app/patient/segment-templates/omega_history_family/summary.blade.php
  85. 14 4
      resources/views/app/patient/segment-templates/omega_informed_consent/edit.blade.php
  86. 19 7
      resources/views/app/patient/segment-templates/omega_informed_consent/summary.blade.php
  87. 15 17
      resources/views/app/patient/segment-templates/omega_medications/summary.blade.php
  88. 15 0
      resources/views/app/patient/segment-templates/omega_objective_system/edit.blade.php
  89. 23 25
      resources/views/app/patient/segment-templates/omega_problems/summary.blade.php
  90. 3 3
      resources/views/app/patient/segment-templates/omega_ros/summary.blade.php
  91. 11 2
      resources/views/app/patient/segment-templates/omega_subjective_system/summary.blade.php
  92. 1 1
      resources/views/app/patient/segment-templates/omega_vitals/edit.blade.php
  93. 146 153
      resources/views/app/patient/vitals-settings/bp-management-form.blade.php
  94. 314 0
      resources/views/app/patient/vitals-settings/bp-management-form_depricated.blade.php
  95. 157 209
      resources/views/app/patient/vitals-settings/bp-management-summary.blade.php
  96. 226 0
      resources/views/app/patient/vitals-settings/bp-management-summary_depricated.blade.php
  97. 5 5
      resources/views/app/patient/wizard-partials/show-review.blade.php
  98. 3 3
      resources/views/app/patient/wizard-partials/state-icon.blade.php
  99. 141 0
      resources/views/app/practice-management/remote-monitoring-admin-row-markup.blade.php
  100. 157 104
      resources/views/app/practice-management/remote-monitoring-admin.blade.php

+ 9 - 0
app/Http/Controllers/McpController.php

@@ -424,6 +424,15 @@ class McpController extends Controller
         ];
         return view('app.mcp.supply_orders_awaiting_shipment', $data);
     }
+    public function unsigned_incoming_reports(Request $request){
+        $data = [
+            'records' => IncomingReport::where('hcp_pro_id', $this->performer->pro->id)
+                ->whereRaw('(has_hcp_pro_signed IS NULL OR has_hcp_pro_signed = FALSE)')
+                ->orderBy('created_at', 'desc')
+                ->get()
+        ];
+        return view('app.mcp.unsigned_incoming_reports', $data);
+    }
     public function measurements_pending_stamping(Request $request){
         $data = [
             'records' => CareMonth::where('mcp_pro_id', $this->performer->pro->id)

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

@@ -373,6 +373,15 @@ class NoteController extends Controller
         ]);
     }
 
+    public function moduleView(Request $request, Note $note, $segmentInternalName, $view) {
+        return view("app.patient.modules.{$segmentInternalName}.{$view}", [
+            'patient' => $note->client,
+            'note' => $note,
+            'segment' => $note->coreSegment,
+            'segmentInternalName' => $segmentInternalName
+        ]);
+    }
+
     public function rhsSidebar(Request $request, Client $patient, Note $note) {
         return view('app.patient.note.rhs-sidebar', compact('patient', 'note'));
     }

+ 44 - 14
app/Http/Controllers/PracticeManagementController.php

@@ -1258,33 +1258,52 @@ WHERE
 
     public function remoteMonitoringAdmin(Request $request) {
 
+        $performer = $this->performer();
+
+        // abort_if($performer->pro->pro_type !== 'ADMIN' && !$performer->pro->can_view_rm_matrix, 403);
+
         $ym = ($request->input('y') ?: 'Y') . '-' . ($request->input('m') ?: 'm');
         $careMonthStart = date($ym . '-01');
 
         $rc = $request->input('rc') ?: 1;
         $rc2 = $request->input('rc2') ?: 2;
 
-        $conditions = $this->rpmConditionsAdmin($this->performer(), $rc, $rc2);
+        $conditions = [];// $this->rpmConditions($performer, $rc, $rc2);
 
-        $patients = DB::select(
-            DB::raw(
-                "
-SELECT client.name_first, 
-       client.name_last, 
+        $sortBy = $request->input('sort_by') ?: 'name_first';
+        $sortDir = $request->input('sort_dir') ?: 'ASC';
+        $orderBy = "ORDER BY $sortBy $sortDir NULLS LAST";
+
+        $query = "
+SELECT client.name_first, client.name_last,
+       (client.name_first || ' ' || client.name_last) as client_name,
+       (mcp_pro.name_first || ' ' || mcp_pro.name_last) as mcp_pro_name,
+       (rmm_pro.name_first || ' ' || rmm_pro.name_last) as rmm_pro_name,
        client.uid as client_uid, 
        client.dob,
        client.is_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
+       client.most_recent_completed_mcp_note_id,
+       mrmnote.effective_dateest::date as most_recent_completed_mcp_note_date_cm,
+       mrmnote.id as most_recent_completed_mcp_note_id_cm,
+       mrmnote.uid as most_recent_completed_mcp_note_uid_cm,
+       client.cell_number,
+       client.is_assigned_cellular_bp_device,
+       client.is_assigned_cellular_weight_scale_device,
        care_month.uid as care_month_uid,
        care_month.id as care_month_id,
        care_month.start_date,
        care_month.rm_total_time_in_seconds_by_mcp,
+       care_month.rm_total_time_in_seconds_by_rmm_pro,
        care_month.number_of_days_with_remote_measurements,
-       care_month.has_anyone_interacted_with_client_about_rm_outside_note,
+       care_month.has_anyone_interacted_with_client_about_rm,
+       care_month.has_mcp_interacted_with_client_about_rm,
        care_month.rm_num_measurements_not_stamped_by_mcp,
        care_month.rm_num_measurements_not_stamped_by_non_hcp,
        care_month.rm_num_measurements_not_stamped_by_rmm,
        care_month.rm_num_measurements_not_stamped_by_rme,
+       care_month.mcp_pro_id as care_month_mcp_pro_id,
+       care_month.rmm_pro_id as care_month_rmm_pro_id,
        client.mcp_pro_id,
        client.default_na_pro_id,
        client.rmm_pro_id,
@@ -1295,16 +1314,27 @@ SELECT client.name_first,
        client.most_recent_cellular_bp_measurement_at,      
        client.most_recent_cellular_weight_value,
        client.most_recent_cellular_weight_measurement_at
-FROM care_month join client on care_month.client_id = client.id
+FROM care_month join client on care_month.client_id = client.id join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
+     left join note mrmnote on mrmnote.id = (
+        select max(n.id) from note n 
+        where 
+              n.client_id = client.id AND 
+              n.is_cancelled = FALSE AND
+              (n.is_signed_by_hcp IS NOT NULL AND n.is_signed_by_hcp = TRUE) AND
+              n.effective_dateest::date >= care_month.start_date::date AND 
+              n.effective_dateest::date < (care_month.start_date::date + INTERVAL '1 month')
+     )
+    left join pro mcp_pro on care_month.mcp_pro_id = mcp_pro.id
+    left join pro rmm_pro on care_month.rmm_pro_id = rmm_pro.id
 WHERE
-      client.shadow_pro_id is null AND client.is_enrolled_in_rm = 'YES'
-      AND EXTRACT(MONTH from care_month.start_date) = " . ($request->input('m') ?: 'EXTRACT(MONTH from now())') . "
+      EXTRACT(MONTH from care_month.start_date) = " . ($request->input('m') ?: 'EXTRACT(MONTH from now())') . "
       AND EXTRACT(YEAR from care_month.start_date) = " . ($request->input('y') ?: 'EXTRACT(YEAR from now())') . "
       " . (count($conditions) > 0 ? 'AND ' . implode(" AND ", $conditions) : '') . "
-ORDER BY care_month.number_of_days_with_remote_measurements DESC NULLS LAST, client.name_first, client.name_last
-"
-            )
-        );
+      $orderBy
+      LIMIT 20
+";
+
+        $patients = DB::select($query);
 
         $timestamp = strtotime(date('Y-m-d'));
         $daysRemaining = (int)date('t', $timestamp) - (int)date('j', $timestamp);

+ 6 - 2
app/Models/Client.php

@@ -193,9 +193,13 @@ class Client extends Model
             ->orderBy('created_at', 'asc');
     }
 
-    public function handouts()
+    public function handouts($note = null)
     {
-        $mappings = HandoutClient::where('client_id', $this->id)->get();
+        $mappings = HandoutClient::where('client_id', $this->id);
+        if($note) {
+            $mappings = $mappings->where('note_id', $note->id);
+        }
+        $mappings = $mappings->get();
         $handouts = new Collection();
         foreach ($mappings as $mapping) {
             $handout = Handout::where('id', $mapping->handout_id)->first();

+ 20 - 0
app/Models/Point.php

@@ -179,6 +179,26 @@ class Point extends Model
         return $points;
     }
 
+    public static function getIntakePointsWithChildReview(Client $_patient, Note $_note, $_assoc = false) {
+        $points = Point
+            ::where('client_id', $_patient->id)
+            ->where('is_removed_due_to_entry_error', false)
+            ->whereRaw("(is_removed = TRUE OR addition_reason_category != 'DURING_VISIT' OR added_in_note_id != {$_note->id})")
+            ->where(function ($query1) use ($_note) {
+                $query1
+                    ->where('last_child_review_point_scoped_note_id', $_note->id)
+                    ->orWhereRaw("(SELECT count(id) from note_point WHERE is_active IS TRUE AND note_id = {$_note->id} AND point_id = point.id) > 0");
+            })
+            ->orderBy('created_at')
+            ->get();
+        foreach ($points as $point) {
+            if ($point->data) {
+                $point->data = json_decode($point->data, $_assoc);
+            }
+        }
+        return $points;
+    }
+
     public static function getPlanPointsOfCategory(Client $_patient, String $_category, Note $_note, $_assoc = false) {
         $points = Point
             ::where('client_id', $_patient->id)

+ 6 - 0
app/Models/Pro.php

@@ -623,6 +623,12 @@ WHERE mcp_pro_id = :pro_id
             ->count();
     }
 
+    function get_unsigned_incoming_reports_count_as_mcp() {
+        return IncomingReport::where('hcp_pro_id', $this->id)
+            ->whereRaw('(has_hcp_pro_signed IS NULL OR has_hcp_pro_signed = FALSE)')
+            ->count();
+    }
+
     function get_birthdays_today_as_mcp(){
         return;
         $queryClients = $this->performer()->pro->getAccessibleClientsQuery();

+ 1 - 1
config/app.php

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

+ 22 - 4
public/css/style.css

@@ -346,6 +346,10 @@ body>nav.navbar {
 .mcp-theme-1 .rotateh {
     transform: rotateY(180deg);
 }
+.mcp-theme-1 .icon-16 {
+    width: 16px !important;
+    height: 16px !important;
+}
 .mcp-theme-1 .width-200px {
     width: 200px !important;
 }
@@ -2222,7 +2226,7 @@ body.in-iframe .main-row > .sidebar {
 }
 .note-container .note-lhs-tree.fixed ~ .note-rhs-content {
     margin-left: 220px;
-    margin-right: 180px;
+    margin-right: 220px;
 }
 .note-container .note-lhs-tree.fixed-left ~ .note-rhs-content {
     margin-left: 220px;
@@ -2299,8 +2303,8 @@ body.in-iframe .main-row > .sidebar {
 }
 
 .note-container .note-rhs-sidebar {
-    min-width: 180px;
-    max-width: 180px;
+    min-width: 220px;
+    max-width: 220px;
     align-self: stretch;
     border-right: 1px solid #ddd;
     border-left: 1px solid #ddd;
@@ -2321,7 +2325,7 @@ body.in-iframe .main-row > .sidebar {
     z-index: 1;
 }
 .note-container .note-rhs-sidebar.fixed ~ .note-rhs-content {
-    margin-right: 180px;
+    margin-right: 220px;
 }
 .spot-highlight {
     background: aliceblue !important;
@@ -3148,4 +3152,18 @@ body.forced-masking #mask {
 .mcp-theme-1 input[type="checkbox"][toggle][disabled] {
     opacity: 0.5;
     cursor: not-allowed;
+}
+.inline-input-underlined {
+    border: none;
+    border-bottom: 1px solid #ced4da;
+    padding: 0;
+    text-align: center;
+    font-weight: bold;
+}
+.inline-input-underlined:focus {
+    outline: none;
+    box-shadow: none;
+}
+.inline-input-underlined.width-50 {
+    width: 50px;
 }

+ 44 - 0
resources/views/app/dashboard-mcp.blade.php

@@ -223,6 +223,18 @@
                                         </a>
                                     </th>
                                 </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_unsigned_incoming_reports_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.unsigned_incoming_reports') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Unsigned Incoming Reports">
+                                            Unsigned Incoming Reports
+                                        </a>
+                                    </th>
+                                </tr>
                                 </tbody>
                             </table>
                         </div>
@@ -572,6 +584,38 @@
                 addMCHook('refreshDashboardAppointments', function() {
                     onDateChange(selectedDate);
                 });
+
+                $('form[discardable]')
+                    .off('submit.discardable')
+                    .on('submit.discardable', function() {
+                        let form = $(this),
+                            submitButton = form.find('[submit]'),
+                            spinner = form.find('.spinner');
+                        submitButton.hide();
+                        if(!spinner.length) {
+                            spinner = $('<img/>').addClass('spinner icon-16').attr('src', '/vanillaspin.gif').insertAfter(submitButton);
+                        }
+                        else {
+                            spinner.show();
+                        }
+                        $.post(form.attr('url'), form.serialize(), _data => {
+                            if(!hasResponseError(_data)) {
+                                let container = form.closest('[discardable-container]');
+                                if(!container.siblings('[discardable-container]').length) {
+                                    container.remove();
+                                    fastReload();
+                                }
+                                else {
+                                    container.remove();
+                                }
+                            }
+                            else {
+                                spinner.hide();
+                                submitButton.show();
+                            }
+                        }, 'json');
+                        return false;
+                    });
             }
 
             addMCInitializer('pro-dashboard', init, '#pro-dashboard-container');

+ 37 - 37
resources/views/app/mcp/dashboard/calls_memos.blade.php

@@ -2,42 +2,42 @@
 @if(!$mcpClientMemos || !count($mcpClientMemos))
 <div class="px-2 py-3">No memos</div>
 @else
-<table class="table table-sm table-striped m-0">
-	<tbody>
-		@foreach($mcpClientMemos as $memo)
-		<tr>
-			<td class="px-1">
-				<a href="{{route('patients.view.dashboard', $memo->client_uid)}}">
-					{{$memo->name_first}} {{$memo->name_last}}
-				</a>
-				<a class="text-sm text-nowrap d-block"
-				   href="/memos-thread/{{$memo->client_uid}}"
-				   native target="_blank"
-				   open-in-stag-popup
-				   popup-style="tall"
-				   title="Memos for {{$memo->name_first}} {{$memo->name_last}}">
-					{{friendlier_date_time($memo->created_at)}}
-				</a>
-			</td>
-			<td class="px-1 w-75 text-left">
-				{{$memo->content}}
-			</td>
-			<td class="width-70px px-2 text-right">
-				<div moe relative class="ml-auto">
-					<form show url="/api/clientMemo/stamp" target="#mcp-phone-calls-memos">
-						<input type="hidden" name="uid" value="{{$memo->uid}}">
-						<button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
-					</form>
-				</div>
-			</td>
-		</tr>
-		@endforeach
-	</tbody>
-</table>
-@if($mcpClientMemosCount > 10)
-	<div class="p-2 border-top bg-light text-center">
-		Showing 1 to 10 of {{$mcpClientMemosCount}} unstamped memos
-	</div>
-@endif
+	<table class="table table-sm table-striped m-0">
+		<tbody>
+			@foreach($mcpClientMemos as $memo)
+			<tr discardable-container>
+				<td class="px-1">
+					<a href="{{route('patients.view.dashboard', $memo->client_uid)}}">
+						{{$memo->name_first}} {{$memo->name_last}}
+					</a>
+					<a class="text-sm text-nowrap d-block"
+					   href="/memos-thread/{{$memo->client_uid}}"
+					   native target="_blank"
+					   open-in-stag-popup
+					   popup-style="tall"
+					   title="Memos for {{$memo->name_first}} {{$memo->name_last}}">
+						{{friendlier_date_time($memo->created_at)}}
+					</a>
+				</td>
+				<td class="px-1 w-75 text-left">
+					{{$memo->content}}
+				</td>
+				<td class="width-70px px-2 text-right">
+					<div class="ml-auto">
+						<form url="/api/clientMemo/stamp" target="#mcp-phone-calls-memos" discardable>
+							<input type="hidden" name="uid" value="{{$memo->uid}}">
+							<button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
+						</form>
+					</div>
+				</td>
+			</tr>
+			@endforeach
+		</tbody>
+	</table>
+	@if($mcpClientMemosCount > 10)
+		<div class="p-2 border-top bg-light text-center">
+			Showing 1 to 10 of {{$mcpClientMemosCount}} unstamped memos
+		</div>
+	@endif
 @endif
 </div>

+ 4 - 18
resources/views/app/mcp/dashboard/messages.blade.php

@@ -4,7 +4,7 @@
     <table class="table table-sm m-0">
         <tbody>
         @foreach($incomingSmsMessagesPendingReply as $msg)
-            <tr>
+            <tr discardable-container>
                 <td class="px-1">
                     <a href="{{route('patients.view.sms', $msg->client_uid)}}">
                         {{$msg->client_name_first}} {{$msg->client_name_last}}
@@ -23,20 +23,11 @@
                 </td>
                 <td class="width-70px px-2 text-right">
                     @if($msg->is_reply_needed == 'YES')
-                        <div moe relative>
-                            <a start show class="">Ack.</a>
-                            <form url="/api/clientSms/updateIsReplyNeeded" class="mcp-theme-1" right>
+                        <div>
+                            <form url="/api/clientSms/updateIsReplyNeeded" class="mcp-theme-1" discardable>
                                 <input type="hidden" name="uid" value="{{ $msg->uid }}">
                                 <input type="hidden" name="isReplyNeeded" value="NO">
-                                <div class="mb-2">
-                                    <label for="" class="text-sm text-secondary mb-1">Are you sure?</label>
-
-                                </div>
-
-                                <div class="d-flex align-items-center">
-                                    <button class="btn btn-sm btn-primary mr-2" submit>Send</button>
-                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                </div>
+                                <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
                             </form>
                         </div>
                     @endif
@@ -45,9 +36,4 @@
         @endforeach
         </tbody>
     </table>
-    @if(count($incomingSmsMessagesPendingReply) > 10)
-        <div class="p-2 border-top bg-light text-center">
-            Showing 1 to 10 of {{count($incomingSmsMessagesPendingReply)}} unstamped memos
-        </div>
-    @endif
 @endif

+ 8 - 6
resources/views/app/mcp/dashboard/notifications.blade.php

@@ -1,3 +1,4 @@
+<div id="mcp-dashboard-notifications">
 <?php
     
     $apptsPending = [
@@ -13,7 +14,7 @@
 @if(count($apptsPending['status']))
     <b class="text-secondary my-2 d-block">Appointment Status Changes</b>
     @foreach($apptsPending['status'] as $appt)
-        <div class="d-flex mb-1 border-bottom border-light">
+        <div class="d-flex mb-1 border-bottom border-light" discardable-container>
             <div class="flex-grow-1 d-inline-flex align-items-baseline">
                 <div>
                     <a class="d-block" href="/patients/view/{{$appt->client->uid}}"><b>{{$appt->client->displayName()}}</b></a>
@@ -26,8 +27,8 @@
                     @endif
                 </div>
             </div>
-            <div moe relative class="">
-                <form show url="/api/appointment/acknowledgeStatusAsAppointmentPro">
+            <div class="">
+                <form url="/api/appointment/acknowledgeStatusAsAppointmentPro" discardable>
                     <input type="hidden" name="uid" value="{{$appt->uid}}">
                     <input type="hidden" name="currentStatus" value="{{$appt->status}}">
                     @if($appt->status_memo !== null)
@@ -46,7 +47,7 @@
 @if(count($apptsPending['decision']))
     <b class="text-secondary my-2 d-block">Appointment Confirmation Changes</b>
     @foreach($apptsPending['decision'] as $appt)
-        <div class="d-flex mb-1 border-bottom border-light">
+        <div class="d-flex mb-1 border-bottom border-light" discardable-container>
             <div class="flex-grow-1 d-inline-flex align-items-baseline">
                 <div>
                     <a class="d-block" href="/patients/view/{{$appt->client->uid}}"><b>{{$appt->client->displayName()}}</b></a>
@@ -54,8 +55,8 @@
                 </div>
                 <span class="ml-auto mr-3 font-weight-bold text-secondary">{{$appt->latestConfirmationDecision->decision_enum}}</span>
             </div>
-            <div moe relative class="">
-                <form show url="/api/appointment/acknowledgeDecisionAsAppointmentPro">
+            <div class="">
+                <form url="/api/appointment/acknowledgeDecisionAsAppointmentPro" discardable>
                     <input type="hidden" name="uid" value="{{$appt->uid}}">
                     <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
                 </form>
@@ -75,3 +76,4 @@
         </div>
     @endforeach
 @endif--}}
+</div>

+ 78 - 0
resources/views/app/mcp/unsigned_incoming_reports.blade.php

@@ -0,0 +1,78 @@
+<div class="p-3 mcp-theme-1">
+    <div class="card">
+
+        <div class="card-header px-2 py-1 hide-inside-popup border-bottom-0">
+            <strong class="mr-4">
+                <i class="fas fa-box"></i>
+                Unsigned Incoming Reports
+            </strong>
+        </div>
+
+        <div class="card-body p-0 border-top-0 pb-0">
+
+            <table class="table table-sm table-striped mb-0">
+                <thead class="bg-light">
+                <tr>
+                    <th class="border-0 text-secondary">Created</th>
+                    <th class="border-0 text-secondary">Patient</th>
+                    <th class="border-0 text-secondary">Title</th>
+                    <th class="border-0 text-secondary">Report Date</th>
+                    <th class="border-0 text-secondary">Sign</th>
+                    <th class="border-0 text-secondary">Category</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($records as $document)
+                    <tr class="{{$document->is_entry_error ? 'entry-error' : ''}} {{@$currentReport->uid === $document->uid ? 'bg-aliceblue' : ''}}">
+                        <td>
+                            {{ friendly_date_time($document->created_at, false) }}
+                            @if(request()->input('noteUid') && $document->note && $document->note->uid === request()->input('noteUid'))
+                                <div class="mt-1 text-info text-sm">Created on this note</div>
+                            @endif
+                        </td>
+                        <td>
+                            <a href="{{route('patients.view.dashboard', ['patient' => $document->client])}}">
+                                {{$document->client->displayName()}}
+                            </a>
+                        </td>
+                        <td>
+                            <a open-in-stag-popup
+                               popup-style="stag-popup-md overflow-visible"
+                               mc-initer="incoming-reports"
+                               title="Incoming Report: {{ $document->title ? $document->title : '(not set)' }}"
+                               href="{{route('patients.view.incoming-reports', ['patient' => $document->client, 'currentReport' => $document])}}?noteUid={{request()->input('noteUid') ?: ''}}&documentViewFromNote=1"
+                               class="{{@$currentReport->uid === $document->uid ? 'font-weight-bold' : ''}}">
+                                {{ $document->title ? $document->title : '(not set)' }}
+                            </a>
+                        </td>
+                        <td>{{ friendly_date_time($document->report_date, false) }}</td>
+                        <td>
+                            @if(!$document->has_hcp_pro_signed)
+                                -
+                            @else
+                                <div class="text-success mb-1">
+                                    <i class="fa fa-check"></i>
+                                    Signed
+                                </div>
+                                @if($document->hcp)
+                                    <div class="text-secondary">
+                                        <div class="text-sm font-weight-bold">{{$document->hcp->displayName()}}</div>
+                                        <div class="text-sm">{{friendlier_date_time($document->hcp_pro_signed_at)}}</div>
+                                    </div>
+                                @endif
+                            @endif
+                        </td>
+                        <td>{{ $document->category }}{{ $document->subcategory ? ' / ' . $document->subcategory : '' }}</td>
+                    </tr>
+                @endforeach
+                @if(!count($records))
+                    <tr>
+                        <td colspan="6">No records found.</td>
+                    </tr>
+                @endif
+                </tbody>
+            </table>
+
+        </div>
+    </div>
+</div>

+ 53 - 52
resources/views/app/patient/allergies-center.blade.php

@@ -60,7 +60,6 @@ if(!@$summaryView) {
                     <th class="border-bottom-0 text-secondary text-center width-30px">Rel.</th>
                 @endif
                 <th class="border-bottom-0 text-secondary">Name</th>
-                @if(!@$summaryView) <th class="border-bottom-0 text-secondary width-50px">Edit</th> @endif
                 <th class="border-bottom-0 text-secondary w-30">Subjective</th>
                 <th class="border-bottom-0 text-secondary w-30">Plan</th>
                 @if(!@$summaryView) <th class="border-bottom-0 text-secondary width-30px"></th> @endif
@@ -86,10 +85,61 @@ if(!@$summaryView) {
                     @include('app.patient.wizard-partials.relevance-column', ['point' => $point])
                 @endif
                 <td>
-                    <div class="d-flex align-items-baseline">
+                    <div class="d-flex align-items-start">
                         @include('app.patient.wizard-partials.state-icon', ['point' => $allergy])
                         <div>
-                            <b><?= !!@($allergy->data->name) ? @($allergy->data->name) : '-' ?></b>
+                            @if(!@$summaryView)
+                                <div>
+                                    <div moe huge relative>
+                                        <a start show href="#" title="Edit"><?= !!@($allergy->data->name) ? @($allergy->data->name) : '-' ?></a>
+                                        <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-allergy">
+                                            <input type="hidden" name="uid" value="<?= $allergy->uid ?>">
+                                            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+                                            <p class="mb-2"><b>Update Allergy</b></p>
+
+                                            <input type="hidden" name="data" value='{{json_encode($allergy->data)}}'>
+
+                                            @if($allergy->added_in_note_id === $note->id)
+
+                                                <input type="hidden" data-name="damConceptId" value="{{@$allergy->data->damConceptId}}">
+                                                <input type="hidden" data-name="damConceptIdType" value="{{@$allergy->data->damConceptIdType}}">
+
+                                                <div class="mb-2">
+                                                    <label class="text-sm mb-0 font-weight-bold">Name</label>
+                                                    <input type="text" data-name="name" class="form-control form-control-sm"
+                                                           value="{{@$allergy->data->name}}"
+                                                           stag-suggest
+                                                           stag-suggest-ep="/fdb-allergy-suggest/json">
+                                                </div>
+
+                                            @else
+
+                                                <div class="mb-2 bg-light p-2 border">
+                                                    <p class="mb-1 font-weight-bold">
+                                                        {{ @$allergy->data->name }}
+                                                    </p>
+                                                    @if($patient->core_note_id !== $note->id)
+                                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the allergy was added prior to this visit.</div>
+                                                    @else
+                                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the allergy was added on a previous visit.</div>
+                                                    @endif
+                                                </div>
+
+                                            @endif
+
+                                            @include('app.patient.wizard-partials.common-fields', ['label' => 'allergy', 'point' => $allergy, 'addVerbPT' => 'Diagnosed', 'apTerm' => 'assessment/plan'])
+
+                                            <div class="mt-3 pt-2 d-flex align-items-center border-top">
+                                                <button type="submit" class="btn-save-allergy btn btn-sm btn-primary mr-2">Save</button>
+                                                <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                </div>
+                            @else
+                                <?= !!@($allergy->data->name) ? @($allergy->data->name) : '-' ?>
+                            @endif
+
                             @include('app.patient.wizard-partials.state-badge', ['point' => $allergy, 'addedVerb' => 'Diagnosed'])
                         </div>
                         @if(!@$summaryView)
@@ -117,55 +167,6 @@ if(!@$summaryView) {
                         @endif
                     </div>
                 </td>
-                @if(!@$summaryView)
-                <td>
-                    <div moe huge relative>
-                        <a start show href="#" title="Edit">Edit</a>
-                        <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-allergy">
-                            <input type="hidden" name="uid" value="<?= $allergy->uid ?>">
-                            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
-                            <p class="mb-2"><b>Update Allergy</b></p>
-
-                            <input type="hidden" name="data" value='{{json_encode($allergy->data)}}'>
-
-                            @if($allergy->added_in_note_id === $note->id)
-
-                                <input type="hidden" data-name="damConceptId" value="{{@$allergy->data->damConceptId}}">
-                                <input type="hidden" data-name="damConceptIdType" value="{{@$allergy->data->damConceptIdType}}">
-
-                                <div class="mb-2">
-                                    <label class="text-sm mb-0 font-weight-bold">Name</label>
-                                    <input type="text" data-name="name" class="form-control form-control-sm"
-                                           value="{{@$allergy->data->name}}"
-                                           stag-suggest
-                                           stag-suggest-ep="/fdb-allergy-suggest/json">
-                                </div>
-
-                            @else
-
-                                <div class="mb-2 bg-light p-2 border">
-                                    <p class="mb-1 font-weight-bold">
-                                        {{ @$allergy->data->name }}
-                                    </p>
-                                    @if($patient->core_note_id !== $note->id)
-                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the allergy was added prior to this visit.</div>
-                                    @else
-                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the allergy was added on a previous visit.</div>
-                                    @endif
-                                </div>
-
-                            @endif
-
-                            @include('app.patient.wizard-partials.common-fields', ['label' => 'allergy', 'point' => $allergy, 'addVerbPT' => 'Diagnosed', 'apTerm' => 'assessment/plan'])
-
-                            <div class="mt-3 pt-2 d-flex align-items-center border-top">
-                                <button type="submit" class="btn-save-allergy btn btn-sm btn-primary mr-2">Save</button>
-                                <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
-                            </div>
-                        </form>
-                    </div>
-                </td>
-                @endif
                 <td>
                     <?php
                     $segment = $note->getSegmentByInternalName('intake_allergies');

+ 106 - 102
resources/views/app/patient/careteam-center.blade.php

@@ -22,7 +22,6 @@ list($careTeamMembers, $counts) = Point::getPointsOfCategoryExtended($patient, '
                     <th class="border-bottom-0 text-secondary text-center width-30px">Rel.</th>
                 @endif
                 <th class="border-bottom-0 text-secondary">Name/Details</th>
-                @if(!@$summaryView) <th class="border-bottom-0 text-secondary width-50px">Edit</th> @endif
                 <th class="border-bottom-0 text-secondary w-30">Subjective</th>
                 <th class="border-bottom-0 text-secondary w-30">Plan</th>
                 <th class="border-bottom-0 text-secondary">Contact</th>
@@ -46,115 +45,120 @@ list($careTeamMembers, $counts) = Point::getPointsOfCategoryExtended($patient, '
                     @include('app.patient.wizard-partials.relevance-column', ['point' => $point])
                 @endif
                 <td>
-                    <div class="d-flex align-items-baseline">
+                    <div class="d-flex align-items-start">
                         @include('app.patient.wizard-partials.state-icon', ['point' => $careTeamMember])
                         <div>
-                            <b class="text-nowrap"><?= !!@($careTeamMember->data->name) ? @($careTeamMember->data->name) : '-' ?></b>
-                            <?= !!@($careTeamMember->data->specialty) ? '<br>' . @($careTeamMember->data->specialty) : '' ?>
-                            <?= !!@($careTeamMember->data->organization) ? '<br>' . @($careTeamMember->data->organization) : '' ?>
-                            @include('app.patient.wizard-partials.state-badge', ['point' => $careTeamMember])
-                        </div>
-                    </div>
-                </td>
-                @if(!@$summaryView)
-                <td>
-                    <div moe huge relative>
-                        <a start show href="#" title="Edit">Edit</a>
-                        <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-care-team-member">
-                            <input type="hidden" name="uid" value="<?= $careTeamMember->uid ?>">
-                            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
-                            <p class="mb-2"><b>Update Care Team Member</b></p>
-
-                            <input type="hidden" name="data" value='{{json_encode($careTeamMember->data)}}'>
-
-                            @if($careTeamMember->added_in_note_id === $note->id)
-
-                                <div class="row mb-2">
-                                    <div class="col-6 pr-0">
-                                        <label class="text-sm mb-1 font-weight-bold">Name</label>
-                                        <input type="text" class="form-control form-control-sm min-width-unset"
-                                               data-name="name"
-                                               value="{{@$careTeamMember->data->name}}">
-                                    </div>
-                                    <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-name="specialty"
-                                               data-option-list="specialty"
-                                               value="{{@$careTeamMember->data->specialty}}">
-                                        <div class="data-option-list">
-                                            <div>Allergy and immunology</div>
-                                            <div>Anesthesiology</div>
-                                            <div>Dermatology</div>
-                                            <div>Diagnostic radiology</div>
-                                            <div>Emergency medicine</div>
-                                            <div>Family medicine</div>
-                                            <div>Internal medicine</div>
-                                            <div>Medical genetics</div>
-                                            <div>Neurology</div>
-                                            <div>Nuclear medicine</div>
-                                            <div>Obstetrics and gynecology</div>
-                                            <div>Ophthalmology</div>
-                                            <div>Pathology</div>
-                                            <div>Pediatrics</div>
-                                            <div>Physical medicine and rehabilitation</div>
-                                            <div>Preventive medicine</div>
-                                            <div>Psychiatry</div>
-                                            <div>Radiation oncology</div>
-                                            <div>Surgery</div>
-                                            <div>Urology</div>
-                                        </div>
-                                    </div>
-                                </div>
-
-                                <div class="row mb-2">
-                                    <div class="col-6 pr-0">
-                                        <label class="text-sm mb-1 font-weight-bold">Organization</label>
-                                        <input type="text" class="form-control form-control-sm min-width-unset"
-                                               data-name="organization"
-                                               value="{{@$careTeamMember->data->organization}}">
-                                    </div>
-                                    <div class="col-3 pr-0">
-                                        <label class="text-sm mb-1 font-weight-bold">Phone</label>
-                                        <input type="text" class="form-control form-control-sm min-width-unset"
-                                               data-name="phone"
-                                               value="{{@$careTeamMember->data->phone}}">
-                                    </div>
-                                    <div class="col-3">
-                                        <label class="text-sm mb-1 font-weight-bold">Fax</label>
-                                        <input type="text" class="form-control form-control-sm min-width-unset"
-                                               data-name="fax"
-                                               value="{{@$careTeamMember->data->fax}}">
+                            @if(!@$summaryView)
+                                <div>
+                                    <div moe huge relative>
+                                        <a start show href="#" title="Edit">
+                                            <?= !!@($careTeamMember->data->name) ? @($careTeamMember->data->name) : '-' ?>
+                                            <?= !!@($careTeamMember->data->specialty) ? '<br>' . @($careTeamMember->data->specialty) : '' ?>
+                                            <?= !!@($careTeamMember->data->organization) ? '<br>' . @($careTeamMember->data->organization) : '' ?>
+                                        </a>
+                                        <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-care-team-member">
+                                            <input type="hidden" name="uid" value="<?= $careTeamMember->uid ?>">
+                                            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+                                            <p class="mb-2"><b>Update Care Team Member</b></p>
+
+                                            <input type="hidden" name="data" value='{{json_encode($careTeamMember->data)}}'>
+
+                                            @if($careTeamMember->added_in_note_id === $note->id)
+
+                                                <div class="row mb-2">
+                                                    <div class="col-6 pr-0">
+                                                        <label class="text-sm mb-1 font-weight-bold">Name</label>
+                                                        <input type="text" class="form-control form-control-sm min-width-unset"
+                                                               data-name="name"
+                                                               value="{{@$careTeamMember->data->name}}">
+                                                    </div>
+                                                    <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-name="specialty"
+                                                               data-option-list="specialty"
+                                                               value="{{@$careTeamMember->data->specialty}}">
+                                                        <div class="data-option-list">
+                                                            <div>Allergy and immunology</div>
+                                                            <div>Anesthesiology</div>
+                                                            <div>Dermatology</div>
+                                                            <div>Diagnostic radiology</div>
+                                                            <div>Emergency medicine</div>
+                                                            <div>Family medicine</div>
+                                                            <div>Internal medicine</div>
+                                                            <div>Medical genetics</div>
+                                                            <div>Neurology</div>
+                                                            <div>Nuclear medicine</div>
+                                                            <div>Obstetrics and gynecology</div>
+                                                            <div>Ophthalmology</div>
+                                                            <div>Pathology</div>
+                                                            <div>Pediatrics</div>
+                                                            <div>Physical medicine and rehabilitation</div>
+                                                            <div>Preventive medicine</div>
+                                                            <div>Psychiatry</div>
+                                                            <div>Radiation oncology</div>
+                                                            <div>Surgery</div>
+                                                            <div>Urology</div>
+                                                        </div>
+                                                    </div>
+                                                </div>
+
+                                                <div class="row mb-2">
+                                                    <div class="col-6 pr-0">
+                                                        <label class="text-sm mb-1 font-weight-bold">Organization</label>
+                                                        <input type="text" class="form-control form-control-sm min-width-unset"
+                                                               data-name="organization"
+                                                               value="{{@$careTeamMember->data->organization}}">
+                                                    </div>
+                                                    <div class="col-3 pr-0">
+                                                        <label class="text-sm mb-1 font-weight-bold">Phone</label>
+                                                        <input type="text" class="form-control form-control-sm min-width-unset"
+                                                               data-name="phone"
+                                                               value="{{@$careTeamMember->data->phone}}">
+                                                    </div>
+                                                    <div class="col-3">
+                                                        <label class="text-sm mb-1 font-weight-bold">Fax</label>
+                                                        <input type="text" class="form-control form-control-sm min-width-unset"
+                                                               data-name="fax"
+                                                               value="{{@$careTeamMember->data->fax}}">
+                                                    </div>
+                                                </div>
+
+                                            @else
+
+                                                <div class="mb-2 bg-light p-2 border">
+                                                    <p class="mb-1 font-weight-bold">
+                                                        {{ @$careTeamMember->data->name }}
+                                                        {{ @$careTeamMember->data->specialty }}
+                                                        {{ @$careTeamMember->data->organization }}
+                                                    </p>
+                                                    @if($patient->core_note_id !== $note->id)
+                                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the care team member was added prior to this visit.</div>
+                                                    @else
+                                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the care team member was added on a previous visit.</div>
+                                                    @endif
+                                                </div>
+
+                                            @endif
+
+                                            @include('app.patient.wizard-partials.common-fields', ['label' => 'care-team-member', 'point' => $careTeamMember])
+
+                                            <div class="mt-3 pt-2 d-flex align-items-center border-top">
+                                                <button type="submit" class="btn-save-care-team-member btn btn-sm btn-primary mr-2">Save</button>
+                                                <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
+                                            </div>
+                                        </form>
                                     </div>
                                 </div>
-
                             @else
-
-                                <div class="mb-2 bg-light p-2 border">
-                                    <p class="mb-1 font-weight-bold">
-                                        {{ @$careTeamMember->data->name }}
-                                        {{ @$careTeamMember->data->specialty }}
-                                        {{ @$careTeamMember->data->organization }}
-                                    </p>
-                                    @if($patient->core_note_id !== $note->id)
-                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the care team member was added prior to this visit.</div>
-                                    @else
-                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the care team member was added on a previous visit.</div>
-                                    @endif
-                                </div>
-
+                                <?= !!@($careTeamMember->data->name) ? @($careTeamMember->data->name) : '-' ?>
+                                <?= !!@($careTeamMember->data->specialty) ? '<br>' . @($careTeamMember->data->specialty) : '' ?>
+                                <?= !!@($careTeamMember->data->organization) ? '<br>' . @($careTeamMember->data->organization) : '' ?>
                             @endif
-
-                            @include('app.patient.wizard-partials.common-fields', ['label' => 'care-team-member', 'point' => $careTeamMember])
-
-                            <div class="mt-3 pt-2 d-flex align-items-center border-top">
-                                <button type="submit" class="btn-save-care-team-member btn btn-sm btn-primary mr-2">Save</button>
-                                <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
-                            </div>
-                        </form>
+                            @include('app.patient.wizard-partials.state-badge', ['point' => $careTeamMember])
+                        </div>
                     </div>
                 </td>
-                @endif
                 <td>
                     <?php
                     $segment = $note->getSegmentByInternalName('intake_care_team');

+ 47 - 46
resources/views/app/patient/goals-center.blade.php

@@ -22,7 +22,6 @@ list($goals, $counts) = Point::getPointsOfCategoryExtended($patient, 'GOAL', $no
                     <th class="border-bottom-0 text-secondary text-center width-30px">Rel.</th>
                 @endif
                 <th class="border-bottom-0 text-secondary">Goal</th>
-                @if(!@$summaryView) <th class="border-bottom-0 text-secondary width-50px">Edit</th> @endif
                 <th class="border-bottom-0 text-secondary w-30">Subjective</th>
                 <th class="border-bottom-0 text-secondary w-30">Plan</th>
                 @if(!@$summaryView) <th class="border-bottom-0 text-secondary width-30px"></th> @endif
@@ -45,59 +44,61 @@ list($goals, $counts) = Point::getPointsOfCategoryExtended($patient, 'GOAL', $no
                     @include('app.patient.wizard-partials.relevance-column', ['point' => $point])
                 @endif
                 <td>
-                    <div class="d-flex align-items-baseline">
+                    <div class="d-flex align-items-start">
                         @include('app.patient.wizard-partials.state-icon', ['point' => $goal])
                         <div>
-                            <b><?= !!@($goal->data->goal) ? @($goal->data->goal) : '-' ?></b>
-                            @include('app.patient.wizard-partials.state-badge', ['point' => $goal, 'addedVerb' => 'Prescribed'])
-                        </div>
-                    </div>
-                </td>
-                @if(!@$summaryView)
-                <td>
-                    <div moe huge relative>
-                        <a start show href="#" title="Edit">Edit</a>
-                        <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-goal">
-                            <input type="hidden" name="uid" value="<?= $goal->uid ?>">
-                            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
-                            <p class="mb-2"><b>Update Goal</b></p>
-
-                            <input type="hidden" name="data" value='{{json_encode($goal->data)}}'>
-
-                            @if($goal->added_in_note_id === $note->id)
-
-                                <div class="mb-2">
-                                    <label class="text-sm mb-1 font-weight-bold">Goal</label>
-                                    <input type="text" class="form-control form-control-sm min-width-unset"
-                                           data-name="goal"
-                                           value="{{@$goal->data->goal}}">
+                            @if(!@$summaryView)
+                            <div>
+                                <div moe huge relative>
+                                    <a start show href="#" title="Edit"><?= !!@($goal->data->goal) ? @($goal->data->goal) : '-' ?></a>
+                                    <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-goal">
+                                        <input type="hidden" name="uid" value="<?= $goal->uid ?>">
+                                        <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+                                        <p class="mb-2"><b>Update Goal</b></p>
+
+                                        <input type="hidden" name="data" value='{{json_encode($goal->data)}}'>
+
+                                        @if($goal->added_in_note_id === $note->id)
+
+                                            <div class="mb-2">
+                                                <label class="text-sm mb-1 font-weight-bold">Goal</label>
+                                                <input type="text" class="form-control form-control-sm min-width-unset"
+                                                       data-name="goal"
+                                                       value="{{@$goal->data->goal}}">
+                                            </div>
+
+                                        @else
+
+                                            <div class="mb-2 bg-light p-2 border">
+                                                <p class="mb-1 font-weight-bold">
+                                                    {{ @$goal->data->goal }}
+                                                </p>
+                                                @if($patient->core_note_id !== $note->id)
+                                                    <div class="text-secondary text-sm">Clinical details cannot be modified since the goal was added prior to this visit.</div>
+                                                @else
+                                                    <div class="text-secondary text-sm">Clinical details cannot be modified since the goal was added on a previous visit.</div>
+                                                @endif
+                                            </div>
+
+                                        @endif
+
+                                        @include('app.patient.wizard-partials.common-fields', ['label' => 'goal', 'point' => $goal])
+
+                                        <div class="mt-3 pt-2 d-flex align-items-center border-top">
+                                            <button type="submit" class="btn-save-goal btn btn-sm btn-primary mr-2">Save</button>
+                                            <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
+                                        </div>
+                                    </form>
                                 </div>
-
+                            </div>
                             @else
-
-                                <div class="mb-2 bg-light p-2 border">
-                                    <p class="mb-1 font-weight-bold">
-                                        {{ @$goal->data->goal }}
-                                    </p>
-                                    @if($patient->core_note_id !== $note->id)
-                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the goal was added prior to this visit.</div>
-                                    @else
-                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the goal was added on a previous visit.</div>
-                                    @endif
-                                </div>
-
+                                <?= !!@($goal->data->goal) ? @($goal->data->goal) : '-' ?>
                             @endif
 
-                            @include('app.patient.wizard-partials.common-fields', ['label' => 'goal', 'point' => $goal])
-
-                            <div class="mt-3 pt-2 d-flex align-items-center border-top">
-                                <button type="submit" class="btn-save-goal btn btn-sm btn-primary mr-2">Save</button>
-                                <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
-                            </div>
-                        </form>
+                            @include('app.patient.wizard-partials.state-badge', ['point' => $goal, 'addedVerb' => 'Prescribed'])
+                        </div>
                     </div>
                 </td>
-                @endif
                 <td>
                     <?php
                     $segment = $note->getSegmentByInternalName('intake_goals');

+ 4 - 4
resources/views/app/patient/handouts-list.blade.php

@@ -6,8 +6,8 @@
             <a start show class="">Add</a>
             <form url="/api/handoutClient/create">
                 <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
-                @if(request()->input('noteUid'))
-                    <input type="hidden" name="noteUid" value="{{ request()->input('noteUid') }}">
+                @if(@$note)
+                    <input type="hidden" name="noteUid" value="{{ $note->uid }}">
                 @endif
                 <div class="mb-2">
                     <select name="handoutUid" class="form-control form-control-sm">
@@ -37,7 +37,7 @@
         </tr>
         </thead>
         <tbody>
-        @foreach($patient->handouts() as $handout)
+        @foreach($patient->handouts($note) as $handout)
             <?php $downloadLink = env('APP_URL') . "/guest/handout/{$handout->handout_client_uid}"; ?>
             <tr>
                 <td>{{$handout->internal_name}}</td>
@@ -47,7 +47,7 @@
                         <i class="fa fa-eye mr-2"></i>View
                     </a>
                 </td>
-                <td><b>{{ $downloadLink }}</b></td>
+                <td><b class="click-to-copy">{{ $downloadLink }}</b></td>
                 <td>
                     <div moe="" relative="">
                         <a start="" show="" href="#">SMS Link</a>

+ 2 - 245
resources/views/app/patient/incoming-reports.blade.php

@@ -1,247 +1,4 @@
-@extends ('layouts.patient')
+@extends(request()->input('popupmode') ? 'layouts.popup' : 'layouts.patient')
 @section('inner-content')
-    <div id="incoming-reports">
-        <div class="d-flex align-items-center pb-2">
-            <h4 class="font-weight-bold m-0">Incoming Reports</h4>
-            <span class="mx-2 text-secondary">|</span>
-            <div moe>
-                <a start show class="">Upload</a>
-                <form url="/api/incomingReport/create"
-                      method="post"
-                      enctype="multipart/form-data">
-                    <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
-                    @if(request()->input('noteUid'))
-                        <input type="hidden" name="noteUid" value="{{ request()->input('noteUid') }}">
-                    @endif
-                    <div class="mb-2">
-                        <label for="" class="text-sm text-secondary mb-1">Category</label>
-                        <input type="text" class="form-control form-control-sm" name="category"
-                               value="" placeholder="Category">
-                    </div>
-                    <div class="mb-2">
-                        <label for="" class="text-sm text-secondary mb-1">Sub-category</label>
-                        <input type="text" class="form-control form-control-sm" name="subcategory"
-                               value="" placeholder="Sub-category">
-                    </div>
-                    <div class="mb-2">
-                        <label for="" class="text-sm text-secondary mb-1">Report Date</label>
-                        <input type="text" class="form-control form-control-sm stag-dp" name="reportDate"
-                               value="" placeholder="Report Date">
-                    </div>
-                    <div class="mb-2">
-                        <label for="" class="text-sm text-secondary mb-1">Title *</label>
-                        <input type="text" class="form-control form-control-sm" name="title"
-                               value="" placeholder="Title" required>
-                    </div>
-                    <div class="mb-2">
-                        <label for="" class="text-sm text-secondary mb-1">File *</label>
-                        <input type="file" class="form-control form-control-sm" name="pdf"
-                               value="" placeholder="File" required>
-                    </div>
-                    <div class="mb-2">
-                        <label for="" class="text-sm text-secondary mb-1">Ordering Pro</label>
-                        <select name="hcpProUid" provider-search data-pro-uid="{{$pro->uid}}" data-pro-name="{{$pro->displayName()}}"
-                                class="form-control form-control-sm">
-                        </select>
-                    </div>
-                    <div class="mb-2">
-                        <label for="" class="text-sm text-secondary mb-1">Memo</label>
-                        <input type="text" class="form-control form-control-sm" name="memo"
-                               value="" placeholder="Memo">
-                    </div>
-                    <div class="d-flex align-items-center">
-                        <button class="btn btn-sm btn-primary mr-2" type="button" submit>Save</button>
-                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                    </div>
-                </form>
-            </div>
-        </div>
-        <div class="d-flex align-items-start h-100">
-            <div class="flex-grow-1">
-                <table class="table table-striped table-sm table-bordered mb-0">
-                    <thead class="bg-light">
-                    <tr>
-                        <th class="border-0 text-secondary">Created</th>
-                        <th class="border-0 text-secondary">Pro</th>
-                        <th class="border-0 text-secondary">Title</th>
-                        <th class="border-0 text-secondary">Report Date</th>
-                        <th class="border-0 text-secondary">Sign</th>
-                        <th class="border-0 text-secondary">Category</th>
-                    </tr>
-                    </thead>
-                    <tbody>
-                    @foreach($patient->incomingReports as $document)
-                        <tr class="{{$document->is_entry_error ? 'entry-error' : ''}} {{@$currentReport->uid === $document->uid ? 'bg-aliceblue' : ''}}">
-                            <td>
-                                {{ friendly_date_time($document->created_at, false) }}
-                                @if(request()->input('noteUid') && $document->note && $document->note->uid === request()->input('noteUid'))
-                                    <div class="mt-1 text-info text-sm">Created on this note</div>
-                                @endif
-                            </td>
-                            <td>
-                                {{$document->hcp ? $document->hcp->displayName() : '-'}}
-                            </td>
-                            <td>
-                                <a mc-initer="incoming-reports"
-                                   href="{{route('patients.view.incoming-reports', ['patient' => $patient, 'currentReport' => $document])}}{{request()->input('noteUid') ? '?noteUid=' . request()->input('noteUid') : ''}}"
-                                   class="{{@$currentReport->uid === $document->uid ? 'font-weight-bold' : ''}}">
-                                    {{ $document->title ? $document->title : '(not set)' }}
-                                </a>
-                            </td>
-                            <td>{{ friendly_date_time($document->report_date, false) }}</td>
-                            <td>
-                                @if(!$document->has_hcp_pro_signed)
-                                    -
-                                @else
-                                    <div class="text-success mb-1">
-                                        <i class="fa fa-check"></i>
-                                        Signed
-                                    </div>
-                                    @if($document->hcp)
-                                        <div class="text-secondary">
-                                            <div class="text-sm font-weight-bold">{{$document->hcp->displayName()}}</div>
-                                            <div class="text-sm">{{friendlier_date_time($document->hcp_pro_signed_at)}}</div>
-                                        </div>
-                                    @endif
-                                @endif
-                            </td>
-                            <td>{{ $document->category }}{{ $document->subcategory ? ' / ' . $document->subcategory : '' }}</td>
-                        </tr>
-                    @endforeach
-                    @if(!count($patient->incomingReports))
-                        <tr>
-                            <td colspan="6">No records found.</td>
-                        </tr>
-                    @endif
-                    </tbody>
-                </table>
-            </div>
-            @if(@$currentReport)
-                <div class="min-width-700px max-width-700px ml-2 border align-self-stretch p-3">
-                    <div class="d-flex align-items-center">
-                        <h3 class="font-size-16 m-0 flex-grow-1 text-ellipsis">{{$currentReport->title ? $currentReport->title : '(not set)'}}</h3>
-                        <div class="d-inline-flex align-items-center ml-auto flex-nowrap mr-2 border-right">
-                            <a class="on-hover-opaque mr-2 pr-1 d-inline-block" native target="_blank"
-                               href="/api/incomingReport/download/{{ $currentReport->uid }}"
-                               title="Download"><i class="fa fa-download"></i></a>
-                            @if(!$currentReport->has_hcp_pro_signed && $currentReport->hcp_pro_id === $pro->id)
-                                <div moe relative class="mr-2 pr-1">
-                                    <a href="#" start show class="" title="Sign"><i class="fa fa-signature text-success"></i></a>
-                                    <form url="/api/incomingReport/signAsHcp" right>
-                                        <input type="hidden" name="uid" value="{{ $currentReport->uid }}">
-                                        <p class="small">Are you sure you want to sign this report as HCP?</p>
-                                        <div class="d-flex align-items-center">
-                                            <button class="btn btn-sm btn-success mr-2" submit>Sign</button>
-                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                        </div>
-                                    </form>
-                                </div>
-                            @endif
-                            @if(!$currentReport->has_hcp_pro_signed)
-                                <div moe relative class="mr-2 pr-1">
-                                    <a href="#" start show class="on-hover-opaque" title="Edit"><i class="fa fa-edit text-primary"></i></a>
-                                    <form url="dummy" action="/api/incomingReport/updateBasic"
-                                          right
-                                          method="post"
-                                          onsubmit="return submitIncomingReport(this)"
-                                          enctype="multipart/form-data">
-                                        <input type="hidden" name="uid" value="{{ $currentReport->uid }}">
-
-                                        <div class="mb-2">
-                                            <label for="" class="text-sm text-secondary mb-1">Category</label>
-                                            <input type="text" class="form-control form-control-sm" name="category"
-                                                   value="{{$currentReport->category}}" placeholder="Category">
-                                        </div>
-                                        <div class="mb-2">
-                                            <label for="" class="text-sm text-secondary mb-1">Sub-category</label>
-                                            <input type="text" class="form-control form-control-sm" name="subcategory"
-                                                   value="{{$currentReport->subcategory}}" placeholder="Sub-category">
-                                        </div>
-                                        <div class="mb-2">
-                                            <label for="" class="text-sm text-secondary mb-1">Report Date</label>
-                                            <input type="date" class="form-control form-control-sm" name="reportDate"
-                                                   value="{{$currentReport->reportDate}}" placeholder="Report Date">
-                                        </div>
-                                        <div class="mb-2">
-                                            <label for="" class="text-sm text-secondary mb-1">Title *</label>
-                                            <input type="text" class="form-control form-control-sm" name="title"
-                                                   value="{{$currentReport->title}}" placeholder="Title" required>
-                                        </div>
-                                        <div class="mb-2">
-                                            <label for="" class="text-sm text-secondary mb-1">File *</label>
-                                            <input type="file" class="form-control form-control-sm" name="pdf"
-                                                   value="" placeholder="File">
-                                            <span class="text-sm text-secondary">Leave blank if not changing</span>
-                                        </div>
-                                        <div class="mb-2">
-                                            <label for="" class="text-sm text-secondary mb-1">HCP Pro</label>
-                                            <select name="hcpProUid" provider-search
-                                                    data-pro-name="{{$currentReport->hcp ? $currentReport->hcp->displayName() : ''}}"
-                                                    class="form-control form-control-sm">
-                                            </select>
-                                        </div>
-                                        <div class="mb-2">
-                                            <label for="" class="text-sm text-secondary mb-1">Memo</label>
-                                            <input type="text" class="form-control form-control-sm" name="memo"
-                                                   value="{{$currentReport->memo}}" placeholder="Memo">
-                                        </div>
-
-                                        <div class="d-flex align-items-center">
-                                            <button class="btn btn-sm btn-primary mr-2" type="submit">Save</button>
-                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                        </div>
-                                    </form>
-                                </div>
-                                @if(!$currentReport->is_entry_error)
-                                    <div moe relative class="mr-2 pr-1">
-                                        <a href="#" start show class="on-hover-opaque" title="Mark as entry-error"><i class="fa fa-ban text-danger"></i></a>
-                                        <form url="/api/incomingReport/setIsEntryErrorToTrue" right>
-                                            <input type="hidden" name="uid" value="{{ $currentReport->uid }}">
-                                            <p class="small">Are you sure you want to set this report as entry error?</p>
-                                            <div class="d-flex align-items-center">
-                                                <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                            </div>
-                                        </form>
-                                    </div>
-                                @else
-                                    <div moe relative class="mr-2">
-                                        <a href="#" start show class="on-hover-opaque" title="Undo mark as entry-error"><i class="fa fa-undo"></i></a>
-                                        <form url="/api/incomingReport/setIsEntryErrorToFalse" right>
-                                            <input type="hidden" name="uid" value="{{ $currentReport->uid }}">
-                                            <p class="small">Are you sure you want to set unset this report as entry error?</p>
-                                            <div class="d-flex align-items-center">
-                                                <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                            </div>
-                                        </form>
-                                    </div>
-                                @endif
-                            @endif
-                        </div>
-                        <a class="ml-auto" mc-initer="incoming-reports" href="{{route('patients.view.incoming-reports', ['patient' => $patient, 'currentReport' => null])}}{{request()->input('noteUid') ? '?noteUid=' . request()->input('noteUid') : ''}}">
-                            <i class="fa fa-times-circle on-hover-opaque"></i>
-                        </a>
-                    </div>
-                    <hr class="mt-3 mb-0 row">
-                    <div class="pdf-viewer-auto row px-3" pdf-url="/api/incomingReport/download/{{ $currentReport->uid }}"></div>
-                </div>
-            @endif
-        </div>
-    </div>
-    @include('app/pdf/viewer')
-    <script>
-        (function() {
-            function init() {
-                $('#incoming-reports').find('input.stag-dp')
-                    .prop('readonly', true)
-                    .addClass('bg-white')
-                    .datepicker({
-                        dateFormat: 'yy-mm-dd'
-                    });
-                runMCInitializer('inline-pdf-viewer');
-            }
-            addMCInitializer('incoming-reports', init, '#incoming-reports')
-        }).call(window);
-    </script>
+    @include('app.patient.partials.incoming-reports')
 @endsection

+ 54 - 56
resources/views/app/patient/medications-center.blade.php

@@ -51,7 +51,6 @@ if(!@$summaryView) {
                     <th class="border-bottom-0 text-secondary text-center width-30px">Rel.</th>
                 @endif
                 <th class="border-bottom-0 text-secondary">Name</th>
-                @if(!@$summaryView) <th class="border-bottom-0 text-secondary width-50px">Edit</th> @endif
                 <th class="border-bottom-0 text-secondary w-30">Subjective</th>
                 <th class="border-bottom-0 text-secondary w-30">Plan</th>
                 @if(!@$summaryView) <th class="border-bottom-0 text-secondary width-30px"></th> @endif
@@ -77,14 +76,65 @@ if(!@$summaryView) {
                         @include('app.patient.wizard-partials.relevance-column', ['point' => $point])
                     @endif
                     <td>
-                        <div class="d-flex align-items-baseline">
+                        <div class="d-flex align-items-start">
                             @include('app.patient.wizard-partials.state-icon', ['point' => $medication])
                             <div>
-                                <b><?= !!@($medication->data->name) ? @($medication->data->name) : '-' ?></b>
+                                @if(!@$summaryView)
+                                    <div moe huge relative>
+                                        <a start show href="#" title="Edit"><?= !!@($medication->data->name) ? @($medication->data->name) : '-' ?></a>
+                                        <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-medication">
+                                            <input type="hidden" name="uid" value="<?= $medication->uid ?>">
+                                            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+                                            <p class="mb-2"><b>Update Medication</b></p>
+
+                                            <input type="hidden" name="data" value='{{json_encode($medication->data)}}'>
+
+                                            @if($medication->added_in_note_id === $note->id)
+
+                                                <input type="hidden" data-name="medId" value="{{@$medication->data->medId}}">
+                                                <input type="hidden" data-name="routedMedId" value="{{@$medication->data->routedMedId}}">
+                                                <input type="hidden" data-name="routedDosageFormMedId" value="{{@$medication->data->routedDosageFormMedId}}">
+                                                <input type="hidden" data-name="gcnSeqno" value="{{@$medication->data->gcnSeqno}}">
+
+                                                <div class="mb-2">
+                                                    <label class="text-sm mb-1 font-weight-bold">Drug</label>
+                                                    <input type="text" class="form-control form-control-sm min-width-unset prescription-medication"
+                                                           data-name="name"
+                                                           value="{{@$medication->data->name}}"
+                                                           stag-suggest
+                                                           stag-suggest-ep="/fdb-med-suggest-v2/json">
+                                                </div>
+
+                                            @else
+
+                                                <div class="mb-2 bg-light p-2 border">
+                                                    <p class="mb-1 font-weight-bold">
+                                                        {{ @$medication->data->name }}
+                                                    </p>
+                                                    @if($patient->core_note_id !== $note->id)
+                                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the medication was added prior to this visit.</div>
+                                                    @else
+                                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the medication was added on a previous visit.</div>
+                                                    @endif
+                                                </div>
+
+                                            @endif
+
+                                            @include('app.patient.wizard-partials.common-fields', ['label' => 'medication', 'point' => $medication, 'addVerbPT' => 'Prescribed'])
+
+                                            <div class="mt-3 pt-2 d-flex align-items-center border-top">
+                                                <button type="submit" class="btn-save-medication btn btn-sm btn-primary mr-2">Save</button>
+                                                <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                @else
+                                    <?= !!@($medication->data->name) ? @($medication->data->name) : '-' ?>
+                                @endif
                                 @include('app.patient.wizard-partials.state-badge', ['point' => $medication, 'addedVerb' => 'Prescribed', 'removedVerb' => 'Discontinued'])
                             </div>
                             @if(!@$summaryView)
-                            <div class="ml-auto mr-1">
+                            <div class="ml-auto pl-1 mr-1">
                                 <div moe>
                                     @if(!$favoriteUid)
                                         <form show url="/api/proFavorite/create">
@@ -109,58 +159,6 @@ if(!@$summaryView) {
                             @endif
                         </div>
                     </td>
-                    @if(!@$summaryView)
-                    <td>
-                        <div moe huge relative>
-                            <a start show href="#" title="Edit">Edit</a>
-                            <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-medication">
-                                <input type="hidden" name="uid" value="<?= $medication->uid ?>">
-                                <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
-                                <p class="mb-2"><b>Update Medication</b></p>
-
-                                <input type="hidden" name="data" value='{{json_encode($medication->data)}}'>
-
-                                @if($medication->added_in_note_id === $note->id)
-
-                                    <input type="hidden" data-name="medId" value="{{@$medication->data->medId}}">
-                                    <input type="hidden" data-name="routedMedId" value="{{@$medication->data->routedMedId}}">
-                                    <input type="hidden" data-name="routedDosageFormMedId" value="{{@$medication->data->routedDosageFormMedId}}">
-                                    <input type="hidden" data-name="gcnSeqno" value="{{@$medication->data->gcnSeqno}}">
-
-                                    <div class="mb-2">
-                                        <label class="text-sm mb-1 font-weight-bold">Drug</label>
-                                        <input type="text" class="form-control form-control-sm min-width-unset prescription-medication"
-                                               data-name="name"
-                                               value="{{@$medication->data->name}}"
-                                               stag-suggest
-                                               stag-suggest-ep="/fdb-med-suggest-v2/json">
-                                    </div>
-
-                                @else
-
-                                    <div class="mb-2 bg-light p-2 border">
-                                        <p class="mb-1 font-weight-bold">
-                                            {{ @$medication->data->name }}
-                                        </p>
-                                        @if($patient->core_note_id !== $note->id)
-                                            <div class="text-secondary text-sm">Clinical details cannot be modified since the medication was added prior to this visit.</div>
-                                        @else
-                                            <div class="text-secondary text-sm">Clinical details cannot be modified since the medication was added on a previous visit.</div>
-                                        @endif
-                                    </div>
-
-                                @endif
-
-                                @include('app.patient.wizard-partials.common-fields', ['label' => 'medication', 'point' => $medication, 'addVerbPT' => 'Prescribed'])
-
-                                <div class="mt-3 pt-2 d-flex align-items-center border-top">
-                                    <button type="submit" class="btn-save-medication btn btn-sm btn-primary mr-2">Save</button>
-                                    <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-                    </td>
-                    @endif
                     <td>
                         <?php
                         $segment = $note->getSegmentByInternalName('intake_medications');

+ 18 - 19
resources/views/app/patient/module-specific-summary-renderers/allergy/plan.blade.php

@@ -5,7 +5,7 @@
            href="/allergies-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="allergies-center-{{$note->id}}"
            title="Allergies Center"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Allergies
         </a>
         <div class="flex-grow-1">
@@ -26,28 +26,27 @@
                         </div>
                     </td>
                     <td class="width-300px">
-                        <div class="pl-3">
+                        <div class="d-flex align-items-baseline pl-2">
                             <?php $plan = $point->childPlanAddedInNote($note); ?>
                             <?php if(!!$plan): ?>
-                                <span>{!! $plan->data->value !!}</span>
+                            <span class="pr-2">{!! $plan->data->value !!}</span>
                             <?php endif; ?>
+                            <span>
+                                <?php if ($point->is_removed): ?>
+                                @if($point->removal_reason_category === 'DURING_VISIT')
+                                    <span class="text-sm text-secondary">Removed during visit</span>
+                                @elseif($point->removal_reason_category === 'ON_INTAKE')
+                                    <span class="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="text-sm text-success">* Diagnosed during visit</span>
+                                <?php else: ?>
+                                <span class="text-sm text-info">* Diagnosed on intake</span>
+                                <?php endif;?>
+                                <?php endif; ?>
+                            </span>
                         </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>
-                            @elseif($point->removal_reason_category === 'ON_INTAKE')
-                                <span class="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="text-sm text-success">* Added during visit</span>
-                            <?php else: ?>
-                            <span class="text-sm text-info">* Added on intake</span>
-                            <?php endif;?>
-                            <?php endif; ?>
-                        </div>
-
                     </td>
                     <td></td>
                 </tr>

+ 1 - 1
resources/views/app/patient/module-specific-summary-renderers/behavior/plan.blade.php

@@ -5,7 +5,7 @@
            href="/behavior-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="behavior-center-{{$note->id}}"
            title="<img src='/img/behavior-rx.png'/> Behavior Rx"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Behavior Rx
         </a>
         <div class="flex-grow-1">

+ 1 - 17
resources/views/app/patient/module-specific-summary-renderers/behavior/subjective.blade.php

@@ -5,7 +5,7 @@
            href="/behavior-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="behavior-center-{{$note->id}}"
            title="<img src='/img/behavior-rx.png'/> Behavior Rx"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Behavior Rx
         </a>
         <div class="flex-grow-1">
@@ -35,22 +35,6 @@
                                 ?>
                             <?php endif; ?>
                         </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>
-                            @elseif($point->removal_reason_category === 'ON_INTAKE')
-                                <span class="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="text-sm text-success">* Added during visit</span>
-                            <?php else: ?>
-                            <span class="text-sm text-info">* Added on intake</span>
-                            <?php endif;?>
-                            <?php endif; ?>
-                        </div>
-
                     </td>
                     <td></td>
                 </tr>

+ 18 - 19
resources/views/app/patient/module-specific-summary-renderers/care_team_member/plan.blade.php

@@ -5,7 +5,7 @@
            href="/careteam-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="careteam-center-{{$note->id}}"
            title="Care Team Center"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Care Team
         </a>
         <div class="flex-grow-1">
@@ -26,28 +26,27 @@
                         </div>
                     </td>
                     <td class="width-300px">
-                        <div class="pl-3">
+                        <div class="d-flex align-items-baseline pl-2">
                             <?php $plan = $point->childPlanAddedInNote($note); ?>
                             <?php if(!!$plan): ?>
-                                <span>{!! $plan->data->value !!}</span>
+                            <span class="pr-2">{!! $plan->data->value !!}</span>
                             <?php endif; ?>
+                            <span>
+                                <?php if ($point->is_removed): ?>
+                                @if($point->removal_reason_category === 'DURING_VISIT')
+                                    <span class="text-sm text-secondary">Removed during visit</span>
+                                @elseif($point->removal_reason_category === 'ON_INTAKE')
+                                    <span class="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="text-sm text-success">* Added during visit</span>
+                                <?php else: ?>
+                                <span class="text-sm text-info">* Added on intake</span>
+                                <?php endif;?>
+                                <?php endif; ?>
+                            </span>
                         </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>
-                            @elseif($point->removal_reason_category === 'ON_INTAKE')
-                                <span class="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="text-sm text-success">* Added during visit</span>
-                            <?php else: ?>
-                            <span class="text-sm text-info">* Added on intake</span>
-                            <?php endif;?>
-                            <?php endif; ?>
-                        </div>
-
                     </td>
                     <td></td>
                 </tr>

+ 16 - 0
resources/views/app/patient/module-specific-summary-renderers/data-dump.blade.php

@@ -0,0 +1,16 @@
+<?php
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $point->lastChildReview->data;
+    foreach ($contentData as $k => $v) {
+        if(!!$v) {
+            ?>
+            <div class="d-flex align-items-baseline">
+                <span class="text-secondary mr-2">{{sanitize_state_name($k)}}:</span>
+                <span>{{is_array($v) ? implode(", ", $v) : $v}}</span>
+            </div>
+            <?php
+        }
+    }
+}
+?>

+ 1 - 1
resources/views/app/patient/module-specific-summary-renderers/exercise/plan.blade.php

@@ -5,7 +5,7 @@
            href="/exercise-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="exercise-center-{{$note->id}}"
            title="<img src='/img/exercise-rx.png'/> Exercise Rx"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Exercise Rx
         </a>
         <div class="flex-grow-1">

+ 1 - 17
resources/views/app/patient/module-specific-summary-renderers/exercise/subjective.blade.php

@@ -5,7 +5,7 @@
            href="/exercise-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="exercise-center-{{$note->id}}"
            title="<img src='/img/exercise-rx.png'/> Exercise Rx"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Exercise Rx
         </a>
         <div class="flex-grow-1">
@@ -35,22 +35,6 @@
                                 ?>
                             <?php endif; ?>
                         </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>
-                            @elseif($point->removal_reason_category === 'ON_INTAKE')
-                                <span class="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="text-sm text-success">* Added during visit</span>
-                            <?php else: ?>
-                                <span class="text-sm text-info">* Added on intake</span>
-                            <?php endif;?>
-                            <?php endif; ?>
-                        </div>
-
                     </td>
                     <td></td>
                 </tr>

+ 18 - 19
resources/views/app/patient/module-specific-summary-renderers/goal/plan.blade.php

@@ -5,7 +5,7 @@
            href="/goals-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="goals-center-{{$note->id}}"
            title="Goals Center"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Goals
         </a>
         <div class="flex-grow-1">
@@ -26,28 +26,27 @@
                         </div>
                     </td>
                     <td class="width-300px">
-                        <div class="pl-3">
+                        <div class="d-flex align-items-baseline pl-2">
                             <?php $plan = $point->childPlanAddedInNote($note); ?>
                             <?php if(!!$plan): ?>
-                                <span>{!! $plan->data->value !!}</span>
+                            <span class="pr-2">{!! $plan->data->value !!}</span>
                             <?php endif; ?>
+                            <span>
+                                <?php if ($point->is_removed): ?>
+                                @if($point->removal_reason_category === 'DURING_VISIT')
+                                    <span class="text-sm text-secondary">Removed during visit</span>
+                                @elseif($point->removal_reason_category === 'ON_INTAKE')
+                                    <span class="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="text-sm text-success">* Added during visit</span>
+                                <?php else: ?>
+                                <span class="text-sm text-info">* Added on intake</span>
+                                <?php endif;?>
+                                <?php endif; ?>
+                            </span>
                         </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>
-                            @elseif($point->removal_reason_category === 'ON_INTAKE')
-                                <span class="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="text-sm text-success">* Added during visit</span>
-                            <?php else: ?>
-                            <span class="text-sm text-info">* Added on intake</span>
-                            <?php endif;?>
-                            <?php endif; ?>
-                        </div>
-
                     </td>
                     <td></td>
                 </tr>

+ 23 - 0
resources/views/app/patient/module-specific-summary-renderers/lifestyle_general/subjective.blade.php

@@ -0,0 +1,23 @@
+@if($points && count($points))
+    <div class="d-flex border-bottom">
+        <a class="mr-2 min-width-110px "
+           open-in-stag-popup
+           href="/module-view/{{$note->uid}}/lifestyle_general/edit"
+           mc-initer="edit-univ_sub_lifestyle_general-container-{{$note->id}}"
+           title="Lifestyle General"
+           popup-style="stag-popup-md overflow-visible">
+            Lifestyle General
+        </a>
+        <div class="flex-grow-1">
+            <table class="table table-bordered table-xs table-cage mb-0">
+                <?php $j = 0; foreach ($points as $point): $j++; ?>
+                    <tr>
+                        <td>
+                            @include('app.patient.module-specific-summary-renderers.data-dump', compact('point'))
+                        </td>
+                    </tr>
+                <?php endforeach; ?>
+            </table>
+        </div>
+    </div>
+@endif

+ 23 - 0
resources/views/app/patient/module-specific-summary-renderers/lifestyle_nutrition/subjective.blade.php

@@ -0,0 +1,23 @@
+@if($points && count($points))
+    <div class="d-flex border-bottom">
+        <a class="mr-2 min-width-110px "
+           open-in-stag-popup
+           href="/module-view/{{$note->uid}}/lifestyle_nutrition/edit"
+           mc-initer="edit-univ_sub_nutrition_assessment-container-{{$note->id}}"
+           title="Lifestyle Nutrition"
+           popup-style="stag-popup-md overflow-visible">
+            Lifestyle Nutrition
+        </a>
+        <div class="flex-grow-1">
+            <table class="table table-bordered table-xs table-cage mb-0">
+                <?php $j = 0; foreach ($points as $point): $j++; ?>
+                    <tr>
+                        <td>
+                            @include('app.patient.module-specific-summary-renderers.data-dump', compact('point'))
+                        </td>
+                    </tr>
+                <?php endforeach; ?>
+            </table>
+        </div>
+    </div>
+@endif

+ 23 - 0
resources/views/app/patient/module-specific-summary-renderers/lifestyle_physical_activity/subjective.blade.php

@@ -0,0 +1,23 @@
+@if($points && count($points))
+    <div class="d-flex border-bottom">
+        <a class="mr-2 min-width-110px "
+           open-in-stag-popup
+           href="/module-view/{{$note->uid}}/lifestyle_physical_activity/edit"
+           mc-initer="edit-univ_sub_physical_activity_assessment-container-{{$note->id}}"
+           title="Lifestyle Physical Activity"
+           popup-style="stag-popup-md overflow-visible">
+            Lifestyle Physical Activity
+        </a>
+        <div class="flex-grow-1">
+            <table class="table table-bordered table-xs table-cage mb-0">
+                <?php $j = 0; foreach ($points as $point): $j++; ?>
+                    <tr>
+                        <td>
+                            @include('app.patient.module-specific-summary-renderers.data-dump', compact('point'))
+                        </td>
+                    </tr>
+                <?php endforeach; ?>
+            </table>
+        </div>
+    </div>
+@endif

+ 23 - 0
resources/views/app/patient/module-specific-summary-renderers/lifestyle_sleep/subjective.blade.php

@@ -0,0 +1,23 @@
+@if($points && count($points))
+    <div class="d-flex border-bottom">
+        <a class="mr-2 min-width-110px "
+           open-in-stag-popup
+           href="/module-view/{{$note->uid}}/lifestyle_sleep/edit"
+           mc-initer="edit-univ_sub_sleep_assessment-container-{{$note->id}}"
+           title="Lifestyle Sleep"
+           popup-style="stag-popup-md overflow-visible">
+            Lifestyle Sleep
+        </a>
+        <div class="flex-grow-1">
+            <table class="table table-bordered table-xs table-cage mb-0">
+                <?php $j = 0; foreach ($points as $point): $j++; ?>
+                    <tr>
+                        <td>
+                            @include('app.patient.module-specific-summary-renderers.data-dump', compact('point'))
+                        </td>
+                    </tr>
+                <?php endforeach; ?>
+            </table>
+        </div>
+    </div>
+@endif

+ 23 - 0
resources/views/app/patient/module-specific-summary-renderers/lifestyle_social_relationships/subjective.blade.php

@@ -0,0 +1,23 @@
+@if($points && count($points))
+    <div class="d-flex border-bottom">
+        <a class="mr-2 min-width-110px "
+           open-in-stag-popup
+           href="/module-view/{{$note->uid}}/lifestyle_social/edit"
+           mc-initer="edit-univ_sub_social_relationships_assessment-container-{{$note->id}}"
+           title="Lifestyle Social"
+           popup-style="stag-popup-md overflow-visible">
+            Lifestyle Social
+        </a>
+        <div class="flex-grow-1">
+            <table class="table table-bordered table-xs table-cage mb-0">
+                <?php $j = 0; foreach ($points as $point): $j++; ?>
+                    <tr>
+                        <td>
+                            @include('app.patient.module-specific-summary-renderers.data-dump', compact('point'))
+                        </td>
+                    </tr>
+                <?php endforeach; ?>
+            </table>
+        </div>
+    </div>
+@endif

+ 23 - 0
resources/views/app/patient/module-specific-summary-renderers/lifestyle_stress/subjective.blade.php

@@ -0,0 +1,23 @@
+@if($points && count($points))
+    <div class="d-flex border-bottom">
+        <a class="mr-2 min-width-110px "
+           open-in-stag-popup
+           href="/module-view/{{$note->uid}}/lifestyle_stress/edit"
+           mc-initer="edit-univ_sub_stress_assessment-container-{{$note->id}}"
+           title="Lifestyle Stress"
+           popup-style="stag-popup-md overflow-visible">
+            Lifestyle Stress
+        </a>
+        <div class="flex-grow-1">
+            <table class="table table-bordered table-xs table-cage mb-0">
+                <?php $j = 0; foreach ($points as $point): $j++; ?>
+                    <tr>
+                        <td>
+                            @include('app.patient.module-specific-summary-renderers.data-dump', compact('point'))
+                        </td>
+                    </tr>
+                <?php endforeach; ?>
+            </table>
+        </div>
+    </div>
+@endif

+ 23 - 0
resources/views/app/patient/module-specific-summary-renderers/lifestyle_substance_use/subjective.blade.php

@@ -0,0 +1,23 @@
+@if($points && count($points))
+    <div class="d-flex border-bottom">
+        <a class="mr-2 min-width-110px "
+           open-in-stag-popup
+           href="/module-view/{{$note->uid}}/lifestyle_substances/edit"
+           mc-initer="edit-univ_sub_substance_use_assessment-container-{{$note->id}}"
+           title="Lifestyle Substances"
+           popup-style="stag-popup-md overflow-visible">
+            Lifestyle Substances
+        </a>
+        <div class="flex-grow-1">
+            <table class="table table-bordered table-xs table-cage mb-0">
+                <?php $j = 0; foreach ($points as $point): $j++; ?>
+                    <tr>
+                        <td>
+                            @include('app.patient.module-specific-summary-renderers.data-dump', compact('point'))
+                        </td>
+                    </tr>
+                <?php endforeach; ?>
+            </table>
+        </div>
+    </div>
+@endif

+ 18 - 19
resources/views/app/patient/module-specific-summary-renderers/medication/plan.blade.php

@@ -5,7 +5,7 @@
            href="/medications-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="medications-center-{{$note->id}}"
            title="Medications Center"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Medications
         </a>
         <div class="flex-grow-1">
@@ -26,28 +26,27 @@
                         </div>
                     </td>
                     <td class="width-300px">
-                        <div class="pl-3">
+                        <div class="d-flex align-items-baseline pl-2">
                             <?php $plan = $point->childPlanAddedInNote($note); ?>
                             <?php if(!!$plan): ?>
-                                <span>{!! $plan->data->value !!}</span>
+                            <span class="pr-2">{!! $plan->data->value !!}</span>
                             <?php endif; ?>
+                            <span>
+                                <?php if ($point->is_removed): ?>
+                                @if($point->removal_reason_category === 'DURING_VISIT')
+                                    <span class="text-sm text-secondary">Removed during visit</span>
+                                @elseif($point->removal_reason_category === 'ON_INTAKE')
+                                    <span class="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="text-sm text-success">* Prescribed during visit</span>
+                                <?php else: ?>
+                                <span class="text-sm text-info">* Prescribed on intake</span>
+                                <?php endif;?>
+                                <?php endif; ?>
+                            </span>
                         </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>
-                            @elseif($point->removal_reason_category === 'ON_INTAKE')
-                                <span class="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="text-sm text-success">* Added during visit</span>
-                            <?php else: ?>
-                            <span class="text-sm text-info">* Added on intake</span>
-                            <?php endif;?>
-                            <?php endif; ?>
-                        </div>
-
                     </td>
                     <td></td>
                 </tr>

+ 1 - 1
resources/views/app/patient/module-specific-summary-renderers/nutrition/plan.blade.php

@@ -5,7 +5,7 @@
            href="/nutrition-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="nutrition-center-{{$note->id}}"
            title="<img src='/img/nutrition-rx.png'/> Nutrition Rx"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Nutrition Rx
         </a>
         <div class="flex-grow-1">

+ 1 - 17
resources/views/app/patient/module-specific-summary-renderers/nutrition/subjective.blade.php

@@ -5,7 +5,7 @@
            href="/nutrition-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="nutrition-center-{{$note->id}}"
            title="<img src='/img/nutrition-rx.png'/> Nutrition Rx"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Nutrition Rx
         </a>
         <div class="flex-grow-1">
@@ -35,22 +35,6 @@
                                 ?>
                             <?php endif; ?>
                         </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>
-                            @elseif($point->removal_reason_category === 'ON_INTAKE')
-                                <span class="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="text-sm text-success">* Added during visit</span>
-                            <?php else: ?>
-                                <span class="text-sm text-info">* Added on intake</span>
-                            <?php endif;?>
-                            <?php endif; ?>
-                        </div>
-
                     </td>
                     <td></td>
                 </tr>

+ 18 - 19
resources/views/app/patient/module-specific-summary-renderers/problem/plan.blade.php

@@ -5,7 +5,7 @@
            href="/problems-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="problems-center-{{$note->id}}"
            title="Problems Center"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Problems
         </a>
         <div class="flex-grow-1">
@@ -26,28 +26,27 @@
                         </div>
                     </td>
                     <td class="width-300px">
-                        <div class="pl-3">
+                        <div class="d-flex align-items-baseline pl-2">
                             <?php $plan = $point->childPlanAddedInNote($note); ?>
                             <?php if(!!$plan): ?>
-                                <span>{!! $plan->data->value !!}</span>
+                            <span class="pr-2">{!! $plan->data->value !!}</span>
                             <?php endif; ?>
+                            <span>
+                                <?php if ($point->is_removed): ?>
+                                @if($point->removal_reason_category === 'DURING_VISIT')
+                                    <span class="text-sm text-secondary">Removed during visit</span>
+                                @elseif($point->removal_reason_category === 'ON_INTAKE')
+                                    <span class="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="text-sm text-success">* Diagnosed during visit</span>
+                                <?php else: ?>
+                                <span class="text-sm text-info">* Diagnosed on intake</span>
+                                <?php endif;?>
+                                <?php endif; ?>
+                            </span>
                         </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>
-                            @elseif($point->removal_reason_category === 'ON_INTAKE')
-                                <span class="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="text-sm text-success">* Added during visit</span>
-                            <?php else: ?>
-                            <span class="text-sm text-info">* Added on intake</span>
-                            <?php endif;?>
-                            <?php endif; ?>
-                        </div>
-
                     </td>
                     <td></td>
                 </tr>

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

@@ -0,0 +1,7 @@
+@if($point->lastChildReview && $point->lastChildReview->added_in_note_id === $note->id)
+    <div class="d-block mb-2">
+        <a href="#" class="px-1 text-left" title="Undo Changes" v-on:click.prevent="undoChanges()">
+            <i class="fa fa-undo"></i> Undo Changes
+        </a>
+    </div>
+@endif

+ 459 - 0
resources/views/app/patient/modules/lifestyle_general/edit.blade.php

@@ -0,0 +1,459 @@
+<?php
+use App\Models\Client;
+use App\Models\Note;
+use App\Models\Point;
+/** @var Client $patient */
+/** @var Note $note */
+/** @var Point $point */
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'LIFESTYLE_GENERAL', $sessionKey);
+
+$contentData = [
+    "current_overall_health_level" => '',
+    "sleep" => '',
+    "weight_management" => '',
+    "nutrition" => '',
+    "exercise" => '',
+    "purpose_and_connection" => '',
+    "mental_health" => '',
+    "substance_use" => '',
+    "how_important_rank_1_area" => '',
+    "how_confident_rank_1_area" => '',
+    "how_important_rank_2_area" => '',
+    "how_confident_rank_2_area" => '',
+    "how_important_rank_3_area" => '',
+    "how_confident_rank_3_area" => '',
+    "visit_gains" => [],
+    "gain_other_description" => '',
+];
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $point->lastChildReview->data;
+}
+?>
+<div class="p-3 mcp-theme-1">
+    <div visit-moe close-on-save close-on-cancel class="d-block">
+        <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
+            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="segmentUid" value="<?= $note->coreSegment->uid ?>">
+            <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
+            <div id="edit-univ_sub_lifestyle_general-container">
+
+                @include('app.patient.modules._undo_changes', compact('point'))
+
+                <div class="row">
+                    <div class="col-md-12">
+                        <h5 class="bg-light p-1 font-weight-bold">GETTING STARTED</h5>
+                    </div>
+                </div>
+
+                <div class="row">
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        Please circle your current overall <b>LEVEL OF HEALTH</b>
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.current_overall_health_level">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                            <div class="flex-grow-1">
+                                <div class="row mb-2">
+                                    <div class="col-12">
+                                        Please rank the top <b>3 areas</b> you would like to improve with 1 being the most important and
+                                        3 the least important
+                                    </div>
+                                </div>
+                                <table class="table table-sm width-300px table-striped table-bordered m-0">
+                                    <tbody>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Sleep</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.sleep">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Weight Management</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.weight_management">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Nutrition</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.nutrition">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Exercise</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.exercise">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Purpose &amp; Connection</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.purpose_and_connection">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Mental Health</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.mental_health">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Substance Use</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.substance_use">
+                                        </td>
+                                    </tr>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                                        the <b>#1</b> most motivated topic area to address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_important_rank_1_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>CONFIDENT</b> are you regarding your ability to make the
+                                        change you ranked as the <b>#1</b> most motivated topic area to
+                                        address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_confident_rank_1_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                                        the <b>#2</b> most motivated topic area to address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_important_rank_2_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>CONFIDENT</b> are you regarding your ability to make the
+                                        change you ranked as the <b>#2</b> most motivated topic area to
+                                        address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_confident_rank_2_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                                        the <b>#3</b> most motivated topic area to address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_important_rank_3_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>CONFIDENT</b> are you regarding your ability to make the
+                                        change you ranked as the <b>#3</b> most motivated topic area to
+                                        address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_confident_rank_3_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-12">
+                                        <div>
+                                            <b>What would you like to gain from this lifestyle visit?</b> Check all that apply
+                                        </div>
+                                        <div class="mt-2">
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox"
+                                                       id="more_medical_scientific_knowledge"
+                                                       value="more_medical_scientific_knowledge" v-model="data.visit_gains">
+                                                <label class="form-check-label" for="more_medical_scientific_knowledge">More medical/scientific
+                                                    knowledge</label>
+                                            </div>
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox"
+                                                       id="practical_health_tips"
+                                                       value="practical_health_tips" v-model="data.visit_gains">
+                                                <label class="form-check-label" for="practical_health_tips">Practical health tips</label>
+                                            </div>
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox" id="accountability"
+                                                       value="accountability" v-model="data.visit_gains">
+                                                <label class="form-check-label" for="accountability">Accountability</label>
+                                            </div>
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox"
+                                                       id="personalized_plan"
+                                                       value="personalized_plan" v-model="data.visit_gains">
+                                                <label class="form-check-label" for="personalized_plan">Personalized Plan</label>
+                                            </div>
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox" id="other"
+                                                       value="other"
+                                                       v-model="data.visit_gains">
+                                                <label class="form-check-label" for="other">Other</label>
+                                            </div>
+
+                                            <div v-if="data.visit_gains.indexOf('other') !== -1" class="form-group mt-3">
+                                                <label>Other</label>
+                                                <input type="text" class="form-control" name="gain_other_description"
+                                                       v-model="data.gain_other_description" />
+                                            </div>
+
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                </div>
+
+                <div class="mt-3 pt-3 border-top text-center">
+                    <button type="button" v-on:click.prevent="saveForm()" class="btn btn-sm btn-primary mr-2">Submit</button>
+                    <button type="button" onclick="closeStagPopup()" class="btn btn-sm btn-default border">Cancel</button>
+                </div>
+
+            </div>
+
+            <div class="d-none">
+                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+
+</div>
+<script>
+    (function() {
+        function init() {
+
+            runMCInitializer('hide-moes');
+
+            // any JS can come here
+            // will be run on page-load as well as whenever this segment is refreshed
+            new Vue({
+                el: '#edit-univ_sub_lifestyle_general-container',
+                delimiters: ["@{{","}}"],
+                data: {
+                    data: <?= json_encode($contentData) ?>
+                },
+                watch: {
+                    $data: {
+                        handler: function(val, oldVal) {
+                            let parent = $('#edit-univ_sub_lifestyle_general-container').closest('form');
+                            parent.find('[name="data"]').val(JSON.stringify(this.data));
+
+                            // autosave on change
+                            autoSaveSegment(parent.find('[submit]').first());
+                        },
+                        deep: true
+                    }
+                },
+                methods: {
+                    calculateTotal: function() {
+                        var days = !isNaN(parseInt(this.data.days_exercise)) ? parseInt(this.data.days_exercise) : 0;
+                        var min = !isNaN(parseInt(this.data.min_exercise)) ? parseInt(this.data.min_exercise) : 0;
+                        this.data.total_exercise = days * min;
+                    },
+                    saveForm: function() {
+                        let parent = $('#edit-univ_sub_lifestyle_general-container').closest('form');
+                        parent.find('[name="data"]').val(JSON.stringify(this.data));
+                        autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
+                    }
+                }
+            });
+        }
+
+        window.segmentInitializers.lifestyle_general = init;
+
+        addMCInitializer('edit-univ_sub_lifestyle_general-container-{{$note->id}}', init, '#edit-univ_sub_lifestyle_general-container');
+
+    })();
+</script>

+ 272 - 0
resources/views/app/patient/modules/lifestyle_general/summary.blade.php

@@ -0,0 +1,272 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+$point = Point::getGlobalSingletonOfCategory($patient, 'LIFESTYLE_GENERAL', false);
+
+if ($point && @$point->data) {
+    $contentData = $point->data;
+?>
+
+    <div id="v3_sleep_assessment_section" class="mt-3">
+
+        <div class="row">
+
+            <div class="col-md-12">
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Please circle your current overall <b>LEVEL OF HEALTH</b>
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->current_overall_health_level ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-md-12">
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row mb-2">
+                            <div class="col-12">
+                                Please rank the top <b>3 areas</b> you would like to improve with 1 being the most important and
+                                3 the least important
+                            </div>
+                        </div>
+                        <table class="table table-sm width-300px table-striped table-bordered m-0">
+                            <tbody>
+                            <tr>
+                                <td class="text-nowrap align-middle">Sleep</td>
+                                <td class="px-3">
+                                    <?= @$contentData->sleep ?>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle">Weight Management</td>
+                                <td class="px-3">
+                                    <?= @$contentData->weight_management ?>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle">Nutrition</td>
+                                <td class="px-3">
+                                    <?= @$contentData->nutrition ?>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle">Exercise</td>
+                                <td class="px-3">
+                                    <?= @$contentData->exercise ?>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle">Purpose &amp; Connection</td>
+                                <td class="px-3">
+                                    <?= @$contentData->purpose_and_connection ?>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle">Mental Health</td>
+                                <td class="px-3">
+                                    <?= @$contentData->mental_health ?>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle">Substance Use</td>
+                                <td class="px-3">
+                                    <?= @$contentData->substance_use ?>
+                                </td>
+                            </tr>
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-md-12">
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                                the <b>#1</b> most motivated topic area to address?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->how_important_rank_1_area ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-md-12">
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How <b>CONFIDENT</b> are you regarding your ability to make the
+                                change you ranked as the <b>#1</b> most motivated topic area to
+                                address?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->how_confident_rank_1_area ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-md-12">
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                                the <b>#2</b> most motivated topic area to address?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->how_important_rank_2_area ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-md-12">
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How <b>CONFIDENT</b> are you regarding your ability to make the
+                                change you ranked as the <b>#2</b> most motivated topic area to
+                                address?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->how_confident_rank_2_area ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-md-12">
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                                the <b>#3</b> most motivated topic area to address?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->how_important_rank_3_area ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-md-12">
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How <b>CONFIDENT</b> are you regarding your ability to make the
+                                change you ranked as the <b>#3</b> most motivated topic area to
+                                address?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->how_confident_rank_3_area ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div class="col-md-12">
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                <div>
+                                    <b>What would you like to gain from this lifestyle visit?</b> Check all that apply
+                                </div>
+                                <div>
+
+                                    <div class="d-flex align-items-center">
+                                        <span class="width-22px">
+                                          <?php if (@$contentData->visit_gains && in_array('more_medical_scientific_knowledge', $contentData->visit_gains)) : ?>
+                                              <i class="fa fa-check"></i>
+                                          <?php endif; ?>
+                                        </span>
+                                        <span class="ml-2">More medical/scientific knowledge</span>
+                                    </div>
+
+                                    <div class="d-flex align-items-center">
+                                        <span class="width-22px">
+                                          <?php if (@$contentData->visit_gains && in_array('practical_health_tips', $contentData->visit_gains)) : ?>
+                                              <i class="fa fa-check"></i>
+                                          <?php endif; ?>
+                                        </span>
+                                        <span class="ml-2">Practical health tips</span>
+                                    </div>
+
+                                    <div class="d-flex align-items-center">
+                                        <span class="width-22px">
+                                          <?php if (@$contentData->visit_gains && in_array('accountability', $contentData->visit_gains)) : ?>
+                                              <i class="fa fa-check"></i>
+                                          <?php endif; ?>
+                                        </span>
+                                        <span class="ml-2">Accountability</span>
+                                    </div>
+
+                                    <div class="d-flex align-items-center">
+                                        <span class="width-22px">
+                                          <?php if (@$contentData->visit_gains && in_array('personalized_plan', $contentData->visit_gains)) : ?>
+                                              <i class="fa fa-check"></i>
+                                          <?php endif; ?>
+                                        </span>
+                                        <span class="ml-2">Personalized Plan</span>
+                                    </div>
+
+                                    <div class="d-flex align-items-center">
+                                        <span class="width-22px">
+                                          <?php if (@$contentData->visit_gains && in_array('other', $contentData->visit_gains)) : ?>
+                                              <i class="fa fa-check"></i>
+                                          <?php endif; ?>
+                                        </span>
+                                        <span class="ml-2">Other</span>
+                                        <span class="ml-2 font-italic text-secondary"><?= @$contentData->gain_other_description ?></span>
+                                    </div>
+
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+        </div>
+    </div>
+
+<?php
+} else {
+    echo '<div class="text-secondary">-</div>';
+}
+?>
+

+ 1315 - 0
resources/views/app/patient/modules/lifestyle_nutrition/edit.blade.php

@@ -0,0 +1,1315 @@
+<?php
+use App\Models\Client;
+use App\Models\Note;
+use App\Models\Point;
+/** @var Client $patient */
+/** @var Note $note */
+/** @var Point $point */
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'LIFESTYLE_NUTRITION', $sessionKey);
+
+$contentData = [
+    "four_leaf_fresh_fruit" => "",
+    "four_leaf_whole_vegetables" => "",
+    "four_leaf_whole_grains" => "",
+    "four_leaf_omega_3" => "",
+    "four_leaf_dairy_foods" => "",
+    "four_leaf_eggs" => "",
+    "four_leaf_cows_milk" => "",
+    "four_leaf_added_sugar" => "",
+    "four_leaf_white_flour" => "",
+    "four_leaf_sweets_salty_snacks" => "",
+    "four_leaf_meat_poultry_and_fish" => "",
+    "four_leaf_vegetable_oil" => "",
+    "nutrition_caffeinated" => "",
+    "nutrition_alcohol" => "",
+    "nutrition_junk_food" => "",
+    "nutrition_restaurant" => "",
+    "nutrition_sugary_drinks" => "",
+    "nutrition_8_glasses" => "",
+    "nutrition_nuts" => "",
+    "nutrition_artificial_sweeteners" => "",
+    "nutrition_salt" => "",
+    "nutrition_processed_meats" => "",
+    "nutrition_text_reactions" => "",
+    "nutrition_text_avoid_foods" => "",
+    "nutrition_text_crave_foods" => "",
+    "nutrition_text_diet_plan" => "",
+    "nutrition_text_overeating" => "",
+    "nutrition_text_food_choices" => "",
+    "nutrition_text_eating_disorder" => "",
+    "nutrition_supplements" => [],
+    "nutrition_oils" => [],
+    "food_recall_breakfast" => "",
+    "food_recall_breakfast_time" => "",
+    "food_recall_lunch" => "",
+    "food_recall_lunch_time" => "",
+    "food_recall_dinner" => "",
+    "food_recall_dinner_time" => "",
+    "food_recall_snacks" => "",
+    "food_recall_snacks_time" => "",
+    "food_recall_drinks" => "",
+    "food_recall_drinks_time" => "",
+    "wm_skip_meals" => "",
+    "wm_snacks" => "",
+    "wm_tv_while_eating" => "",
+    "wm_eating_in_bed" => "",
+    "wm_difficulty_sleeping" => "",
+    "wm_lack_exercise" => "",
+    "wm_lack_purpose" => "",
+    "wm_eating_habit_factors" => [],
+    "wm_eating_situations" => [],
+    "weight_loss_medications" => [],
+    "weight_loss_medications_other" => "",
+    "weight_loss_strategies" => [],
+    "weight_loss_strategies_other" => "",
+    "weight_loss_fad_diets" => [],
+    "weight_loss_fad_diets_other" => "",
+];
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $point->lastChildReview->data;
+}
+?>
+<div class="p-3 mcp-theme-1">
+
+    <div visit-moe close-on-save close-on-cancel class="d-block">
+        <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
+            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="segmentUid" value="<?= $note->coreSegment->uid ?>">
+            <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
+            <div id="edit-univ_sub_nutrition_assessment-container">
+
+                @include('app.patient.modules._undo_changes', compact('point'))
+
+                <!-- 4-leaf survey -->
+                <p class="font-weight-bold my-3 font-size-14"><i>The 4Leaf Survey</i></p>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">1.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>FRESH FRUIT.</b> On average, how many daily servings of whole
+                                fresh fruit do you eat? (Fruit juice doesn't count; not a whole plant)
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.four_leaf_fresh_fruit">
+                                    <option value="0">0</option>
+                                    <option value="1-2">1-2</option>
+                                    <option value="3-5">3-5</option>
+                                    <option value="6+">6+</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">2.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>WHOLE VEGETABLES.</b> On average, how many daily servings of
+                                whole vegetables do you eat?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px"
+                                        v-model="data.four_leaf_whole_vegetables">
+                                    <option value="0">0</option>
+                                    <option value="1-2">1-2</option>
+                                    <option value="3-5">3-5</option>
+                                    <option value="6+">6+</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">3.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>WHOLE GRAINS, LEGUMES, POTATOES</b> or other starches. On average,
+                                how many daily servings of these foods do you eat?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.four_leaf_whole_grains">
+                                    <option value="0">0</option>
+                                    <option value="1-2">1-2</option>
+                                    <option value="3-5">3-5</option>
+                                    <option value="6+">6+</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">4.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>OMEGA-3s.</b> Are you getting all you need from whole, plant-based
+                                sources like flaxseeds, walnuts, hemp & chia seeds?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.four_leaf_omega_3">
+                                    <option value="No">No</option>
+                                    <option value="Maybe">Maybe</option>
+                                    <option value="Not Sure">Not Sure</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">5.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>DAIRY FOODS.</b> How many days per week do you eat dairy foods
+                                like cheese, yogurt and ice cream? (Soy does not count)
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.four_leaf_dairy_foods">
+                                    <option value="0">0</option>
+                                    <option value="1-2">1-2</option>
+                                    <option value="3-5">3-5</option>
+                                    <option value="6-7">6-7</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">6.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>EGGS.</b> How many days per week do you either eat eggs or add
+                                them as an ingredient when cooking?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.four_leaf_eggs">
+                                    <option value="0">0</option>
+                                    <option value="1-2">1-2</option>
+                                    <option value="3-5">3-5</option>
+                                    <option value="6-7">6-7</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">7.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>COW'S MILK OR CREAM.</b> How many days per week do you drink
+                                them or add to your food, like cereal, coffee, etc.?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.four_leaf_cows_milk">
+                                    <option value="0">0</option>
+                                    <option value="1-2">1-2</option>
+                                    <option value="3-5">3-5</option>
+                                    <option value="6-7">6-7</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">8.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>ADDED SUGAR.</b> Are you really serious about eliminating added
+                                sugar at home and in food products that you buy?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.four_leaf_added_sugar">
+                                    <option value="You bet">You bet</option>
+                                    <option value="Fairly">Fairly</option>
+                                    <option value="Not Very">Not Very</option>
+                                    <option value="No">No</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">9.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>WHITE FLOUR.</b> Bread, pasta, cakes, cookies, etc. How would you
+                                describe your consumption level of these foods.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.four_leaf_white_flour">
+                                    <option value="Zero">Zero</option>
+                                    <option value="Light">Light</option>
+                                    <option value="Medium">Medium</option>
+                                    <option value="Heavy">Heavy</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">10.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>SWEETS & SALTY SNACKS.</b> How would you best describe your
+                                consumption level of these unhealthy foods.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.four_leaf_sweets_salty_snacks">
+                                    <option value="Minimal">Minimal</option>
+                                    <option value="Light">Light</option>
+                                    <option value="Medium">Medium</option>
+                                    <option value="Heavy">Heavy</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">11.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>MEAT, POULTRY AND FISH.</b> How many of your meals per week
+                                include any animal flesh? (beef, pork, lamb, chicken, turkey or fish)
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.four_leaf_meat_poultry_and_fish">
+                                    <option value="0-1">0-1</option>
+                                    <option value="2-5">2-5</option>
+                                    <option value="6-11">6-11</option>
+                                    <option value="12+">12+</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">12.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                <b>VEGETABLE OIL.</b> How many of your meals per week include vegetable
+                                oil, like olive or canola? (All oil is 100% fat, not whole plant)
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.four_leaf_vegetable_oil">
+                                    <option value="0-1">0-1</option>
+                                    <option value="2-5">2-5</option>
+                                    <option value="6-11">6-11</option>
+                                    <option value="12+">12+</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <hr class="my-4">
+
+                <!-- nutrition -->
+                <p class="font-weight-bold my-3 font-size-14"><i>NUTRITION - Eating Patterns</i></p>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                On average, how many cups (8 oz.) of caffeinated beverages do you drink per day (tea, soda, coffee, or
+                                energy drinks)?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.nutrition_caffeinated">
+                                    <option value="0">0</option>
+                                    <option value="1">1</option>
+                                    <option value="2">2</option>
+                                    <option value="3">3</option>
+                                    <option value="4+">4+</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                On average, how many servings of alcohol do you drink per day?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.nutrition_alcohol">
+                                    <option value="0">0</option>
+                                    <option value="1">1</option>
+                                    <option value="2">2</option>
+                                    <option value="3">3</option>
+                                    <option value="4+">4+</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                On average, how often do you snack on convenience or “junk” food per day? (i.e. chips, candy, granola
+                                bars, crackers, cookies, etc.)
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.nutrition_junk_food">
+                                    <option value="0">0</option>
+                                    <option value="1">1</option>
+                                    <option value="2">2</option>
+                                    <option value="3">3</option>
+                                    <option value="4+">4+</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                On average, how many meals do you buy from a restaurant or fast food per week?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.nutrition_restaurant">
+                                    <option value="0">0</option>
+                                    <option value="1">1</option>
+                                    <option value="2">2</option>
+                                    <option value="3">3</option>
+                                    <option value="4+">4+</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                On average, how many cups (8 oz.) of sugary drinks (soda, sports drinks, juice) do you drink per day?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.nutrition_sugary_drinks">
+                                    <option value="0">0</option>
+                                    <option value="1">1</option>
+                                    <option value="2">2</option>
+                                    <option value="3">3</option>
+                                    <option value="4+">4+</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                On average, do you drink at least 8 glasses of water per day?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.nutrition_8_glasses">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                On average, do you eat at least 5 handfuls of nuts per week? No Yes
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.nutrition_nuts">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you use natural or artificial sweeteners? (i.e. Equal, Stevia, Splenda, Sweet & Low, honey, agave,
+                                etc.) No Yes
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.nutrition_artificial_sweeteners">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you add salt to most of your meals? No Yes
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.nutrition_salt">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">j.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you eat processed meats (i.e. sausage, hot dogs, salami, bacon)?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.nutrition_processed_meats">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">k.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                Do you have any bad reactions (sensitivities or allergies) to food? If yes, please list here:
+                            </div>
+                        </div>
+                        <div class="row">
+                            <div class="col-12">
+                                <input type="text" class="form-control form-control-sm"
+                                       v-model="data.nutrition_text_reactions">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">l.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                Do you avoid any particular foods? If yes, please list here:
+                            </div>
+                        </div>
+                        <div class="row">
+                            <div class="col-12">
+                                <input type="text" class="form-control form-control-sm"
+                                       v-model="data.nutrition_text_avoid_foods">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">m.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                Do you have foods that you crave? If yes, please list here:
+                            </div>
+                        </div>
+                        <div class="row">
+                            <div class="col-12">
+                                <input type="text" class="form-control form-control-sm"
+                                       v-model="data.nutrition_text_crave_foods">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">n.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                Are you currently following a particular diet or nutrition plan? If yes, please list here:
+                            </div>
+                        </div>
+                        <div class="row">
+                            <div class="col-12">
+                                <input type="text" class="form-control form-control-sm"
+                                       v-model="data.nutrition_text_diet_plan">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">o.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                During the last 3 months, did you have any episodes of excessive overeating? If yes please explain here:
+                            </div>
+                        </div>
+                        <div class="row">
+                            <div class="col-12">
+                                <input type="text" class="form-control form-control-sm"
+                                       v-model="data.nutrition_text_overeating">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">p.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                Are you concerned about making the wrong food choices? If yes, please explain here:
+                            </div>
+                        </div>
+                        <div class="row">
+                            <div class="col-12">
+                                <input type="text" class="form-control form-control-sm"
+                                       v-model="data.nutrition_text_food_choices">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">q.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                Have you ever had an eating disorder? If yes, please list here:
+                            </div>
+                        </div>
+                        <div class="row">
+                            <div class="col-12">
+                                <input type="text" class="form-control form-control-sm"
+                                       v-model="data.nutrition_text_eating_disorder">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="col-6">
+                        <div class="font-weight-bold mb-1">Do you use any of the following VITAMINS or SUPPLEMENTS? <i>Check all that apply</i></div>
+                        <table class="table table-sm table-striped table-bordered m-0">
+                            <tbody>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_supplements" value="Vitamin D"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Vitamin D</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_supplements" value="Calcium"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Calcium</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_supplements" value="Vitamin B12"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Vitamin B12</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_supplements" value="Probiotics"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Probiotics</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_supplements" value="Omega 3"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Omega 3</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_supplements" value="Multivitamin"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Multivitamin</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_supplements" value="Other"></td>
+                                <td class="text-nowrap align-middle">Other</td>
+                                <td class="p-0">
+                                    <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.nutrition_supplements_other">
+                                </td>
+                            </tr>
+                            </tbody>
+                        </table>
+                    </div>
+                    <div class="col-6">
+                        <div class="font-weight-bold mb-1">Do you use any of the following OILS with your meals or cooking? <i>Check all that apply</i></div>
+                        <table class="table table-sm table-striped table-bordered m-0">
+                            <tbody>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_oils" value="Olive Oil"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Olive Oil</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_oils" value="Canola Oil"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Canola Oil</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_oils" value="Vegetable Oil"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Vegetable Oil</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_oils" value="Coconut Oil"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Coconut Oil</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_oils" value="Butter"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Butter</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_oils" value="Lard"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Lard</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.nutrition_oils" value="Other"></td>
+                                <td class="text-nowrap align-middle">Other</td>
+                                <td class="p-0">
+                                    <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.nutrition_oils_other">
+                                </td>
+                            </tr>
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+                <p class="font-weight-bold my-3 font-size-14">FOOD RECALL: <i>Please record below what AND how much you ate and drank yesterday (or the last typical day)</i></p>
+                <table class="table table-sm table-striped table-bordered m-0">
+                    <tbody>
+                    <tr>
+                        <td class="text-nowrap align-middle">Breakfast:</td>
+                        <td class="p-0 w-50">
+                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.food_recall_breakfast">
+                        </td>
+                        <td class="text-nowrap align-middle">Time:</td>
+                        <td class="p-0">
+                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.food_recall_breakfast_time">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle">Lunch:</td>
+                        <td class="p-0 w-50">
+                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.food_recall_lunch">
+                        </td>
+                        <td class="text-nowrap align-middle">Time:</td>
+                        <td class="p-0">
+                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.food_recall_lunch_time">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle">Dinner:</td>
+                        <td class="p-0 w-50">
+                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.food_recall_dinner">
+                        </td>
+                        <td class="text-nowrap align-middle">Time:</td>
+                        <td class="p-0">
+                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.food_recall_dinner_time">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle">Snacks:</td>
+                        <td class="p-0 w-50">
+                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.food_recall_snacks">
+                        </td>
+                        <td class="text-nowrap align-middle">Time:</td>
+                        <td class="p-0">
+                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.food_recall_snacks_time">
+                        </td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle">Drinks/Beverages:</td>
+                        <td class="p-0 w-50">
+                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.food_recall_drinks">
+                        </td>
+                        <td class="text-nowrap align-middle">Time:</td>
+                        <td class="p-0">
+                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.food_recall_drinks_time">
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
+                <hr class="my-4">
+
+                <!-- WEIGHT MANAGEMENT -->
+                <p class="font-weight-bold my-3 font-size-14"><i>WEIGHT MANAGEMENT</i></p>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How often do you skip meals?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wm_skip_meals">
+                                    <option value="1">1 - Never</option>
+                                    <option value="2">2 - Seldom</option>
+                                    <option value="3">3 - Sometimes</option>
+                                    <option value="4">4 - Often</option>
+                                    <option value="5">5 - Always</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How often do you snack in between meals?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wm_snacks">
+                                    <option value="1">1 - Never</option>
+                                    <option value="2">2 - Seldom</option>
+                                    <option value="3">3 - Sometimes</option>
+                                    <option value="4">4 - Often</option>
+                                    <option value="5">5 - Always</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How often do you eat while watching TV?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wm_tv_while_eating">
+                                    <option value="1">1 - Never</option>
+                                    <option value="2">2 - Seldom</option>
+                                    <option value="3">3 - Sometimes</option>
+                                    <option value="4">4 - Often</option>
+                                    <option value="5">5 - Always</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How often do you eat while in bed?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wm_eating_in_bed">
+                                    <option value="1">1 - Never</option>
+                                    <option value="2">2 - Seldom</option>
+                                    <option value="3">3 - Sometimes</option>
+                                    <option value="4">4 - Often</option>
+                                    <option value="5">5 - Always</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How often do you have difficulty sleeping?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wm_difficulty_sleeping">
+                                    <option value="1">1 - Never</option>
+                                    <option value="2">2 - Seldom</option>
+                                    <option value="3">3 - Sometimes</option>
+                                    <option value="4">4 - Often</option>
+                                    <option value="5">5 - Always</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How often do you lack physical activity or exercise?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wm_lack_exercise">
+                                    <option value="1">1 - Never</option>
+                                    <option value="2">2 - Seldom</option>
+                                    <option value="3">3 - Sometimes</option>
+                                    <option value="4">4 - Often</option>
+                                    <option value="5">5 - Always</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How often do you feel a lack of purpose or meaning in your life?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wm_lack_purpose">
+                                    <option value="1">1 - Never</option>
+                                    <option value="2">2 - Seldom</option>
+                                    <option value="3">3 - Sometimes</option>
+                                    <option value="4">4 - Often</option>
+                                    <option value="5">5 - Always</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="font-weight-bold mb-1">Which of the following factors apply to your eating habits and current lifestyle? <i>Check all that apply</i></div>
+                <table class="table table-sm table-striped table-bordered mb-3">
+                    <tbody>
+                    <tr>
+
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Like healthy food"></td>
+                        <td class="text-nowrap align-middle">Like healthy food</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Don’t like healthy food"></td>
+                        <td class="text-nowrap align-middle">Don’t like healthy food</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Know how to cook healthy foods"></td>
+                        <td class="text-nowrap align-middle">Know how to cook healthy foods</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Fast eater"></td>
+                        <td class="text-nowrap align-middle">Fast eater</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Eat slowly"></td>
+                        <td class="text-nowrap align-middle">Eat slowly</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Read nutrition labels"></td>
+                        <td class="text-nowrap align-middle">Read nutrition labels</td>
+                    </tr>
+                    <tr>
+
+
+
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Rely on packaged or fast foods"></td>
+                        <td class="text-nowrap align-middle">Rely on packaged or fast foods</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Dislike cooking"></td>
+                        <td class="text-nowrap align-middle">Dislike cooking</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Prepare meals at home"></td>
+                        <td class="text-nowrap align-middle">Prepare meals at home</td>
+                    </tr>
+                    <tr>
+
+
+
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Do not plan meals"></td>
+                        <td class="text-nowrap align-middle">Do not plan meals</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Eat a variety of foods"></td>
+                        <td class="text-nowrap align-middle">Eat a variety of foods</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Always hungry"></td>
+                        <td class="text-nowrap align-middle">Always hungry</td>
+                    </tr>
+                    <tr>
+
+
+
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Late night eater"></td>
+                        <td class="text-nowrap align-middle">Late night eater</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Negative relationship to food"></td>
+                        <td class="text-nowrap align-middle">Negative relationship to food</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Erratic eater"></td>
+                        <td class="text-nowrap align-middle">Erratic eater</td>
+                    </tr>
+                    <tr>
+
+
+
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="No time to prepare healthy food choices"></td>
+                        <td class="text-nowrap align-middle">No time to prepare healthy food choices</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Don’t know how to cook"></td>
+                        <td class="text-nowrap align-middle">Don’t know how to cook</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_habit_factors" value="Live alone or eat alone often"></td>
+                        <td class="text-nowrap align-middle">Live alone or eat alone often</td>
+                    </tr>
+                    </tbody>
+                </table>
+                <div class="font-weight-bold mb-1">Do any of the following situations or emotions cause you to eat? <i>Check all that apply</i></div>
+                <table class="table table-sm table-striped table-bordered m-0">
+                    <tbody>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_situations" value="Sadness"></td>
+                        <td class="text-nowrap align-middle">Sadness</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_situations" value="Pain"></td>
+                        <td class="text-nowrap align-middle">Pain</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_situations" value="Insomnia"></td>
+                        <td class="text-nowrap align-middle">Insomnia</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_situations" value="Anxiety"></td>
+                        <td class="text-nowrap align-middle">Anxiety</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_situations" value="Fatigue"></td>
+                        <td class="text-nowrap align-middle">Fatigue</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_situations" value="Social or Family Situations"></td>
+                        <td class="text-nowrap align-middle">Social or Family Situations</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_situations" value="Boredom"></td>
+                        <td class="text-nowrap align-middle">Boredom</td>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.wm_eating_situations" value="Stress"></td>
+                        <td class="text-nowrap align-middle">Stress</td>
+                    </tr>
+                    </tbody>
+                </table>
+                <hr class="my-4">
+
+                <!-- WEIGHT HISTORY -->
+                <p class="font-weight-bold my-3 font-size-14"><i>WEIGHT HISTORY</i></p>
+                <div class="d-flex align-items-baseline mb-1">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Have you ever been overweight or obese? If yes, answer below:
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wh_obese">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-1">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Were you overweight as a child?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wh_obese_child">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-1">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Were you overweight as a teenager?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wh_obese_teenager">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-1">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Were you overweight between the ages of 20-29?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wh_obese_20_29">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-1">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Were you overweight between the ages of 30-39?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wh_obese_30_39">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Were you overweight above the age of 40?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wh_obese_40_plus">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-1">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Are you currently trying to lose or gain weight?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wh_looking_to_lose_or_gain">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                If yes, please circle your goal:
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wh_lose_or_gain">
+                                    <option value="Lose weight">Lose weight</option>
+                                    <option value="Gain weight">Gain weight</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-1">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Have you ever intentionally lost or reduced your weight by more than 5 lbs.?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wh_intentionally_lost_5_lbs">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                If yes, did you regain weight within 1 year?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wh_regained_within_a_year">
+                                    <option value="Lose weight">Lose weight</option>
+                                    <option value="Gain weight">Gain weight</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-1">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Have you had weight loss surgery?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.wh_weight_loss_surgery">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                If yes, please list the type of surgery you had:
+                            </div>
+                            <div class="col-6">
+                                <input class="form-control form-control-sm" v-model="data.wh_weight_loss_surgery_text">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="font-weight-bold mb-2">Have you ever used weight loss medications? <i>If yes, circle which ones you have used? If other, please list.</i></div>
+                <div class="d-flex flex-wrap">
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Acutrim" class="mr-2"><span>Acutrim</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Alli" class="mr-2"><span>Alli</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Amphetamines" class="mr-2"><span>Amphetamines</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Anorex" class="mr-2"><span>Anorex</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Belviq" class="mr-2"><span>Belviq</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Byetta" class="mr-2"><span>Byetta</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Contrave" class="mr-2"><span>Contrave</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Dexatrim" class="mr-2"><span>Dexatrim</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Didrex" class="mr-2"><span>Didrex</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Fastin" class="mr-2"><span>Fastin</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Fen-Phen" class="mr-2"><span>Fen-Phen</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Fenfluramine" class="mr-2"><span>Fenfluramine</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Mazanor" class="mr-2"><span>Mazanor</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Meridia" class="mr-2"><span>Meridia</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Obalan" class="mr-2"><span>Obalan</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Phendiet" class="mr-2"><span>Phendiet</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Phentermine" class="mr-2"><span>Phentermine</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Plegine" class="mr-2"><span>Plegine</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Pondimin" class="mr-2"><span>Pondimin</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Prozac" class="mr-2"><span>Prozac</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Qsymia" class="mr-2"><span>Qsymia</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Redux" class="mr-2"><span>Redux</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Sanorex" class="mr-2"><span>Sanorex</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Tenuate" class="mr-2"><span>Tenuate</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Tepanol" class="mr-2"><span>Tepanol</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Vyvanse" class="mr-2"><span>Vyvanse</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Wechless" class="mr-2"><span>Wechless</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Wellbutrin" class="mr-2"><span>Wellbutrin</span></div>
+                    <div class="d-inline-flex width-150px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="Xenical" class="mr-2"><span>Xenical</span></div>
+                    <div class="d-inline-flex text-nowrap align-items-baseline"><input type="checkbox" v-model="data.weight_loss_medications" value="i_dont_remember" class="mr-2"><span>I don't remember the name of the medication</span></div>
+                </div>
+                <div class="d-flex align-items-center mt-1 mb-3">
+                    <input type="checkbox" v-model="data.weight_loss_medications" value="other" class="mr-2">
+                    <span class="mr-2">Other</span>
+                    <input type="text" class="flex-grow-1 form-control form-control-sm" v-model="data.weight_loss_medications_other">
+                </div>
+                <p class="font-weight-bold font=size-14">WEIGHT LOSS STRATEGIES</p>
+                <div class="font-weight-bold mb-2">Have you tried any of the following alternative therapies or programs? <i>Check all that apply. If other, please list.</i></div>
+                <div class="d-flex flex-wrap">
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_strategies" value="Acupuncture" class="mr-2"><span>Acupuncture</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_strategies" value="Acupressure" class="mr-2"><span>Acupressure</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_strategies" value="Nutritionist/Registered Dietitian" class="mr-2"><span>Nutritionist/Registered Dietitian</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_strategies" value="Residential Programs" class="mr-2"><span>Residential Programs</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_strategies" value="Hypnosis" class="mr-2"><span>Hypnosis</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_strategies" value="Physical Activity/Exercises" class="mr-2"><span>Physical Activity/Exercises</span></div>
+                </div>
+                <div class="d-flex align-items-center mt-1 mb-3">
+                    <input type="checkbox" v-model="data.weight_loss_strategies" value="other" class="mr-2">
+                    <span class="mr-2">Other</span>
+                    <input type="text" class="flex-grow-1 form-control form-control-sm" v-model="data.weight_loss_strategies_other">
+                </div>
+                <div class="font-weight-bold mb-2">Which commercial or fad diets have you tried in the past? <i>Check all that apply. If other, please list.</i></div>
+                <div class="d-flex flex-wrap">
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Atkins Diet" class="mr-2"><span>Atkins Diet</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Calorie Counting" class="mr-2"><span>Calorie Counting</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="CHIP" class="mr-2"><span>CHIP</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="DASH" class="mr-2"><span>DASH</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Elimination Diet (Allergy)" class="mr-2"><span>Elimination Diet (Allergy)</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Gluten Free" class="mr-2"><span>Gluten Free</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Jenny Craig" class="mr-2"><span>Jenny Craig</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Low Carb" class="mr-2"><span>Low Carb</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Low Fat" class="mr-2"><span>Low Fat</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Mediterranean Diet" class="mr-2"><span>Mediterranean Diet</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Paleo" class="mr-2"><span>Paleo</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Slim Fast/Meal" class="mr-2"><span>Slim Fast/Meal</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="South Beach" class="mr-2"><span>South Beach</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Vegan" class="mr-2"><span>Vegan</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Vegetarian" class="mr-2"><span>Vegetarian</span></div>
+                    <div class="d-inline-flex width-300px align-items-baseline"><input type="checkbox" v-model="data.weight_loss_fad_diets" value="Weight Watchers" class="mr-2"><span>Weight Watchers</span></div>
+                </div>
+                <div class="d-flex align-items-center mt-1 mb-3">
+                    <input type="checkbox" v-model="data.weight_loss_fad_diets" value="other" class="mr-2">
+                    <span class="mr-2">Other</span>
+                    <input type="text" class="flex-grow-1 form-control form-control-sm" v-model="data.weight_loss_fad_diets_other">
+                </div>
+
+                <div class="mt-3 pt-3 border-top text-center">
+                    <button type="button" v-on:click.prevent="saveForm()" class="btn btn-sm btn-primary mr-2">Submit</button>
+                    <button type="button" onclick="closeStagPopup()" class="btn btn-sm btn-default border">Cancel</button>
+                </div>
+
+            </div>
+
+            <div class="d-none">
+                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+</div>
+<script>
+    (function() {
+        function init() {
+
+            runMCInitializer('hide-moes');
+
+            // any JS can come here
+            // will be run on page-load as well as whenever this segment is refreshed
+            new Vue({
+                el: '#edit-univ_sub_nutrition_assessment-container',
+                delimiters: ["@{{","}}"],
+                data: {
+                    data: <?= json_encode($contentData) ?>
+                },
+                watch: {
+                    $data: {
+                        handler: function(val, oldVal) {
+                            let parent = $('#edit-univ_sub_nutrition_assessment-container').closest('form');
+                            parent.find('[name="data"]').val(JSON.stringify(this.data));
+
+                            // autosave on change
+                            autoSaveSegment(parent.find('[submit]').first());
+                        },
+                        deep: true
+                    }
+                },
+                methods: {
+                    saveForm: function() {
+                        let parent = $('#edit-univ_sub_nutrition_assessment-container').closest('form');
+                        parent.find('[name="data"]').val(JSON.stringify(this.data));
+                        autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
+                    }
+                }
+            });
+        }
+
+        window.segmentInitializers.lifestyle_nutrition = init;
+
+        addMCInitializer('edit-univ_sub_nutrition_assessment-container-{{$note->id}}', init, '#edit-univ_sub_nutrition_assessment-container');
+
+    })();
+</script>

+ 1228 - 0
resources/views/app/patient/modules/lifestyle_nutrition/summary.blade.php

@@ -0,0 +1,1228 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+$point = Point::getGlobalSingletonOfCategory($patient, 'LIFESTYLE_NUTRITION', false);
+
+if ($point && @$point->data) {
+    $contentData = $point->data;
+?>
+
+    <div class="mt-3">
+
+        <!-- 4-leaf survey -->
+        <p class="font-weight-bold my-3 font-size-14"><i>The 4Leaf Survey</i></p>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">1.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>FRESH FRUIT.</b> On average, how many daily servings of whole
+                        fresh fruit do you eat? (Fruit juice doesn't count; not a whole plant)
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_fresh_fruit ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">2.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>WHOLE VEGETABLES.</b> On average, how many daily servings of
+                        whole vegetables do you eat?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_whole_vegetables ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">3.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>WHOLE GRAINS, LEGUMES, POTATOES</b> or other starches. On average,
+                        how many daily servings of these foods do you eat?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_whole_grains ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">4.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>OMEGA-3s.</b> Are you getting all you need from whole, plant-based
+                        sources like flaxseeds, walnuts, hemp & chia seeds?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_omega_3 ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">5.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>DAIRY FOODS.</b> How many days per week do you eat dairy foods
+                        like cheese, yogurt and ice cream? (Soy does not count)
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_dairy_foods ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">6.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>EGGS.</b> How many days per week do you either eat eggs or add
+                        them as an ingredient when cooking?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_eggs ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">7.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>COW'S MILK OR CREAM.</b> How many days per week do you drink
+                        them or add to your food, like cereal, coffee, etc.?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_cows_milk ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">8.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>ADDED SUGAR.</b> Are you really serious about eliminating added
+                        sugar at home and in food products that you buy?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_added_sugar ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">9.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>WHITE FLOUR.</b> Bread, pasta, cakes, cookies, etc. How would you
+                        describe your consumption level of these foods.
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_white_flour ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">10.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>SWEETS & SALTY SNACKS.</b> How would you best describe your
+                        consumption level of these unhealthy foods.
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_sweets_salty_snacks ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">11.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>MEAT, POULTRY AND FISH.</b> How many of your meals per week
+                        include any animal flesh? (beef, pork, lamb, chicken, turkey or fish)
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_meat_poultry_and_fish ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">12.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        <b>VEGETABLE OIL.</b> How many of your meals per week include vegetable
+                        oil, like olive or canola? (All oil is 100% fat, not whole plant)
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->four_leaf_vegetable_oil ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <hr class="my-4">
+
+        <!-- nutrition -->
+        <p class="font-weight-bold my-3 font-size-14"><i>NUTRITION - Eating Patterns</i></p>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        On average, how many cups (8 oz.) of caffeinated beverages do you drink per day (tea, soda, coffee, or
+                        energy drinks)?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->nutrition_caffeinated ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        On average, how many servings of alcohol do you drink per day?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->nutrition_alcohol ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        On average, how often do you snack on convenience or “junk” food per day? (i.e. chips, candy, granola
+                        bars, crackers, cookies, etc.)
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->nutrition_junk_food ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        On average, how many meals do you buy from a restaurant or fast food per week?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->nutrition_restaurant ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        On average, how many cups (8 oz.) of sugary drinks (soda, sports drinks, juice) do you drink per day?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->nutrition_sugary_drinks ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        On average, do you drink at least 8 glasses of water per day?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->nutrition_8_glasses ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        On average, do you eat at least 5 handfuls of nuts per week? No Yes
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->nutrition_nuts ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Do you use natural or artificial sweeteners? (i.e. Equal, Stevia, Splenda, Sweet & Low, honey, agave,
+                        etc.) No Yes
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->nutrition_artificial_sweeteners ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Do you add salt to most of your meals? No Yes
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->nutrition_salt ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">j.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Do you eat processed meats (i.e. sausage, hot dogs, salami, bacon)?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->nutrition_processed_meats ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">k.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-12">
+                        Do you have any bad reactions (sensitivities or allergies) to food? If yes, please list here:
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="col-12">
+                        <?= @$contentData->nutrition_text_reactions ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">l.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-12">
+                        Do you avoid any particular foods? If yes, please list here:
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="col-12">
+                        <?= @$contentData->nutrition_text_avoid_foods ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">m.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-12">
+                        Do you have foods that you crave? If yes, please list here:
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="col-12">
+                        <?= @$contentData->nutrition_text_crave_foods ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">n.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-12">
+                        Are you currently following a particular diet or nutrition plan? If yes, please list here:
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="col-12">
+                        <?= @$contentData->nutrition_text_diet_plan ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">o.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-12">
+                        During the last 3 months, did you have any episodes of excessive overeating? If yes please explain here:
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="col-12">
+                        <?= @$contentData->nutrition_text_overeating ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">p.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-12">
+                        Are you concerned about making the wrong food choices? If yes, please explain here:
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="col-12">
+                        <?= @$contentData->nutrition_text_food_choices ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">q.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-12">
+                        Have you ever had an eating disorder? If yes, please list here:
+                    </div>
+                </div>
+                <div class="row">
+                    <div class="col-12">
+                        <?= @$contentData->nutrition_text_eating_disorder ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="row">
+            <div class="col-6">
+                <div class="font-weight-bold mb-1">Do you use any of the following VITAMINS or SUPPLEMENTS? <i>Check all that apply</i></div>
+                <table class="table table-sm table-striped table-bordered m-0">
+                    <tbody>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_supplements && in_array('Vitamin D', $contentData->nutrition_supplements)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Vitamin D</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_supplements && in_array('Calcium', $contentData->nutrition_supplements)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Calcium</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_supplements && in_array('Vitamin B12', $contentData->nutrition_supplements)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Vitamin B12</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_supplements && in_array('Probiotics', $contentData->nutrition_supplements)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Probiotics</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_supplements && in_array('Omega 3', $contentData->nutrition_supplements)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Omega 3</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_supplements && in_array('Multivitamin', $contentData->nutrition_supplements)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Multivitamin</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_supplements && in_array('Other', $contentData->nutrition_supplements)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle">Other</td>
+                        <td class="p-0">
+                            <?= @$contentData->nutrition_supplements_other ?>
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
+            </div>
+            <div class="col-6">
+                <div class="font-weight-bold mb-1">Do you use any of the following OILS with your meals or cooking? <i>Check all that apply</i></div>
+                <table class="table table-sm table-striped table-bordered m-0">
+                    <tbody>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_oils && in_array('Olive Oil', $contentData->nutrition_oils)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Olive Oil</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_oils && in_array('Canola Oil', $contentData->nutrition_oils)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Canola Oil</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_oils && in_array('Vegetable Oil', $contentData->nutrition_oils)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Vegetable Oil</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_oils && in_array('Coconut Oil', $contentData->nutrition_oils)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Coconut Oil</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_oils && in_array('Butter', $contentData->nutrition_oils)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Butter</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_oils && in_array('Lard', $contentData->nutrition_oils)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle" colspan="2">Lard</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center">
+                            <?php if (@$contentData->nutrition_oils && in_array('Other', $contentData->nutrition_oils)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                        </td>
+                        <td class="text-nowrap align-middle">Other</td>
+                        <td class="p-0">
+                            <?= @$contentData->nutrition_oils_other ?>
+                        </td>
+                    </tr>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+        <p class="font-weight-bold my-3 font-size-14">FOOD RECALL: <i>Please record below what AND how much you ate and drank yesterday (or the last typical day)</i></p>
+        <table class="table table-sm table-striped table-bordered m-0">
+            <tbody>
+            <tr>
+                <td class="text-nowrap align-middle">Breakfast:</td>
+                <td class="p-0 w-50">
+                    <?= @$contentData->food_recall_breakfast ?>
+                </td>
+                <td class="text-nowrap align-middle">Time:</td>
+                <td class="p-0">
+                    <?= @$contentData->food_recall_breakfast_time ?>
+                </td>
+            </tr>
+            <tr>
+                <td class="text-nowrap align-middle">Lunch:</td>
+                <td class="p-0 w-50">
+                    <?= @$contentData->food_recall_lunch ?>
+                </td>
+                <td class="text-nowrap align-middle">Time:</td>
+                <td class="p-0">
+                    <?= @$contentData->food_recall_lunch_time ?>
+                </td>
+            </tr>
+            <tr>
+                <td class="text-nowrap align-middle">Dinner:</td>
+                <td class="p-0 w-50">
+                    <?= @$contentData->food_recall_dinner ?>
+                </td>
+                <td class="text-nowrap align-middle">Time:</td>
+                <td class="p-0">
+                    <?= @$contentData->food_recall_dinner_time ?>
+                </td>
+            </tr>
+            <tr>
+                <td class="text-nowrap align-middle">Snacks:</td>
+                <td class="p-0 w-50">
+                    <?= @$contentData->food_recall_snacks ?>
+                </td>
+                <td class="text-nowrap align-middle">Time:</td>
+                <td class="p-0">
+                    <?= @$contentData->food_recall_snacks_time ?>
+                </td>
+            </tr>
+            <tr>
+                <td class="text-nowrap align-middle">Drinks/Beverages:</td>
+                <td class="p-0 w-50">
+                    <?= @$contentData->food_recall_drinks ?>
+                </td>
+                <td class="text-nowrap align-middle">Time:</td>
+                <td class="p-0">
+                    <?= @$contentData->food_recall_drinks_time ?>
+                </td>
+            </tr>
+            </tbody>
+        </table>
+        <hr class="my-4">
+
+        <!-- WEIGHT MANAGEMENT -->
+        <p class="font-weight-bold my-3 font-size-14"><i>WEIGHT MANAGEMENT</i></p>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        How often do you skip meals?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wm_skip_meals ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        How often do you snack in between meals?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wm_snacks ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        How often do you eat while watching TV?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wm_tv_while_eating ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        How often do you eat while in bed?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wm_eating_in_bed ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        How often do you have difficulty sleeping?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wm_difficulty_sleeping ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        How often do you lack physical activity or exercise?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wm_lack_exercise ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        How often do you feel a lack of purpose or meaning in your life?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wm_lack_purpose ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="font-weight-bold mb-1">Which of the following factors apply to your eating habits and current lifestyle? <i>Check all that apply</i></div>
+        <table class="table table-sm table-striped table-bordered mb-3">
+            <tbody>
+            <tr>
+
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Like healthy food', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Like healthy food</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Don’t like healthy food', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Don’t like healthy food</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Know how to cook healthy foods', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Know how to cook healthy foods</td>
+            </tr>
+            <tr>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Fast eater', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Fast eater</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Eat slowly', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Eat slowly</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Read nutrition labels', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Read nutrition labels</td>
+            </tr>
+            <tr>
+
+
+
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Rely on packaged or fast foods', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Rely on packaged or fast foods</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Dislike cooking', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Dislike cooking</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Prepare meals at home', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Prepare meals at home</td>
+            </tr>
+            <tr>
+
+
+
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Do not plan meals', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Do not plan meals</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Eat a variety of foods', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Eat a variety of foods</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Always hungry', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Always hungry</td>
+            </tr>
+            <tr>
+
+
+
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Late night eater', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Late night eater</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Negative relationship to food', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Negative relationship to food</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Erratic eater', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Erratic eater</td>
+            </tr>
+            <tr>
+
+
+
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('No time to prepare healthy food choices', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">No time to prepare healthy food choices</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Don’t know how to cook', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Don’t know how to cook</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_habit_factors && in_array('Live alone or eat alone often', $contentData->wm_eating_habit_factors)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Live alone or eat alone often</td>
+            </tr>
+            </tbody>
+        </table>
+        <div class="font-weight-bold mb-1">Do any of the following situations or emotions cause you to eat? <i>Check all that apply</i></div>
+        <table class="table table-sm table-striped table-bordered m-0">
+            <tbody>
+            <tr>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_situations && in_array('Sadness', $contentData->wm_eating_situations)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Sadness</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_situations && in_array('Pain', $contentData->wm_eating_situations)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Pain</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_situations && in_array('Insomnia', $contentData->wm_eating_situations)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Insomnia</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_situations && in_array('Anxiety', $contentData->wm_eating_situations)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Anxiety</td>
+            </tr>
+            <tr>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_situations && in_array('Fatigue', $contentData->wm_eating_situations)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Fatigue</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_situations && in_array('Social or Family Situations', $contentData->wm_eating_situations)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Social or Family Situations</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_situations && in_array('Boredom', $contentData->wm_eating_situations)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Boredom</td>
+                <td class="text-nowrap align-middle width-40px text-center">
+                    <?php if (@$contentData->wm_eating_situations && in_array('Stress', $contentData->wm_eating_situations)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                </td>
+                <td class="text-nowrap align-middle">Stress</td>
+            </tr>
+            </tbody>
+        </table>
+        <hr class="my-4">
+
+        <!-- WEIGHT HISTORY -->
+        <p class="font-weight-bold my-3 font-size-14"><i>WEIGHT HISTORY</i></p>
+        <div class="d-flex align-items-baseline mb-1">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Have you ever been overweight or obese? If yes, answer below:
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_obese ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-1">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Were you overweight as a child?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_obese_child ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-1">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Were you overweight as a teenager?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_obese_teenager ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-1">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Were you overweight between the ages of 20-29?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_obese_20_29 ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-1">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Were you overweight between the ages of 30-39?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_obese_30_39 ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Were you overweight above the age of 40?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_obese_40_plus ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-1">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Are you currently trying to lose or gain weight?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_looking_to_lose_or_gain ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        If yes, please circle your goal:
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_lose_or_gain ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-1">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Have you ever intentionally lost or reduced your weight by more than 5 lbs.?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_intentionally_lost_5_lbs ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        If yes, did you regain weight within 1 year?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_regained_within_a_year ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-1">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        Have you had weight loss surgery?
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_weight_loss_surgery ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+            <div class="flex-grow-1">
+                <div class="row">
+                    <div class="col-6">
+                        If yes, please list the type of surgery you had:
+                    </div>
+                    <div class="col-6">
+                        <?= @$contentData->wh_weight_loss_surgery_text ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="font-weight-bold mb-2">Have you ever used weight loss medications? <i>If yes, circle which ones you have used? If other, please list.</i></div>
+        <div class="d-flex flex-wrap">
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Acutrim', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Acutrim</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Alli', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Alli</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Amphetamines', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Amphetamines</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Anorex', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Anorex</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Belviq', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Belviq</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Byetta', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Byetta</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Contrave', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Contrave</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Dexatrim', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Dexatrim</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Didrex', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Didrex</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Fastin', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Fastin</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Fen-Phen', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Fen-Phen</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Fenfluramine', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Fenfluramine</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Mazanor', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Mazanor</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Meridia', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Meridia</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Obalan', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Obalan</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Phendiet', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Phendiet</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Phentermine', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Phentermine</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Plegine', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Plegine</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Pondimin', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Pondimin</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Prozac', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Prozac</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Qsymia', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Qsymia</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Redux', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Redux</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Sanorex', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Sanorex</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Tenuate', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Tenuate</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Tepanol', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Tepanol</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Vyvanse', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Vyvanse</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Wechless', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Wechless</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Wellbutrin', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Wellbutrin</span>
+            </div>
+            <div class="d-inline-flex width-150px align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('Xenical', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Xenical</span>
+            </div>
+            <div class="d-inline-flex text-nowrap align-items-baseline">
+                <?php if (@$contentData->weight_loss_medications && in_array('i_dont_remember', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>I don't remember the name of the medication</span>
+            </div>
+        </div>
+        <div class="d-flex align-items-center mt-1 mb-3">
+            <?php if (@$contentData->weight_loss_medications && in_array('other', $contentData->weight_loss_medications)) : ?><i class="fa fa-check"></i><?php endif; ?>
+            <span class="mr-2">Other</span>
+            <?= @$contentData->weight_loss_medications_other ?>
+        </div>
+        <p class="font-weight-bold font=size-14">WEIGHT LOSS STRATEGIES</p>
+        <div class="font-weight-bold mb-2">Have you tried any of the following alternative therapies or programs? <i>Check all that apply. If other, please list.</i></div>
+        <div class="d-flex flex-wrap">
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_strategies && in_array('Acupuncture', $contentData->weight_loss_strategies)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Acupuncture</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_strategies && in_array('Acupressure', $contentData->weight_loss_strategies)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Acupressure</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_strategies && in_array('Nutritionist/Registered Dietitian', $contentData->weight_loss_strategies)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Nutritionist/Registered Dietitian</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_strategies && in_array('Residential Programs', $contentData->weight_loss_strategies)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Residential Programs</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_strategies && in_array('Hypnosis', $contentData->weight_loss_strategies)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Hypnosis</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_strategies && in_array('Physical Activity/Exercises', $contentData->weight_loss_strategies)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Physical Activity/Exercises</span>
+            </div>
+        </div>
+        <div class="d-flex align-items-center mt-1 mb-3">
+            <?php if (@$contentData->weight_loss_strategies && in_array('other', $contentData->weight_loss_strategies)) : ?><i class="fa fa-check"></i><?php endif; ?>
+            <span class="mr-2">Other</span>
+            <?= @$contentData->weight_loss_strategies_other ?>
+        </div>
+        <div class="font-weight-bold mb-2">Which commercial or fad diets have you tried in the past? <i>Check all that apply. If other, please list.</i></div>
+        <div class="d-flex flex-wrap">
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Atkins Diet', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Atkins Diet</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Calorie Counting', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Calorie Counting</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('CHIP', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>CHIP</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('DASH', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>DASH</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Elimination Diet (Allergy)', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Elimination Diet (Allergy)</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Gluten Free', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Gluten Free</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Jenny Craig', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Jenny Craig</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Low Carb', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Low Carb</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Low Fat', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Low Fat</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Mediterranean Diet', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Mediterranean Diet</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Paleo', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Paleo</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Slim Fast/Meal', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Slim Fast/Meal</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('South Beach', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>South Beach</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Vegan', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Vegan</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Vegetarian', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Vegetarian</span>
+            </div>
+            <div class="d-inline-flex width-300px align-items-baseline">
+                <?php if (@$contentData->weight_loss_fad_diets && in_array('Weight Watchers', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+                <span>Weight Watchers</span>
+            </div>
+        </div>
+        <div class="d-flex align-items-center mt-1 mb-3">
+            <?php if (@$contentData->weight_loss_fad_diets && in_array('other', $contentData->weight_loss_fad_diets)) : ?><i class="fa fa-check"></i><?php endif; ?>
+            <span class="mr-2">Other</span>
+            <?= @$contentData->weight_loss_fad_diets_other ?>
+        </div>
+    </div>
+
+<?php
+} else {
+    echo '<div class="text-secondary">-</div>';
+}
+?>
+

+ 427 - 0
resources/views/app/patient/modules/lifestyle_physical_activity/edit.blade.php

@@ -0,0 +1,427 @@
+<?php
+use App\Models\Client;
+use App\Models\Note;
+use App\Models\Point;
+/** @var Client $patient */
+/** @var Note $note */
+/** @var Point $point */
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'LIFESTYLE_PHYSICAL_ACTIVITY', $sessionKey);
+
+$contentData = [
+    "total_exercise" => 0,
+    "days_exercise" => "",
+    "min_exercise" => "",
+    "completing_activities_difficult" => "",
+    "completing_activities_difficult_yes" => "",
+    "health_problems" => [],
+    "activities_done" => "",
+    "exercise_motivation" => [],
+    "barriers_exercise" => [],
+    "injuries_difficult" => "",
+    "injuries_difficult_yes" => "",
+    "bone_problems" => "",
+    "bone_problems_yes" => "",
+    "breathing_problems" => "",
+    "breathing_problems_yes" => "",
+    "balance_problems" => "",
+    "balance_problems_yes" => ""
+];
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $point->lastChildReview->data;
+}
+?>
+<div class="p-3 mcp-theme-1">
+
+    <div visit-moe close-on-save close-on-cancel class="d-block">
+        <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
+            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="segmentUid" value="<?= $note->coreSegment->uid ?>">
+            <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
+            <div id="edit-univ_sub_physical_activity_assessment-container">
+
+                @include('app.patient.modules._undo_changes', compact('point'))
+
+                <p class="font-weight-bold my-3 font-size-14"><i>Exercise</i></p>
+                <p><b>EXERCISE HABITS: AEROBIC/CARDIO TRAINING</b></p>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-8">
+                                During the average week, how many <b>days</b> do you exercise at a moderate to strenuous intensity (i.e. brisk walking or enough to break a light sweat)?
+                            </div>
+                            <div class="col-4">
+                                <div class="d-flex">
+                                    <input type="number" @change="calculateTotal" min="1" max="7" class="form-control mr-1 form-control-sm width-200px" v-model="data.days_exercise" value="">days
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-8">
+                                During an average session, how many <b>minutes</b> do you exercise at a moderate to strenuous intensity (i.e. brisk walking or enough movement to break a light sweat)?
+                            </div>
+                            <div class="col-4">
+                                <div class="d-flex">
+                                    <input type="number" @change="calculateTotal" min="1" class="form-control mr-1 form-control-sm width-200px" v-model="data.min_exercise" value="">min
+                                </div>
+                                <span><b>@{{data.total_exercise}}</b> Total min/week (days x min)</span>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-8">
+                                List types of activities you do (i.e. weightlifting, Pilates, kettle ball, resistance machines, exercise bands, etc.):
+                            </div>
+                            <div class="col-4">
+                                <input type="text" class="form-control form-control-sm width-200px" v-model="data.activities_done" value="">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="row mb-3">
+                    <div class="col-6">
+                        <p><b>What MOTIVATES you or would motivate you to exercise?</b> <em>Check top three</em></p>
+                        <table class="table table-sm table-striped table-bordered m-0">
+                            <tbody>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Nothing would motivate me"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Nothing would motivate me</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Control Blood glucose"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Control Blood glucose</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Decrease stress"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Decrease stress</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Increase self-esteem"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Increase self-esteem</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Family or partner"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Family or partner</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Body Image"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Body Image</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Prevent heart disease"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Prevent heart disease</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Improve mood"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Improve mood</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Increase Energy"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Increase Energy</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Prevent Bone loss"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Prevent Bone loss</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Weight reduction"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Weight reduction</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Reduce blood pressure"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Reduce blood pressure</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Improve sleep"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Improve sleep</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.exercise_motivation" value="Other"></td>
+                                <td class="text-nowrap align-middle">Other</td>
+                                <td class="p-0">
+                                    <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" type="text" v-model="data.exercise_motivation_other">
+                                </td>
+                            </tr>
+                            </tbody>
+                        </table>
+                    </div>
+                    <div class="col-6">
+                        <p><b>Are there any BARRIERS or PROBLEMS that limit exercise?</b> <em>Check all that apply</em></p>
+                        <table class="table table-sm table-striped table-bordered m-0">
+                            <tbody>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.barriers_exercise" value="No barriers"></td>
+                                <td class="text-nowrap align-middle" colspan="2">No barriers</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.barriers_exercise" value="Life Transition Period"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Life Transition Period </td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.barriers_exercise" value="Family Responsibility"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Family Responsibility</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.barriers_exercise" value="Depression"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Depression </td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.barriers_exercise" value="Time"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Time</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.barriers_exercise" value="Apparel"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Apparel</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.barriers_exercise" value="Work Responsibility"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Work Responsibility </td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.barriers_exercise" value="Fear"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Fear</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.barriers_exercise" value="Energy"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Energy</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.barriers_exercise" value="Cost"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Cost</td>
+                            </tr>
+                            <tr>
+                                <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.barriers_exercise" value="Other"></td>
+                                <td class="text-nowrap align-middle" colspan="2">Other</td>
+                            </tr>
+                            </tbody>
+                        </table>
+                    </div>
+                </div>
+
+                <p><b>EXERCISE SAFETY</b></p>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you have any injuries that would make it difficult to exercise?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.injuries_difficult">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                                <label v-if="data.injuries_difficult == 'Yes'" class="mt-2">If yes, please explain:</label>
+                                <input type="text" class="form-control form-control-sm width-200px" v-if="data.injuries_difficult == 'Yes'" v-model="data.injuries_difficult_yes" value="">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you have any joint, muscle, or bone problems that might get worse with exercise?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.bone_problems">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                                <label v-if="data.bone_problems == 'Yes'" class="mt-2">If yes, please explain:</label>
+                                <input type="text" class="form-control form-control-sm width-200px" v-if="data.bone_problems == 'Yes'" v-model="data.bone_problems_yes" value="">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you have any breathing problems while exercising?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.breathing_problems">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                                <label v-if="data.breathing_problems == 'Yes'" class="mt-2">If yes, please explain:</label>
+                                <input type="text" class="form-control form-control-sm width-200px" v-if="data.breathing_problems == 'Yes'" v-model="data.breathing_problems_yes" value="">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you have any balance problems or have had a fall in the last 6 months?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.balance_problems">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                                <label v-if="data.balance_problems == 'Yes'" class="mt-2">If yes, please explain:</label>
+                                <input type="text" class="form-control form-control-sm width-200px" v-if="data.balance_problems == 'Yes'" v-model="data.balance_problems_yes" value="">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you have any difficulty completing your activities of daily living (i.e. showering, dressing, toileting)?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.completing_activities_difficult">
+                                    <option value="No">No</option>
+                                    <option value="Yes">Yes</option>
+                                </select>
+                                <label v-if="data.completing_activities_difficult == 'Yes'" class="mt-2">If yes, please explain:</label>
+                                <input type="text" class="form-control form-control-sm width-200px" v-if="data.completing_activities_difficult == 'Yes'" v-model="data.completing_activities_difficult_yes" value="">
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <p><b>Do you have any of the following health problems? Check all that apply</b></p>
+                <table class="table table-sm table-striped table-bordered m-0">
+                    <tbody>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.health_problems" value="Arrhythmia or irregular heartbeat"></td>
+                        <td class="text-nowrap align-middle" colspan="2">Arrhythmia or irregular heartbeat </td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.health_problems" value="Arthritis or significant joint pain"></td>
+                        <td class="text-nowrap align-middle" colspan="2">Arthritis or significant joint pain </td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.health_problems" value="Chest pain/angina"></td>
+                        <td class="text-nowrap align-middle" colspan="2">Chest pain/angina</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.health_problems" value="Uncontrolled diabetes"></td>
+                        <td class="text-nowrap align-middle" colspan="2">Uncontrolled diabetes</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.health_problems" value="Severe or uncontrolled heart failure"></td>
+                        <td class="text-nowrap align-middle" colspan="2">Severe or uncontrolled heart failure</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.health_problems" value="Uncontrolled asthma"></td>
+                        <td class="text-nowrap align-middle" colspan="2">Uncontrolled asthma</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.health_problems" value="Recent heart attack"></td>
+                        <td class="text-nowrap align-middle" colspan="2">Recent heart attack</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.health_problems" value="Chronic or unusual fatigue/tiredness"></td>
+                        <td class="text-nowrap align-middle" colspan="2">Chronic or unusual fatigue/tiredness </td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.health_problems" value="Difficulty breathing with activity"></td>
+                        <td class="text-nowrap align-middle" colspan="2">Difficulty breathing with activity</td>
+                    </tr>
+                    <tr>
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.health_problems" value="Other"></td>
+                        <td class="text-nowrap align-middle" colspan="2">Other</td>
+                    </tr>
+                    </tbody>
+                </table>
+
+                <div class="mt-3 pt-3 border-top text-center">
+                    <button type="button" v-on:click.prevent="saveForm()" class="btn btn-sm btn-primary mr-2">Submit</button>
+                    <button type="button" onclick="closeStagPopup()" class="btn btn-sm btn-default border">Cancel</button>
+                </div>
+
+            </div>
+
+            <div class="d-none">
+                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+</div>
+<script>
+    (function() {
+        function init() {
+
+            runMCInitializer('hide-moes');
+            // any JS can come here
+            // will be run on page-load as well as whenever this segment is refreshed
+            new Vue({
+                el: '#edit-univ_sub_physical_activity_assessment-container',
+                delimiters: ["@{{","}}"],
+                data: {
+                    data: <?= json_encode($contentData) ?>
+                },
+                watch: {
+                    $data: {
+                        handler: function(val, oldVal) {
+                            let parent = $('#edit-univ_sub_physical_activity_assessment-container').closest('form');
+                            parent.find('[name="data"]').val(JSON.stringify(this.data));
+
+                            // autosave on change
+                            autoSaveSegment(parent.find('[submit]').first());
+                        },
+                        deep: true
+                    }
+                },
+                methods: {
+                    calculateTotal: function() {
+                        var days = !isNaN(parseInt(this.data.days_exercise)) ? parseInt(this.data.days_exercise) : 0;
+                        var min = !isNaN(parseInt(this.data.min_exercise)) ? parseInt(this.data.min_exercise) : 0;
+                        this.data.total_exercise = days * min;
+                    },
+                    saveForm: function() {
+                        let parent = $('#edit-univ_sub_physical_activity_assessment-container').closest('form');
+                        parent.find('[name="data"]').val(JSON.stringify(this.data));
+                        autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
+                    }
+                }
+            });
+        }
+
+        window.segmentInitializers.lifestyle_physical_activity = init;
+
+        addMCInitializer('edit-univ_sub_physical_activity_assessment-container-{{$note->id}}', init, '#edit-univ_sub_physical_activity_assessment-container');
+
+    })();
+</script>

+ 455 - 0
resources/views/app/patient/modules/lifestyle_physical_activity/summary.blade.php

@@ -0,0 +1,455 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+$point = Point::getGlobalSingletonOfCategory($patient, 'LIFESTYLE_PHYSICAL_ACTIVITY', false);
+
+if ($point && @$point->data) {
+    $contentData = $point->data;
+?>
+
+<div id="v2_physical_assessment_Section" class="mt-3">
+
+    <p class="font-weight-bold my-3 font-size-14"><i>Exercise</i></p>
+    <p><b>EXERCISE HABITS: AEROBIC/CARDIO TRAINING</b></p>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-8">
+                    During the average week, how many <b>days</b> do you exercise at a moderate to strenuous
+                    intensity
+                    (i.e. brisk walking or enough to break a light sweat)?
+                </div>
+                <div class="col-4">
+                    <div class="d-flex">
+                        <?= @$contentData->days_exercise ?> days
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-8">
+                    During an average session, how many <b>minutes</b> do you exercise at a moderate to
+                    strenuous
+                    intensity (i.e. brisk walking or enough movement to break a light sweat)?
+                </div>
+                <div class="col-4">
+                    <div class="d-flex">
+                        <?= @$contentData->min_exercise ?> mins
+                    </div>
+                    <span><b><?= @$contentData->total_exercise ?></b> Total min/week (days x min)</span>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-8">
+                    List types of activities you do (i.e. weightlifting, Pilates, kettle ball, resistance
+                    machines,
+                    exercise bands, etc.):
+                </div>
+                <div class="col-4">
+                    <?= @$contentData->activities_done ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="row mb-3">
+        <div class="col-6">
+            <p><b>What MOTIVATES you or would motivate you to exercise?</b> <em>Check top three</em></p>
+            <table class="table table-sm table-striped table-bordered m-0">
+                <tbody>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Nothing would motivate me', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Nothing would motivate me</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Control Blood glucose', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Control Blood glucose</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Decrease stress', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Decrease stress</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Increase self-esteem', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Increase self-esteem</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Family or partner', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Family or partner</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Body Image', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Body Image</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Prevent heart disease', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Prevent heart disease</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Improve mood', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Improve mood</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Increase Energy', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Increase Energy</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Prevent Bone loss', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Prevent Bone loss</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Weight reduction', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Weight reduction</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Reduce blood pressure', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Reduce blood pressure</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Improve sleep', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Improve sleep</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->exercise_motivation && in_array('Other', $contentData->exercise_motivation)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle">Other</td>
+                    <td class="p-0">
+                        <?= @$contentData->exercise_motivation_other ?>
+                    </td>
+                </tr>
+                </tbody>
+            </table>
+        </div>
+        <div class="col-6">
+            <p><b>Are there any BARRIERS or PROBLEMS that limit exercise?</b> <em>Check all that apply</em></p>
+            <table class="table table-sm table-striped table-bordered m-0">
+                <tbody>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->barriers_exercise && in_array('No barriers', $contentData->barriers_exercise)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">No barriers</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->barriers_exercise && in_array('Life Transition Period', $contentData->barriers_exercise)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Life Transition Period</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->barriers_exercise && in_array('Family Responsibility', $contentData->barriers_exercise)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Family Responsibility</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->barriers_exercise && in_array('Depression', $contentData->barriers_exercise)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Depression</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->barriers_exercise && in_array('Time', $contentData->barriers_exercise)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Time</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->barriers_exercise && in_array('Apparel', $contentData->barriers_exercise)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Apparel</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->barriers_exercise && in_array('Work Responsibility', $contentData->barriers_exercise)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Work Responsibility</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->barriers_exercise && in_array('Fear', $contentData->barriers_exercise)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Fear</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->barriers_exercise && in_array('Energy', $contentData->barriers_exercise)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Energy</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->barriers_exercise && in_array('Cost', $contentData->barriers_exercise)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Cost</td>
+                </tr>
+                <tr>
+                    <td class="text-nowrap align-middle width-40px text-center">
+                        <?php if (@$contentData->barriers_exercise && in_array('Other', $contentData->barriers_exercise)): ?>
+                        <i class="fa fa-check"></i>
+                        <?php endif; ?>
+                    </td>
+                    <td class="text-nowrap align-middle" colspan="2">Other</td>
+                </tr>
+                </tbody>
+            </table>
+        </div>
+    </div>
+
+    <p><b>EXERCISE SAFETY</b></p>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Do you have any injuries that would make it difficult to exercise?
+                </div>
+                <div class="col-6">
+                    <b><?= @$contentData->injuries_difficult ?></b>
+                    <div><?= @$contentData->injuries_difficult_yes ?></div>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Do you have any joint, muscle, or bone problems that might get worse with exercise?
+                </div>
+                <div class="col-6">
+                    <b><?= @$contentData->bone_problems ?></b>
+                    <div><?= @$contentData->bone_problems_yes ?></div>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Do you have any breathing problems while exercising?
+                </div>
+                <div class="col-6">
+                    <b><?= @$contentData->breathing_problems ?></b>
+                    <div><?= @$contentData->breathing_problems_yes ?></div>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Do you have any balance problems or have had a fall in the last 6 months?
+                </div>
+                <div class="col-6">
+                    <b><?= @$contentData->balance_problems ?></b>
+                    <div><?= @$contentData->balance_problems_yes ?></div>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Do you have any difficulty completing your activities of daily living (i.e. showering,
+                    dressing,
+                    toileting)?
+                </div>
+                <div class="col-6">
+                    <b><?= @$contentData->completing_activities_difficult ?></b>
+                    <div><?= @$contentData->completing_activities_difficult_yes ?></div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <p><b>Do you have any of the following health problems? Check all that apply</b></p>
+    <table class="table table-sm table-striped table-bordered m-0">
+        <tbody>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->health_problems && in_array('Arrhythmia or irregular heartbeat', $contentData->health_problems)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?>
+            </td>
+            <td class="text-nowrap align-middle" colspan="2">Arrhythmia or irregular heartbeat</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->health_problems && in_array('Arthritis or significant joint pain', $contentData->health_problems)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?>
+            </td>
+            <td class="text-nowrap align-middle" colspan="2">Arthritis or significant joint pain</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->health_problems && in_array('Chest pain/angina', $contentData->health_problems)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?>
+            </td>
+            <td class="text-nowrap align-middle" colspan="2">Chest pain/angina</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->health_problems && in_array('Uncontrolled diabetes', $contentData->health_problems)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?>
+            </td>
+            <td class="text-nowrap align-middle" colspan="2">Uncontrolled diabetes</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->health_problems && in_array('Severe or uncontrolled heart failure', $contentData->health_problems)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?>
+            </td>
+            <td class="text-nowrap align-middle" colspan="2">Severe or uncontrolled heart failure</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->health_problems && in_array('Uncontrolled asthma', $contentData->health_problems)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?>
+            </td>
+            <td class="text-nowrap align-middle" colspan="2">Uncontrolled asthma</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->health_problems && in_array('Recent heart attack', $contentData->health_problems)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?>
+            </td>
+            <td class="text-nowrap align-middle" colspan="2">Recent heart attack</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->health_problems && in_array('Chronic or unusual fatigue/tiredness', $contentData->health_problems)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?>
+            </td>
+            <td class="text-nowrap align-middle" colspan="2">Chronic or unusual fatigue/tiredness</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->health_problems && in_array('Difficulty breathing with activity', $contentData->health_problems)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?>
+            </td>
+            <td class="text-nowrap align-middle" colspan="2">Difficulty breathing with activity</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->health_problems && in_array('Other', $contentData->health_problems)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?>
+            </td>
+            <td class="text-nowrap align-middle" colspan="2">Other</td>
+        </tr>
+        </tbody>
+    </table>
+</div>
+
+<?php
+} else {
+    echo '<div class="text-secondary">-</div>';
+}
+?>
+

+ 823 - 0
resources/views/app/patient/modules/lifestyle_sleep/edit.blade.php

@@ -0,0 +1,823 @@
+<?php
+use App\Models\Client;
+use App\Models\Note;
+use App\Models\Point;
+/** @var Client $patient */
+/** @var Note $note */
+/** @var Point $point */
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'LIFESTYLE_SLEEP', $sessionKey);
+
+// replace content data
+$contentData = [
+    "current_overall_health_level" => '',
+    "sleep" => '',
+    "weight_management" => '',
+    "nutrition" => '',
+    "exercise" => '',
+    "purpose_and_connection" => '',
+    "mental_health" => '',
+    "substance_use" => '',
+    "how_important_rank_1_area" => '',
+    "how_confident_rank_1_area" => '',
+    "how_important_rank_2_area" => '',
+    "how_confident_rank_2_area" => '',
+    "how_important_rank_3_area" => '',
+    "how_confident_rank_3_area" => '',
+    "visit_gains" => [],
+    "gain_other_description" => '',
+    "sleep_difficulty_staying_awake_routine_tasks" => '',
+    "sleep_difficulty_staying_awake_driving" => '',
+    "sleep_need_to_nap_during_the_day" => '',
+    "sleep_taken_you_more_than_30_mins_to_sleep" => '',
+    "sleep_woken_up_at_night" => '',
+    "sleep_unintentionally_woken_up_in_morning" => '',
+    "sleep_look_at_screen_within_2_hours_of_sleep" => '',
+    "sleep_legs_or_arms_jerked_during_sleep" => '',
+    "sleep_experienced_creeping_crawling_in_legs" => '',
+    "sleep_snored_loudly_gasped_choked_during_sleep" => '',
+    "sleep_used_sleeping_aids_to_sleep" => '',
+    "sleep_have_a_job_that_requires_shifts" => '',
+    "sleep_have_medical_condition_affecting_sleep" => '',
+    "sleep_do_you_get_at_least_7_8_hours_sleep_weekday" => '',
+    "sleep_do_you_get_at_least_7_8_hours_sleep_weekend" => ''
+];
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $point->lastChildReview->data;
+}
+?>
+<div class="p-3 mcp-theme-1">
+
+    <div visit-moe close-on-save close-on-cancel class="d-block">
+        <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
+            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="segmentUid" value="<?= $note->coreSegment->uid ?>">
+            <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
+            <div id="edit-univ_sub_sleep_assessment-container">
+
+                @include('app.patient.modules._undo_changes', compact('point'))
+
+                <div class="row">
+                    <div class="col-md-12">
+                        <h5 class="bg-light p-1 font-weight-bold">GETTING STARTED</h5>
+                    </div>
+                </div>
+
+                <div class="row">
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        Please circle your current overall <b>LEVEL OF HEALTH</b>
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.current_overall_health_level">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                            <div class="flex-grow-1">
+                                <div class="row mb-2">
+                                    <div class="col-12">
+                                        Please rank the top <b>3 areas</b> you would like to improve with 1 being the most important and
+                                        3 the least important
+                                    </div>
+                                </div>
+                                <table class="table table-sm width-300px table-striped table-bordered m-0">
+                                    <tbody>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Sleep</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.sleep">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Weight Management</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.weight_management">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Nutrition</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.nutrition">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Exercise</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.exercise">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Purpose &amp; Connection</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.purpose_and_connection">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Mental Health</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.mental_health">
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <td class="text-nowrap align-middle">Substance Use</td>
+                                        <td class="p-0">
+                                            <input class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none"
+                                                   type="number" min="1" max="3" v-model="data.substance_use">
+                                        </td>
+                                    </tr>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                                        the <b>#1</b> most motivated topic area to address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_important_rank_1_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>CONFIDENT</b> are you regarding your ability to make the
+                                        change you ranked as the <b>#1</b> most motivated topic area to
+                                        address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_confident_rank_1_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                                        the <b>#2</b> most motivated topic area to address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_important_rank_2_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>CONFIDENT</b> are you regarding your ability to make the
+                                        change you ranked as the <b>#2</b> most motivated topic area to
+                                        address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_confident_rank_2_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                                        the <b>#3</b> most motivated topic area to address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_important_rank_3_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How <b>CONFIDENT</b> are you regarding your ability to make the
+                                        change you ranked as the <b>#3</b> most motivated topic area to
+                                        address?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.how_confident_rank_3_area">
+                                            <option value="0">0 - Very poor health</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5</option>
+                                            <option value="6">6</option>
+                                            <option value="7">7</option>
+                                            <option value="8">8</option>
+                                            <option value="9">9</option>
+                                            <option value="10">10 - Excellent health</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-12">
+                                        <div>
+                                            <b>What would you like to gain from this lifestyle visit?</b> Check all that apply
+                                        </div>
+                                        <div>
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox" id="more_medical_scientific_knowledge"
+                                                       name="visit_gains" value="more_medical_scientific_knowledge" v-model="data.visit_gains">
+                                                <label class="form-check-label" for="more_medical_scientific_knowledge">More medical/scientific
+                                                    knowledge</label>
+                                            </div>
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox"
+                                                       name="visit_gains" value="practical_health_tips" v-model="data.visit_gains">
+                                                <label class="form-check-label" for="practical_health_tips">Practical health tips</label>
+                                            </div>
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox" name="visit_gains"
+                                                       value="accountability" v-model="data.visit_gains">
+                                                <label class="form-check-label" for="accountability">Accountability</label>
+                                            </div>
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox"
+                                                       name="visit_gains" value="personalized_plan" v-model="data.visit_gains">
+                                                <label class="form-check-label" for="personalized_plan">Personalized Plan</label>
+                                            </div>
+                                            <div class="form-check form-check-inline">
+                                                <input class="form-check-input" type="checkbox" name="visit_gains" value="other"
+                                                       v-model="data.visit_gains">
+                                                <label class="form-check-label" for="other">Other</label>
+                                            </div>
+
+                                            <div v-if="data.visit_gains.indexOf('other') !== -1" class="form-group mt-3">
+                                                <label>Other</label>
+                                                <input type="text" class="form-control" name="gain_other_description"
+                                                       v-model="data.gain_other_description" />
+                                            </div>
+
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                </div>
+
+                <hr>
+
+                <div class="row">
+                    <div class="col-md-12">
+                        <h5 class="bg-light p-1 font-weight-bold">SLEEP</h5>
+                        <p><b>Please answer based on your sleeping patterns OVER the LAST TWO WEEKS</b></p>
+                    </div>
+                </div>
+
+                <div class="row mb-1">
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How often have you had difficulty staying awake during routine tasks?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_difficulty_staying_awake_routine_tasks">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How often have you had difficulty staying awake while driving?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_difficulty_staying_awake_driving">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How often have you felt fatigued or needed to nap during the day?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_need_to_nap_during_the_day">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How often has it taken you more than 30 minutes to fall asleep at night?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_taken_you_more_than_30_mins_to_sleep">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How often have you woken up at night?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.sleep_woken_up_at_night">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How often have you unintentionally woken up early in the morning?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_unintentionally_woken_up_in_morning">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How often do you look at a screen within 2 hours of sleeping (i.e. TV, computer, iPad, or Phone)?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_look_at_screen_within_2_hours_of_sleep">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How often have your legs or arms jerked during sleep?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_legs_or_arms_jerked_during_sleep">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How often have you experienced “creeping” or “crawling” feelings in your legs?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_experienced_creeping_crawling_in_legs">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">j.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How often have you snored loudly, gasped, choked, or stopped breathing during sleep?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_snored_loudly_gasped_choked_during_sleep">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">k.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        How often have you used sleeping aids (i.e. tobacco, alcohol, over-the-counter medications, or
+                                        prescription medications) to help you fall asleep?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_used_sleeping_aids_to_sleep">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">l.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        Do you have a job that requires night shifts?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_have_a_job_that_requires_shifts">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">m.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        Do you have a medical condition or chronic pain that interferes with your sleep?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_have_medical_condition_affecting_sleep">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">n.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        On an average weekday do you get at least 7-8 hours of sleep in a 24-hour period?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_do_you_get_at_least_7_8_hours_sleep_weekday">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">o.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        On an average weekend do you get at least 7-8 hours of sleep in a 24-hour period?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.sleep_do_you_get_at_least_7_8_hours_sleep_weekend">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+
+                </div>
+
+                <div class="mt-3 pt-3 border-top text-center">
+                    <button type="button" v-on:click.prevent="saveForm()" class="btn btn-sm btn-primary mr-2">Submit</button>
+                    <button type="button" onclick="closeStagPopup()" class="btn btn-sm btn-default border">Cancel</button>
+                </div>
+
+            </div>
+
+            <div class="d-none">
+                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+</div>
+<script>
+    (function() {
+        function init() {
+
+            runMCInitializer('hide-moes');
+            // any JS can come here
+            // will be run on page-load as well as whenever this segment is refreshed
+            new Vue({
+                el: '#edit-univ_sub_sleep_assessment-container',
+                delimiters: ["@{{","}}"],
+                data: {
+                    data: <?= json_encode($contentData) ?>
+                },
+                watch: {
+                    $data: {
+                        handler: function(val, oldVal) {
+                            let parent = $('#edit-univ_sub_sleep_assessment-container').closest('form');
+                            parent.find('[name="data"]').val(JSON.stringify(this.data));
+
+                            // autosave on change
+                            autoSaveSegment(parent.find('[submit]').first());
+                        },
+                        deep: true
+                    }
+                },
+                methods: {
+                    saveForm: function() {
+                        let parent = $('#edit-univ_sub_sleep_assessment-container').closest('form');
+                        parent.find('[name="data"]').val(JSON.stringify(this.data));
+                        autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
+                    }
+                }
+            });
+        }
+
+        window.segmentInitializers.lifestyle_sleep = init;
+
+        addMCInitializer('edit-univ_sub_sleep_assessment-container-{{$note->id}}', init, '#edit-univ_sub_sleep_assessment-container');
+
+    })();
+</script>

+ 534 - 0
resources/views/app/patient/modules/lifestyle_sleep/summary.blade.php

@@ -0,0 +1,534 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+$point = Point::getGlobalSingletonOfCategory($patient, 'LIFESTYLE_SLEEP', false);
+
+if ($point && @$point->data) {
+$contentData = $point->data;
+?>
+
+<div id="v2_sleep_assessment_section" class="mt-3">
+    <div class="row">
+        <div class="col-md-12">
+            <h5 class="bg-light p-1 font-weight-bold">GETTING STARTED</h5>
+        </div>
+    </div>
+
+    <div class="row">
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            Please circle your current overall <b>LEVEL OF HEALTH</b>
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->current_overall_health_level ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                <div class="flex-grow-1">
+                    <div class="row mb-2">
+                        <div class="col-12">
+                            Please rank the top <b>3 areas</b> you would like to improve with 1 being the most important and
+                            3 the least important
+                        </div>
+                    </div>
+                    <table class="table table-sm width-300px table-striped table-bordered m-0">
+                        <tbody>
+                        <tr>
+                            <td class="text-nowrap align-middle">Sleep</td>
+                            <td class="p-0">
+                                <?= @$contentData->sleep ?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="text-nowrap align-middle">Weight Management</td>
+                            <td class="p-0">
+                                <?= @$contentData->weight_management ?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="text-nowrap align-middle">Nutrition</td>
+                            <td class="p-0">
+                                <?= @$contentData->nutrition ?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="text-nowrap align-middle">Exercise</td>
+                            <td class="p-0">
+                                <?= @$contentData->exercise ?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="text-nowrap align-middle">Purpose &amp; Connection</td>
+                            <td class="p-0">
+                                <?= @$contentData->purpose_and_connection ?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="text-nowrap align-middle">Mental Health</td>
+                            <td class="p-0">
+                                <?= @$contentData->mental_health ?>
+                            </td>
+                        </tr>
+                        <tr>
+                            <td class="text-nowrap align-middle">Substance Use</td>
+                            <td class="p-0">
+                                <?= @$contentData->substance_use ?>
+                            </td>
+                        </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                            the <b>#1</b> most motivated topic area to address?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->how_important_rank_1_area ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How <b>CONFIDENT</b> are you regarding your ability to make the
+                            change you ranked as the <b>#1</b> most motivated topic area to
+                            address?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->how_confident_rank_1_area ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                            the <b>#2</b> most motivated topic area to address?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->how_important_rank_2_area ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How <b>CONFIDENT</b> are you regarding your ability to make the
+                            change you ranked as the <b>#2</b> most motivated topic area to
+                            address?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->how_confident_rank_2_area ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How <b>IMPORTANT</b> is it for you to make the change you ranked as
+                            the <b>#3</b> most motivated topic area to address?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->how_important_rank_3_area ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How <b>CONFIDENT</b> are you regarding your ability to make the
+                            change you ranked as the <b>#3</b> most motivated topic area to
+                            address?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->how_confident_rank_3_area ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-12">
+                            <div>
+                                <b>What would you like to gain from this lifestyle visit?</b> Check all that apply
+                            </div>
+                            <div>
+
+                                <div class="d-flex align-items-center">
+                    <span>
+                      <?php if (@$contentData->visit_gains && in_array('more_medical_scientific_knowledge', $contentData->visit_gains)) : ?>
+                          <i class="fa fa-check"></i>
+                      <?php endif; ?>
+                    </span>
+                                    <span class="ml-3">More medical/scientific knowledge</span>
+                                </div>
+
+                                <div class="d-flex align-items-center">
+                    <span>
+                      <?php if (@$contentData->visit_gains && in_array('practical_health_tips', $contentData->visit_gains)) : ?>
+                          <i class="fa fa-check"></i>
+                      <?php endif; ?>
+                    </span>
+                                    <span class="ml-3">Practical health tips</span>
+                                </div>
+
+                                <div class="d-flex align-items-center">
+                    <span>
+                      <?php if (@$contentData->visit_gains && in_array('accountability', $contentData->visit_gains)) : ?>
+                          <i class="fa fa-check"></i>
+                      <?php endif; ?>
+                    </span>
+                                    <span class="ml-3">Accountability</span>
+                                </div>
+
+                                <div class="d-flex align-items-center">
+                    <span>
+                      <?php if (@$contentData->visit_gains && in_array('personalized_plan', $contentData->visit_gains)) : ?>
+                          <i class="fa fa-check"></i>
+                      <?php endif; ?>
+                    </span>
+                                    <span class="ml-3">Personalized Plan</span>
+                                </div>
+
+                                <div class="d-flex align-items-center">
+                    <span>
+                      <?php if (@$contentData->visit_gains && in_array('other', $contentData->visit_gains)) : ?>
+                          <i class="fa fa-check"></i>
+                      <?php endif; ?>
+                    </span>
+                                    <span class="ml-3">Other</span>
+                                </div>
+
+                                <div class="form-group mt-3">
+                                    <label>Other</label>
+                                    <?= @$contentData->gain_other_description ?>
+                                </div>
+
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+    </div>
+
+    <hr>
+
+    <div class="row">
+        <div class="col-md-12">
+            <h5 class="bg-light p-1 font-weight-bold">SLEEP</h5>
+            <p><b>Please answer based on your sleeping patterns OVER the LAST TWO WEEKS</b></p>
+        </div>
+    </div>
+
+    <div class="row mb-1">
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How often have you had difficulty staying awake during routine tasks?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_difficulty_staying_awake_routine_tasks ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How often have you had difficulty staying awake while driving?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_difficulty_staying_awake_driving ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How often have you felt fatigued or needed to nap during the day?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_need_to_nap_during_the_day ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How often has it taken you more than 30 minutes to fall asleep at night?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_taken_you_more_than_30_mins_to_sleep ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How often have you woken up at night?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_woken_up_at_night ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How often have you unintentionally woken up early in the morning?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_unintentionally_woken_up_in_morning ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How often do you look at a screen within 2 hours of sleeping (i.e. TV, computer, iPad, or Phone)?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_look_at_screen_within_2_hours_of_sleep ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How often have your legs or arms jerked during sleep?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_legs_or_arms_jerked_during_sleep ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How often have you experienced “creeping” or “crawling” feelings in your legs?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_experienced_creeping_crawling_in_legs ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">j.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How often have you snored loudly, gasped, choked, or stopped breathing during sleep?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_snored_loudly_gasped_choked_during_sleep ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">k.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            How often have you used sleeping aids (i.e. tobacco, alcohol, over-the-counter medications, or
+                            prescription medications) to help you fall asleep?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_used_sleeping_aids_to_sleep ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">l.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            Do you have a job that requires night shifts?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_have_a_job_that_requires_shifts ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">m.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            Do you have a medical condition or chronic pain that interferes with your sleep?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_have_medical_condition_affecting_sleep ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">n.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            On an average weekday do you get at least 7-8 hours of sleep in a 24-hour period?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_do_you_get_at_least_7_8_hours_sleep_weekday ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">o.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            On an average weekend do you get at least 7-8 hours of sleep in a 24-hour period?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->sleep_do_you_get_at_least_7_8_hours_sleep_weekend ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+    </div>
+</div>
+
+<?php
+} else {
+    echo '<div class="text-secondary">-</div>';
+}
+?>
+

+ 307 - 0
resources/views/app/patient/modules/lifestyle_social/edit.blade.php

@@ -0,0 +1,307 @@
+<?php
+use App\Models\Client;
+use App\Models\Note;
+use App\Models\Point;
+/** @var Client $patient */
+/** @var Note $note */
+/** @var Point $point */
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'LIFESTYLE_SOCIAL_RELATIONSHIPS', $sessionKey);
+
+// replace content data
+$contentData = [
+    "social_i_live_purposeful_life" => '',
+    "social_i_have_spiritual_community" => '',
+    "social_i_have_source_of_inner_strength" => '',
+    "social_i_am_satisfied_with_current_belief_system" => '',
+    "social_i_have_people_who_care" => '',
+    "social_i_have_people_who_accept_me_at_my_worst_and_best" => '',
+    "social_i_have_people_i_trust_at_home_or_work" => '',
+    "social_i_get_help_when_i_am_sick" => ''
+];
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $point->lastChildReview->data;
+}
+?>
+<div class="p-3 mcp-theme-1">
+
+    <div visit-moe close-on-save close-on-cancel class="d-block">
+        <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
+            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="segmentUid" value="<?= $note->coreSegment->uid ?>">
+            <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
+            <div id="edit-univ_sub_social_relationships_assessment-container">
+
+                @include('app.patient.modules._undo_changes', compact('point'))
+
+                <div class="row">
+                    <div class="col-md-12">
+                        <h5 class="bg-light p-1 font-weight-bold">PURPOSE AND CONNECTION</h5>
+                        <p><b>How often do you agree with the following:</b></p>
+                    </div>
+                </div>
+
+                <div class="row mb-1">
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        I live a purposeful and meaningful life
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm "
+                                                v-model="data.social_i_live_purposeful_life">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        I have a spiritual community that I can turn to in times of need
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm "
+                                                v-model="data.social_i_have_spiritual_community">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        I have a source of inner strength and meaning
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm "
+                                                v-model="data.social_i_have_source_of_inner_strength">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        I am satisfied with my current belief system
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm "
+                                                v-model="data.social_i_am_satisfied_with_current_belief_system">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        I have people who care about what happens to me
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm "
+                                                v-model="data.social_i_have_people_who_care">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        I have people who accept me at my worst and best
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm "
+                                                v-model="data.social_i_have_people_who_accept_me_at_my_worst_and_best">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        I have people I trust at home or work who I can talk to about my problems
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm "
+                                                v-model="data.social_i_have_people_i_trust_at_home_or_work">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        I get help when I’m sick
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm "
+                                                v-model="data.social_i_get_help_when_i_am_sick">
+                                            <option value="1">1 - Never</option>
+                                            <option value="2">2 - Seldom</option>
+                                            <option value="3">3 - Sometimes</option>
+                                            <option value="4">4 - Often</option>
+                                            <option value="5">5 - Always</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+
+
+                </div>
+
+                <div class="mt-3 pt-3 border-top text-center">
+                    <button type="button" v-on:click.prevent="saveForm()" class="btn btn-sm btn-primary mr-2">Submit</button>
+                    <button type="button" onclick="closeStagPopup()" class="btn btn-sm btn-default border">Cancel</button>
+                </div>
+
+            </div>
+
+            <div class="d-none">
+                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+</div>
+<script>
+    (function() {
+        function init() {
+
+            runMCInitializer('hide-moes');
+            // any JS can come here
+            // will be run on page-load as well as whenever this segment is refreshed
+            new Vue({
+                el: '#edit-univ_sub_social_relationships_assessment-container',
+                delimiters: ["@{{","}}"],
+                data: {
+                    data: <?= json_encode($contentData) ?>
+                },
+                watch: {
+                    $data: {
+                        handler: function(val, oldVal) {
+                            let parent = $('#edit-univ_sub_social_relationships_assessment-container').closest('form');
+                            parent.find('[name="data"]').val(JSON.stringify(this.data));
+
+                            // autosave on change
+                            autoSaveSegment(parent.find('[submit]').first());
+                        },
+                        deep: true
+                    }
+                },
+                methods: {
+                    saveForm: function() {
+                        let parent = $('#edit-univ_sub_social_relationships_assessment-container').closest('form');
+                        parent.find('[name="data"]').val(JSON.stringify(this.data));
+                        autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
+                    }
+                }
+            });
+        }
+
+        window.segmentInitializers.lifestyle_social = init;
+
+        addMCInitializer('edit-univ_sub_social_relationships_assessment-container-{{$note->id}}', init, '#edit-univ_sub_social_relationships_assessment-container');
+
+    })();
+</script>

+ 167 - 0
resources/views/app/patient/modules/lifestyle_social/summary.blade.php

@@ -0,0 +1,167 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+$point = Point::getGlobalSingletonOfCategory($patient, 'LIFESTYLE_SOCIAL_RELATIONSHIPS', false);
+
+if ($point && @$point->data) {
+$contentData = $point->data;
+?>
+
+<div id="v2_social_assessment_section" class="mt-3">
+
+    <div class="row">
+        <div class="col-md-12">
+            <h5 class="bg-light p-1 font-weight-bold">PURPOSE AND CONNECTION</h5>
+            <p><b>How often do you agree with the following:</b></p>
+        </div>
+    </div>
+
+    <div class="row mb-1">
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            I live a purposeful and meaningful life
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->social_i_live_purposeful_life ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            I have a spiritual community that I can turn to in times of need
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->social_i_have_spiritual_community ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            I have a source of inner strength and meaning
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->social_i_have_source_of_inner_strength ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            I am satisfied with my current belief system
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->social_i_am_satisfied_with_current_belief_system ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            I have people who care about what happens to me
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->social_i_have_people_who_care ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            I have people who accept me at my worst and best
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->social_i_have_people_who_accept_me_at_my_worst_and_best ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            I have people I trust at home or work who I can talk to about my problems
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->social_i_have_people_i_trust_at_home_or_work ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            I get help when I’m sick
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->social_i_get_help_when_i_am_sick ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+
+
+    </div>
+
+
+
+</div>
+
+<?php
+} else {
+    echo '<div class="text-secondary">-</div>';
+}
+?>
+

+ 712 - 0
resources/views/app/patient/modules/lifestyle_stress/edit.blade.php

@@ -0,0 +1,712 @@
+<?php
+use App\Models\Client;
+use App\Models\Note;
+use App\Models\Point;
+/** @var Client $patient */
+/** @var Note $note */
+/** @var Point $point */
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'LIFESTYLE_STRESS', $sessionKey);
+
+// replace content data
+$contentData = [
+    "uncontrollable_things_life" => "",
+    "lack_confidence" => "",
+    "things_not_going_well" => "",
+    "let_things_go_hard" => "",
+    "cope_stress" => [],
+    "extreme_stress_learn_from_experience" => "",
+    "extreme_stress_take_action" => "",
+    "extreme_stress_prioritize_importance" => "",
+    "extreme_stress_opportunity_to_grow" => "",
+    "extreme_stress_set_goals" => "",
+    "extreme_stress_ways_around_problem" => "",
+    "extreme_stress_motivated_to_pursue_goals" => "",
+    "extreme_stress_know_can_get_through_it" => "",
+    "body_connect_set_goals" => "",
+    "body_connect_feelings_affect" => "",
+    "body_connect_emotion_experience" => "",
+    "body_connect_tension_aware" => "",
+    "body_connect_angry" => "",
+    "body_connect_stress" => "",
+    "body_connect_emotion_react" => "",
+    "depression_little_interest" => "",
+    "depression_feeling_depressed" => "",
+    "depression_trouble_sleeping" => "",
+    "depression_feeling_tired" => "",
+    "depression_poor_appetite" => "",
+    "depression_feeling_bad_self" => "",
+    "depression_trouble_concentrating" => "",
+    "depression_moving_slow" => "",
+    "depression_hurting_self" => "",
+    "anxiety_feeling_nervous" => "",
+    "anxiety_uncontrollable_worry" => "",
+    "anxiety_worry_different_things" => "",
+    "anxiety_trouble_relaxing" => "",
+    "anxiety_restless" => "",
+    "anxiety_easily_annoyed" => ""
+];
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $point->lastChildReview->data;
+}
+?>
+<div class="p-3 mcp-theme-1">
+
+    <div visit-moe close-on-save close-on-cancel class="d-block">
+        <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
+            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="segmentUid" value="<?= $note->coreSegment->uid ?>">
+            <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
+            <div id="edit-univ_sub_stress_assessment-container">
+
+                @include('app.patient.modules._undo_changes', compact('point'))
+
+                <p class="font-weight-bold my-3 font-size-14"><i>Mental Health</i></p>
+                <p><b>PERCEIVED STRESS</b></p>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How often have you felt that you were unable to control the important things in your life?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.uncontrollable_things_life">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How often have you felt <b>lack of</b> confidence about your ability to handle your personal problems?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.lack_confidence">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How often have you felt that things were <b>not</b> going your way?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.things_not_going_well">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Have often have you found it hard to let go of things that upset you?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.let_things_go_hard">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <p><b>How do you COPE with stress? <em>Check all that apply</em></b></p>
+                <table class="table table-sm table-striped table-bordered m-0">
+                    <tbody>
+                    <tr v-for="cope in stress_cope">
+                        <td class="text-nowrap align-middle width-40px text-center"><input type="checkbox" class="m-0" v-model="data.cope_stress" :value="cope"></td>
+                        <td class="text-nowrap align-middle" colspan="2">@{{cope}}</td>
+                    </tr>
+                    </tbody>
+                </table>
+
+                <p class="mt-2"><b>RESILIENCE</b></p>
+                <p><b>When I am under extreme stress</b></p>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                I find a way to learn from my experience.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.extreme_stress_learn_from_experience">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                I find a way to take action.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.extreme_stress_take_action">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                I find it easy to prioritize what is important in my life.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.extreme_stress_prioritize_importance">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                I look at a stressful situation as an opportunity to grow.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.extreme_stress_opportunity_to_grow">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                I meet the goals I set for myself.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.extreme_stress_set_goals">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                I believe that there are a lot of ways around a problem.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.extreme_stress_ways_around_problem">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                I feel motivated to pursue my goals.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.extreme_stress_motivated_to_pursue_goals">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                I know I can get through it.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.extreme_stress_know_can_get_through_it">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <p class="mt-2"><b>MIND-BODY CONNECTION</b></p>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                I meet the goals I set for myself.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.body_connect_set_goals">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do thoughts or feelings affect your physical health?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.body_connect_feelings_affect">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Could you be experiencing some emotion and not be aware of it?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.body_connect_emotion_experience">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Are you aware of tension in your body?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.body_connect_tension_aware">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you notice how your body changes when angry?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.body_connect_angry">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you notice stress in your body?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.body_connect_stress">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you notice how your body reacts to emotions?
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.body_connect_emotion_react">
+                                    <option v-for="(opt, i) in options_a" :value="i+1">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <p class="mt-2"><b>DEPRESSION</b></p>
+                <p><b>Over the last 2 weeks, how often have you been bothered by the following?</b></p>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Little interest or pleasure in doing things.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.depression_little_interest">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Feeling down, depressed or hopeless.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.depression_feeling_depressed">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Trouble falling asleep, staying asleep, or sleeping too much.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.depression_trouble_sleeping">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Feeling tired or having little energy.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.depression_feeling_tired">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Poor appetite or overeating.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.depression_poor_appetite">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Feeling bad about yourself or that you’re a failure or have let yourself or your family down.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.depression_feeling_bad_self">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Trouble concentrating on things, such as reading the newspaper or watching television.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.depression_trouble_concentrating">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Moving or speaking so slowly that other people could have noticed. Or the opposite, being so fidgety or restless that you have been moving around a lot more than usual.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.depression_moving_slow">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Thoughts that you would be better off dead or of hurting yourself in some way.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.depression_hurting_self">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <p class="mt-2"><b>ANXIETY</b></p>
+                <p><b>Over the last 2 weeks, how often have you been bothered by the following?</b></p>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Feeling nervous, anxious, or on edge.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.anxiety_feeling_nervous">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Not being able to stop or control worrying.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.anxiety_uncontrollable_worry">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Worrying too much about different things.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.anxiety_worry_different_things">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Trouble relaxing.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.anxiety_trouble_relaxing">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Being so restless that it’s hard to sit still.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.anxiety_restless">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Becoming easily annoyed or irritable.
+                            </div>
+                            <div class="col-6">
+                                <select class="form-control form-control-sm width-200px" v-model="data.anxiety_easily_annoyed">
+                                    <option v-for="(opt, i) in options_b" :value="i">@{{opt}}</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="mt-3 pt-3 border-top text-center">
+                    <button type="button" v-on:click.prevent="saveForm()" class="btn btn-sm btn-primary mr-2">Submit</button>
+                    <button type="button" onclick="closeStagPopup()" class="btn btn-sm btn-default border">Cancel</button>
+                </div>
+
+            </div>
+
+            <div class="d-none">
+                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+</div>
+<script>
+    (function() {
+        function init() {
+
+            runMCInitializer('hide-moes');
+            // any JS can come here
+            // will be run on page-load as well as whenever this segment is refreshed
+            new Vue({
+                el: '#edit-univ_sub_stress_assessment-container',
+                delimiters: ["@{{","}}"],
+                data: {
+                    data: <?= json_encode($contentData) ?>,
+                    options_a: [
+                        "1 - Never",
+                        "2 - Seldom",
+                        "3 - Sometimes",
+                        "4 - Often",
+                        "5 - Always"
+                    ],
+                    options_b: [
+                        "0 - Not at all",
+                        "1 - Several days",
+                        "2 - Most days",
+                        "3 - Daily"
+                    ],
+                    stress_cope: [
+                        "Meditation",
+                        "Exercise/Physical Activity",
+                        "Counseling/Psychotherapy ",
+                        "Socializing with friends or",
+                        "family ",
+                        "Art",
+                        "Food (too much, too little) ",
+                        "Spirituality/Faith",
+                        "Sex",
+                        "Recreational drugs (i.e.",
+                        "marijuana, cocaine, etc.)",
+                        "Television and/or video games",
+                        "Gambling ",
+                        "Journaling",
+                        "Massage/Body work ",
+                        "Prayer",
+                        "Substance (tobacco, alcohol)",
+                        "Distraction",
+                        "Hurting yourself (i.e. cutting, etc.)",
+                        "Pet therapy",
+                        "Other"
+                    ]
+                },
+                watch: {
+                    $data: {
+                        handler: function(val, oldVal) {
+                            let parent = $('#edit-univ_sub_stress_assessment-container').closest('form');
+                            parent.find('[name="data"]').val(JSON.stringify(this.data));
+
+                            // autosave on change
+                            autoSaveSegment(parent.find('[submit]').first());
+                        },
+                        deep: true
+                    }
+                },
+                methods: {
+                    calculateTotal: function() {
+                        var days = !isNaN(parseInt(this.data.days_exercise)) ? parseInt(this.data.days_exercise) : 0;
+                        var min = !isNaN(parseInt(this.data.min_exercise)) ? parseInt(this.data.min_exercise) : 0;
+                        this.data.total_exercise = days * min;
+                    },
+                    saveForm: function() {
+                        let parent = $('#edit-univ_sub_stress_assessment-container').closest('form');
+                        parent.find('[name="data"]').val(JSON.stringify(this.data));
+                        autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
+                    }
+                }
+            });
+        }
+
+        window.segmentInitializers.lifestyle_stress = init;
+
+        addMCInitializer('edit-univ_sub_stress_assessment-container-{{$note->id}}', init, '#edit-univ_sub_stress_assessment-container');
+
+    })();
+</script>

+ 642 - 0
resources/views/app/patient/modules/lifestyle_stress/summary.blade.php

@@ -0,0 +1,642 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+$point = Point::getGlobalSingletonOfCategory($patient, 'LIFESTYLE_STRESS', false);
+
+if ($point && @$point->data) {
+$contentData = $point->data;
+?>
+
+<div id="v2_stress_assessment_Section" class="mt-3">
+    <p class="font-weight-bold my-3 font-size-14"><i>Mental Health</i></p>
+    <p><b>PERCEIVED STRESS</b></p>
+    <p>(1 = Never, 2 = Seldom, 3 = Sometimes, 4 = Often, 5 = Always)</p>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    How often have you felt that you were unable to control the important things in your life?
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->uncontrollable_things_life ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    How often have you felt <b>lack of</b> confidence about your ability to handle your personal problems?
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->lack_confidence ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    How often have you felt that things were <b>not</b> going your way?
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->things_not_going_well ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Have often have you found it hard to let go of things that upset you?
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->let_things_go_hard ?>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <p><b>How do you COPE with stress? <em>Check all that apply</em></b></p>
+    <table class="table table-sm table-striped table-bordered m-0">
+        <tbody>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Meditation', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Meditation</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Exercise/Physical Activity', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Exercise/Physical Activity</td>
+        </tr>
+        <tr>
+
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Counseling/Psychotherapy ', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Counseling/Psychotherapy </td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Socializing with friends or', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Socializing with friends or</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('family ', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Family </td>
+        </tr>
+        <tr>
+
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Art', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Art</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Food (too much, too little) ', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Food (too much, too little)</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Spirituality/Faith', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Spirituality/Faith</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Sex', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Sex</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Recreational drugs (i.e.', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Recreational drugs (i.e.</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('marijuana, cocaine, etc.)', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">marijuana, cocaine, etc.)</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Television and/or video games', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Television and/or video games</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Gambling ', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Gambling </td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Journaling', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Journaling</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Massage/Body work ', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Massage/Body work </td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Prayer', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Prayer</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Substance (tobacco, alcohol)', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Substance (tobacco, alcohol)</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Distraction', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?>&nbsp;</td>
+            <td class="text-nowrap align-middle" colspan="2">Distraction</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Hurting yourself (i.e. cutting, etc.)', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Hurting yourself (i.e. cutting, etc.)</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Pet therapy', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Pet therapy</td>
+        </tr>
+        <tr>
+            <td class="text-nowrap align-middle width-40px text-center">
+                <?php if (@$contentData->cope_stress && in_array('Other', $contentData->cope_stress)): ?>
+                <i class="fa fa-check"></i>
+                <?php endif; ?></td>
+            <td class="text-nowrap align-middle" colspan="2">Other</td>
+        </tr>
+        </tbody>
+    </table>
+
+    <p class="mt-2"><b>RESILIENCE</b></p>
+    <p><b>When I am under extreme stress</b></p>
+    <p>(1 = Never, 2 = Seldom, 3 = Sometimes, 4 = Often, 5 = Always)</p>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    I find a way to learn from my experience.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->extreme_stress_learn_from_experience ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    I find a way to take action.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->extreme_stress_take_action ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    I find it easy to prioritize what is important in my life.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->extreme_stress_prioritize_importance ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    I look at a stressful situation as an opportunity to grow.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->extreme_stress_opportunity_to_grow ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    I meet the goals I set for myself.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->extreme_stress_set_goals ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    I believe that there are a lot of ways around a problem.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->extreme_stress_ways_around_problem ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    I feel motivated to pursue my goals.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->extreme_stress_motivated_to_pursue_goals ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    I know I can get through it.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->extreme_stress_know_can_get_through_it ?>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <p class="mt-2"><b>MIND-BODY CONNECTION</b></p>
+    <p>(1 = Never, 2 = Seldom, 3 = Sometimes, 4 = Often, 5 = Always)</p>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    I meet the goals I set for myself.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->body_connect_set_goals ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Do thoughts or feelings affect your physical health?
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->body_connect_feelings_affect ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Could you be experiencing some emotion and not be aware of it?
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->body_connect_emotion_experience ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Are you aware of tension in your body?
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->body_connect_tension_aware ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Do you notice how your body changes when angry?
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->body_connect_angry ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Do you notice stress in your body?
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->body_connect_stress ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Do you notice how your body reacts to emotions?
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->body_connect_emotion_react ?>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <p class="mt-2"><b>DEPRESSION</b></p>
+    <p><b>Over the last 2 weeks, how often have you been bothered by the following?</b></p>
+    <p>
+        (0 = Not at all, 1 = Several days, 2 = Most days, 3 = Daily)
+    </p>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Little interest or pleasure in doing things.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->depression_little_interest ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Feeling down, depressed or hopeless.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->depression_feeling_depressed ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Trouble falling asleep, staying asleep, or sleeping too much.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->depression_trouble_sleeping ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Feeling tired or having little energy.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->depression_feeling_tired ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Poor appetite or overeating.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->depression_poor_appetite ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Feeling bad about yourself or that you’re a failure or have let yourself or your family down.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->depression_feeling_bad_self ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Trouble concentrating on things, such as reading the newspaper or watching television.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->depression_trouble_concentrating ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Moving or speaking so slowly that other people could have noticed. Or the opposite, being so fidgety or restless that you have been moving around a lot more than usual.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->depression_moving_slow ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Thoughts that you would be better off dead or of hurting yourself in some way.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->depression_hurting_self ?>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <p class="mt-2"><b>ANXIETY</b></p>
+    <p><b>Over the last 2 weeks, how often have you been bothered by the following?</b></p>
+    <p>
+        (0 = Not at all, 1 = Several days, 2 = Most days, 3 = Daily)
+    </p>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Feeling nervous, anxious, or on edge.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->anxiety_feeling_nervous ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Not being able to stop or control worrying.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->anxiety_uncontrollable_worry ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Worrying too much about different things.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->anxiety_worry_different_things ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Trouble relaxing.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->anxiety_trouble_relaxing ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Being so restless that it’s hard to sit still.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->anxiety_restless ?>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="d-flex align-items-baseline mb-3">
+        <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+        <div class="flex-grow-1">
+            <div class="row">
+                <div class="col-6">
+                    Becoming easily annoyed or irritable.
+                </div>
+                <div class="col-6">
+                    <?= @$contentData->anxiety_easily_annoyed ?>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+<?php
+} else {
+    echo '<div class="text-secondary">-</div>';
+}
+?>
+

+ 981 - 0
resources/views/app/patient/modules/lifestyle_substances/edit.blade.php

@@ -0,0 +1,981 @@
+<?php
+use App\Models\Client;
+use App\Models\Note;
+use App\Models\Point;
+/** @var Client $patient */
+/** @var Note $note */
+/** @var Point $point */
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'LIFESTYLE_SUBSTANCE_USE', $sessionKey);
+
+// replace content data
+$contentData = [
+    "nicotine_i_use_any_of_listed_items_above" => '',
+    "nicotine_do_you_want_to_quit_nicotine" => '',
+    "nicotine_how_soon_in_mins" => '',
+    "nicotine_how_many_cigarettes_per_day" => '',
+    "nicotine_age_started_smoking" => '',
+    "nicotine_longest_time_stayed_quit" => '',
+    "nicotine_why_started_smoking_again" => '',
+    "smokes_around_me" => [],
+    "nicotine_other_smoke_around_me_description" => '',
+    "nicotine_times_seriously_tried_to_quit" => '',
+    "nicotine_recent_quit_duration" => '',
+    "nicotine_who_is_supporting_you_to_quit" => '',
+    "nicotine_most_important_reason_to_quit" => '',
+    "nicotine_ever_used_medication_to_quit" => '',
+    "nicotine_medication_used" => [],
+    "nicotine_medication_used_other_description" => '',
+    "nicotine_medication_did_they_help" => '',
+    "nicotine_medication_list_helpful_ones" => '',
+    "nicotine_used_any_other_methods_to_quit" => '',
+    "nicotine_other_methods_used" => [],
+    "nicotine_other_methods_other_description" => '',
+    "alcohol_do_you_drink_alcohol" => '',
+    "alcohol_prefered_type_of_alcohol" => '',
+    "alcohol_how_many_servings_per_day" => '',
+    "alcohol_felt_like_cutting_down" => '',
+    "alcohol_have_people_criticized_you" => '',
+    "alcohol_felt_guilty" => '',
+    "alcohol_drank_in_morning_to_get_rid_of_hangover" => '',
+    "alcohol_do_you_binge_drink" => '',
+    "recreational_have_you_ever_used_any" => '',
+    "recreational_level_of_concern" => '',
+    "recreational_how_much_used" => '',
+    "marijuana_have_you_ever_used_marijuana" => '',
+    "marijuana_level_of_concern" => '',
+    "marijuana_how_much_used" => '',
+    "mental_health_ever_received_treatment" => '',
+    "drug_or_alcohol_have_you_ever_received_treatment" => ''
+];
+
+if ($point->lastChildReview && $point->lastChildReview->data) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $point->lastChildReview->data;
+}
+?>
+<div class="p-3 mcp-theme-1">
+
+    <div visit-moe close-on-save close-on-cancel class="d-block">
+        <form show url="/api/visitPoint/upsertChildReview" class="mcp-theme-1">
+            <input type="hidden" name="uid" value="<?= $point->uid ?>">
+            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+            <input type="hidden" name="segmentUid" value="<?= $note->coreSegment->uid ?>">
+            <input type="hidden" name="data" value="{{json_encode($contentData)}}">
+
+            <div id="edit-univ_sub_substance_use_assessment-container">
+
+                @include('app.patient.modules._undo_changes', compact('point'))
+
+                <div class="row">
+                    <div class="col-md-12">
+                        <h5 class="bg-light p-1 font-weight-bold">SMOKING AND SUBSTANCE HISTORY</h5>
+                        <p><b>NICOTINE/TOBACCO</b> (i.e. cigarettes, e-cigarettes, e-cigarettes/vaping, cigars, chew, snuff)</p>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        Do you use any of the nicotine products listed above?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.nicotine_i_use_any_of_listed_items_above">
+                                            <option value="No">No</option>
+                                            <option value="Yes">Yes</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <div v-if="data.nicotine_i_use_any_of_listed_items_above == 'Yes'" class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        If yes, do you want to quit using the nicotine/tobacco products?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.nicotine_do_you_want_to_quit_nicotine">
+                                            <option value="No">No</option>
+                                            <option value="Yes">Yes</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div v-if="data.nicotine_do_you_want_to_quit_nicotine == 'Yes'" class="col-md-12">
+                        <p class="pl-2 font-weight-bold">If yes, answer the questions below:</p>
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-12">
+                                            <label>How soon after you wake up do you use nicotine/tobacco? </label>
+                                            <div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="radio" name="nicotine_how_soon_in_mins"
+                                                           id="nicotine_how_soon_60_min" value="after_60_mins" v-model="data.nicotine_how_soon_in_mins">
+                                                    <label class="form-check-label" for="nicotine_how_soon_60_min">After 60 minutes</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="radio" name="nicotine_how_soon_in_mins"
+                                                           id="nicotine_how_soon_31_60_min" value="31_60_mins" v-model="data.nicotine_how_soon_in_mins">
+                                                    <label class="form-check-label" for="nicotine_how_soon_31_60_min">31-60 minutes</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="radio" name="nicotine_how_soon_in_mins"
+                                                           id="nicotine_how_soon_6_30_min" value="6_30_mins" v-model="data.nicotine_how_soon_in_mins">
+                                                    <label class="form-check-label" for="nicotine_how_soon_6_30_min">6-30 minutes</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="radio" name="nicotine_how_soon_in_mins"
+                                                           id="nicotine_how_soon_within_5_min" value="within_5_mins"
+                                                           v-model="data.nicotine_how_soon_in_mins">
+                                                    <label class="form-check-label" for="nicotine_how_soon_within_5_min">Within 5 minutes</label>
+                                                </div>
+                                            </div>
+
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-12">
+                                            <label>How many cigarettes do you smoke per day?</label>
+                                            <div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="radio" name="nicotine_how_many_cigarettes_per_day"
+                                                           id="nicotine_how_many_10_or_less" value="after_60_mins"
+                                                           v-model="data.nicotine_how_many_cigarettes_per_day">
+                                                    <label class="form-check-label" for="nicotine_how_many_10_or_less">10 or less</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="radio" name="nicotine_how_many_cigarettes_per_day"
+                                                           id="nicotine_how_many_11_20" value="31_60_mins"
+                                                           v-model="data.nicotine_how_many_cigarettes_per_day">
+                                                    <label class="form-check-label" for="nicotine_how_many_11_20">11-20</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="radio" name="nicotine_how_many_cigarettes_per_day"
+                                                           id="nicotine_how_many_21_30" value="6_30_mins"
+                                                           v-model="data.nicotine_how_many_cigarettes_per_day">
+                                                    <label class="form-check-label" for="nicotine_how_many_21_30">21-30</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="radio" name="nicotine_how_many_cigarettes_per_day"
+                                                           id="nicotine_how_many_31_plus" value="within_5_mins"
+                                                           v-model="data.nicotine_how_many_cigarettes_per_day">
+                                                    <label class="form-check-label" for="nicotine_how_many_31_plus">31+</label>
+                                                </div>
+                                            </div>
+
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <hr />
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            What age did you start smoking?
+                                        </div>
+                                        <div class="col-6">
+                                            <input type="text" class="form-control" name="nicotine_age_started_smoking"
+                                                   v-model="data.nicotine_age_started_smoking" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            What is the longest time period you have stayed quit?
+                                        </div>
+                                        <div class="col-6">
+                                            <input type="text" class="form-control" name="nicotine_longest_time_stayed_quit"
+                                                   v-model="data.nicotine_longest_time_stayed_quit" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            What made you start smoking again?
+                                        </div>
+                                        <div class="col-6">
+                                            <input type="text" class="form-control" name="nicotine_why_started_smoking_again"
+                                                   v-model="data.nicotine_why_started_smoking_again" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-12">
+                                            <div>
+                                                Which of the following people smoke around you? <small class="text-muted">Check all that
+                                                    apply</small>
+                                            </div>
+                                            <div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_friends_smoke_around_me"
+                                                           name="smokes_around_me" value="Friends"
+                                                           v-model="data.smokes_around_me">
+                                                    <label class="form-check-label" for="nicotine_friends_smoke_around_me">Friends</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_family_smoke_around_me"
+                                                           name="smokes_around_me" value="Family" v-model="data.smokes_around_me">
+                                                    <label class="form-check-label" for="nicotine_family_smoke_around_me">Family</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_partner_smoke_around_me"
+                                                           name="smokes_around_me" value="Partner"
+                                                           v-model="data.smokes_around_me">
+                                                    <label class="form-check-label" for="nicotine_partner_smoke_around_me">Partner</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_co_workers_smoke_around_me"
+                                                           name="smokes_around_me" value="Co-Workers"
+                                                           v-model="data.smokes_around_me">
+                                                    <label class="form-check-label" for="nicotine_co_workers_smoke_around_me">Co-Workers</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_other_smoke_around_me"
+                                                           name="smokes_around_me" value="Other" v-model="data.smokes_around_me">
+                                                    <label class="form-check-label" for="nicotine_other_smoke_around_me">Other</label>
+                                                </div>
+                                                <div v-if="data.smokes_around_me.indexOf('Other') !== -1" class="form-group mt-3">
+                                                    <label>Other</label>
+                                                    <input type="text" class="form-control" name="nicotine_other_smoke_around_me_description"
+                                                           v-model="data.nicotine_other_smoke_around_me_description" />
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <hr>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            How many times have you seriously tried to quit?
+                                        </div>
+                                        <div class="col-6">
+                                            <input type="text" class="form-control" name="nicotine_times_seriously_tried_to_quit"
+                                                   v-model="data.nicotine_times_seriously_tried_to_quit" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            For your most recent quit attempt, how long did it last?
+                                        </div>
+                                        <div class="col-6">
+                                            <input type="text" class="form-control" name="nicotine_recent_quit_duration"
+                                                   v-model="data.nicotine_recent_quit_duration" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">j.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            Who is supporting you to quit smoking?
+                                        </div>
+                                        <div class="col-6">
+                                            <input type="text" class="form-control" name="nicotine_who_is_supporting_you_to_quit"
+                                                   v-model="data.nicotine_who_is_supporting_you_to_quit" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">k.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            What is your most important reason to quit smoking?
+                                        </div>
+                                        <div class="col-6">
+                  <textarea type="text" class="form-control" name="nicotine_most_important_reason_to_quit"
+                            v-model="data.nicotine_most_important_reason_to_quit"></textarea>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <hr>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">l.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            Are you currently using or have used any medications to help you quit smoking?
+                                        </div>
+                                        <div class="col-6">
+                                            <select class="form-control" name="nicotine_ever_used_medication_to_quit"
+                                                    v-model="data.nicotine_ever_used_medication_to_quit">
+                                                <option value="No">No</option>
+                                                <option value="Yes">Yes</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-12">
+                                            If yes, check with of the following medications you have used:
+                                            <div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_medication_used_nicotine_patch"
+                                                           name="nicotine_medication_used" value="Nicotine Patch"
+                                                           v-model="data.nicotine_medication_used">
+                                                    <label class="form-check-label" for="nicotine_medication_used_nicotine_patch">
+                                                        Nicotine Patch
+                                                    </label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_medication_used_nicotine_gum"
+                                                           name="nicotine_medication_used" value="Nicotine Gum"
+                                                           v-model="data.nicotine_medication_used">
+                                                    <label class="form-check-label" for="nicotine_medication_used_nicotine_gum">
+                                                        Nicotine Gum
+                                                    </label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_medication_used_nicotine_lozenge"
+                                                           name="nicotine_medication_used" value="Nicotine Lozenge"
+                                                           v-model="data.nicotine_medication_used">
+                                                    <label class="form-check-label" for="nicotine_medication_used_nicotine_lozenge">
+                                                        Nicotine Lozenge
+                                                    </label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_medication_used_wellbutrin"
+                                                           name="nicotine_medication_used" value="Wellbutrin/Bupropion Pill"
+                                                           v-model="data.nicotine_medication_used">
+                                                    <label class="form-check-label" for="nicotine_medication_used_wellbutrin">
+                                                        Wellbutrin/Bupropion Pill
+                                                    </label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_medication_used_chantix"
+                                                           name="nicotine_medication_used" value="Chantix/Varenicline Pill"
+                                                           v-model="data.nicotine_medication_used">
+                                                    <label class="form-check-label" for="nicotine_medication_used_chantix">
+                                                        Chantix/ Varenicline Pill
+                                                    </label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_medication_used_other"
+                                                           name="nicotine_medication_used" value="Other" v-model="data.nicotine_medication_used">
+                                                    <label class="form-check-label" for="nicotine_medication_used_other">
+                                                        Other
+                                                    </label>
+                                                </div>
+                                                <div class="form-group mt-3">
+                                                    <label>Other:</label>
+                                                    <input type="text" class="form-control" name="nicotine_medication_used_other_description"
+                                                           v-model="data.nicotine_medication_used_other_description" />
+                                                </div>
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">m.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            If you used any of the medication listed above, did they help?
+                                        </div>
+                                        <div class="col-6">
+                                            <select class="form-control" name="nicotine_medication_did_they_help"
+                                                    v-model="data.nicotine_medication_did_they_help">
+                                                <option value="No">No</option>
+                                                <option value="Yes">Yes</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div v-if="data.nicotine_medication_did_they_help == 'Yes'">
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">l.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            If yes, list which ones helped:
+                                        </div>
+                                        <div class="col-6">
+                                            <input type="text" class="form-control" name="nicotine_medication_list_helpful_ones"
+                                                   v-model="data.nicotine_medication_list_helpful_ones" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">n.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            Have you used any methods in the past other than medications to try to quit?
+                                        </div>
+                                        <div class="col-6">
+                                            <select class="form-control" name="nicotine_used_any_other_methods_to_quit"
+                                                    v-model="data.nicotine_used_any_other_methods_to_quit">
+                                                <option value="No">No</option>
+                                                <option value="Yes">Yes</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div v-if="data.nicotine_used_any_other_methods_to_quit == 'Yes'">
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">l.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-12">
+                                            If yes, check which of the following methods you have used:
+                                            <div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_other_methods_self_help"
+                                                           name="nicotine_other_methods_used" value="Self-help"
+                                                           v-model="data.nicotine_other_methods_used">
+                                                    <label class="form-check-label" for="nicotine_other_methods_self_help">Self-help</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_other_methods_gradual_reduction"
+                                                           name="nicotine_other_methods_used" value="Gradual reduction"
+                                                           v-model="data.nicotine_other_methods_used">
+                                                    <label class="form-check-label" for="nicotine_other_methods_gradual_reduction">Gradual reduction</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_other_methods_cold_turkey"
+                                                           name="nicotine_other_methods_used" value="Cold turkey"
+                                                           v-model="data.nicotine_other_methods_used">
+                                                    <label class="form-check-label" for="nicotine_other_methods_cold_turkey">Cold turkey</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_other_methods_hypnosis"
+                                                           name="nicotine_other_methods_used" value="Hypnosis" v-model="data.nicotine_other_methods_used">
+                                                    <label class="form-check-label" for="nicotine_other_methods_hypnosis">Hypnosis</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_other_methods_acupuncture"
+                                                           name="nicotine_other_methods_used" value="Acupuncture"
+                                                           v-model="data.nicotine_other_methods_used">
+                                                    <label class="form-check-label" for="nicotine_other_methods_acupuncture">Acupuncture</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_other_methods_special_filters"
+                                                           name="nicotine_other_methods_used" value="Special filters"
+                                                           v-model="data.nicotine_other_methods_used">
+                                                    <label class="form-check-label" for="nicotine_other_methods_special_filters">Special filters</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_other_methods_vapinge"
+                                                           name="nicotine_other_methods_used" value="Vaping/e-cigarettes" v-model="data.nicotine_other_methods_used">
+                                                    <label class="form-check-label" for="nicotine_other_methods_vapinge">Vaping/e-cigarettes</label>
+                                                </div>
+                                                <div class="form-check form-check-inline">
+                                                    <input class="form-check-input" type="checkbox" id="nicotine_other_methods_other"
+                                                           name="nicotine_other_methods_used" value="Other" v-model="data.nicotine_other_methods_used">
+                                                    <label class="form-check-label" for="nicotine_other_methods_other">Other</label>
+                                                </div>
+
+                                                <div v-if="data.nicotine_other_methods_used.indexOf('Other') !== -1" class="form-group mt-3">
+                                                    <label>Other:</label>
+                                                    <input type="text" class="form-control" name="nicotine_other_methods_other_description"
+                                                           v-model="data.nicotine_other_methods_other_description">
+                                                </div>
+
+                                            </div>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+
+
+                    </div>
+
+                    <div class="col-md-12">
+                        <h6 class="font-weight-bold">ALCOHOL</h6>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        Do you drink alcohol?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm" v-model="data.alcohol_do_you_drink_alcohol">
+                                            <option value="No">No</option>
+                                            <option value="Yes">Yes</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div v-if="data.alcohol_do_you_drink_alcohol == 'Yes'" class="col-md-12">
+                        <p class="pl-2 font-weight-bold">If yes, please answer the questions below:</p>
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            What type of alcohol do you prefer?
+                                        </div>
+                                        <div class="col-6">
+                                            <input type="text" class="form-control form-control-sm"
+                                                   v-model="data.alcohol_prefered_type_of_alcohol" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            On average, how many servings do you drink per day/week/month/year on average?
+                                        </div>
+                                        <div class="col-6">
+                                            <input type="text" class="form-control form-control-sm"
+                                                   v-model="data.alcohol_how_many_servings_per_day" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            Have you ever felt you should <b>“Cut down”</b> on your drinking?
+                                        </div>
+                                        <div class="col-6">
+                                            <select class="form-control form-control-sm"
+                                                    v-model="data.alcohol_felt_like_cutting_down">
+                                                <option value="No">No</option>
+                                                <option value="Yes">Yes</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            Have people <b>Annoyed</b> you by criticizing your drinking?
+                                        </div>
+                                        <div class="col-6">
+                                            <select class="form-control form-control-sm"
+                                                    v-model="data.alcohol_have_people_criticized_you">
+                                                <option value="No">No</option>
+                                                <option value="Yes">Yes</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            Have you ever felt <b>Guilty</b> about your drinking?
+                                        </div>
+                                        <div class="col-6">
+                                            <select class="form-control form-control-sm" v-model="data.alcohol_felt_guilty">
+                                                <option value="No">No</option>
+                                                <option value="Yes">Yes</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            Have you ever had a drink in the morning to steady your nerves or to get rid of a hangover (<b>eye
+                                                opener</b>)?
+                                        </div>
+                                        <div class="col-6">
+                                            <select class="form-control form-control-sm"
+                                                    v-model="data.alcohol_drank_in_morning_to_get_rid_of_hangover">
+                                                <option value="No">No</option>
+                                                <option value="Yes">Yes</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            Do you binge drink (more than 5 drinks for men or 4 drinks for women within 2 hours)?
+                                        </div>
+                                        <div class="col-6">
+                                            <select class="form-control form-control-sm" v-model="data.alcohol_do_you_binge_drink">
+                                                <option value="No">No</option>
+                                                <option value="Yes">Yes</option>
+                                            </select>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+
+
+                    </div>
+
+                    <hr>
+
+                    <div class="col-md-12">
+                        <h6 class="font-weight-bold">Have you used any of the following substances in the past year?</h6>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        Recreational drugs (cocaine, heroin, meth, etc.)
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.recreational_have_you_ever_used_any">
+                                            <option value="No">No</option>
+                                            <option value="Yes">Yes</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div v-if="data.recreational_have_you_ever_used_any == 'Yes'" class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        If yes, what level of concern do you have regarding use of the substances
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.recreational_level_of_concern">
+                                            <option value="0">0 - No concern</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5 - High concern</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            If yes, how much substance do you usually use?
+                                        </div>
+                                        <div class="col-6">
+                                            <input type="text" class="form-control form-control-sm"
+                                                   v-model="data.recreational_how_much_used" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        <b>Marijuana</b>
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.marijuana_have_you_ever_used_marijuana">
+                                            <option value="No">No</option>
+                                            <option value="Yes">Yes</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div v-if="data.marijuana_have_you_ever_used_marijuana == 'Yes'" class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        If yes, what level of concern do you have regarding use of the substances
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.marijuana_level_of_concern">
+                                            <option value="0">0 - No concern</option>
+                                            <option value="1">1</option>
+                                            <option value="2">2</option>
+                                            <option value="3">3</option>
+                                            <option value="4">4</option>
+                                            <option value="5">5 - High concern</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                        <div>
+                            <div class="d-flex align-items-baseline mb-3">
+                                <div class="flex-grow-1">
+                                    <div class="row">
+                                        <div class="col-6">
+                                            If yes, how much substance do you usually use?
+                                        </div>
+                                        <div class="col-6">
+                                            <input type="text" class="form-control form-control-sm"
+                                                   v-model="data.marijuana_how_much_used" />
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                </div>
+
+                <hr>
+
+                <div class="row">
+                    <div class="col-md-12">
+                        <h5 class="bg-light p-1 font-weight-bold">TREATMENT HISTORY</h5>
+                    </div>
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        Have you ever received treatment for a mental health problem?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.mental_health_ever_received_treatment">
+                                            <option value="No">No</option>
+                                            <option value="Yes">Yes</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-md-12">
+                        <div class="d-flex align-items-baseline mb-3">
+                            <div class="flex-grow-1">
+                                <div class="row">
+                                    <div class="col-6">
+                                        Have you ever received treatment for drug or alcohol use?
+                                    </div>
+                                    <div class="col-6">
+                                        <select class="form-control form-control-sm"
+                                                v-model="data.drug_or_alcohol_have_you_ever_received_treatment">
+                                            <option value="No">No</option>
+                                            <option value="Yes">Yes</option>
+                                        </select>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="mt-3 pt-3 border-top text-center">
+                    <button type="button" v-on:click.prevent="saveForm()" class="btn btn-sm btn-primary mr-2">Submit</button>
+                    <button type="button" onclick="closeStagPopup()" class="btn btn-sm btn-default border">Cancel</button>
+                </div>
+
+            </div>
+
+            <div class="d-none">
+                <button submit class="btn btn-sm btn-primary mr-2">Submit</button>
+                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+            </div>
+        </form>
+    </div>
+</div>
+<script>
+    (function() {
+        function init() {
+
+            runMCInitializer('hide-moes');
+            // any JS can come here
+            // will be run on page-load as well as whenever this segment is refreshed
+            new Vue({
+                el: '#edit-univ_sub_substance_use_assessment-container',
+                delimiters: ["@{{","}}"],
+                data: {
+                    data: <?= json_encode($contentData) ?>
+                },
+                watch: {
+                    $data: {
+                        handler: function(val, oldVal) {
+                            let parent = $('#edit-univ_sub_substance_use_assessment-container').closest('form');
+                            parent.find('[name="data"]').val(JSON.stringify(this.data));
+
+                            // autosave on change
+                            autoSaveSegment(parent.find('[submit]').first());
+                        },
+                        deep: true
+                    }
+                },
+                methods: {
+                    saveForm: function() {
+                        let parent = $('#edit-univ_sub_substance_use_assessment-container').closest('form');
+                        parent.find('[name="data"]').val(JSON.stringify(this.data));
+                        autoSaveSegmentAndClose(parent.find('[submit]').first());
+                    },
+                    undoChanges: function() {
+                        $.post('/api/visitPoint/destroyCurrentChildReview', {
+                            uid: '{{$point->uid}}'
+                        }, _data => {
+                            if(!hasResponseError(_data)) {
+                                closeStagPopup();
+                                $('.visit-segment[data-segment-template-name="omega_subjective_system"]').find('.refresh-segment').trigger('click');
+                            }
+                        });
+                        return false;
+                    }
+                }
+            });
+        }
+
+        window.segmentInitializers.lifestyle_substances = init;
+
+        addMCInitializer('edit-univ_sub_substance_use_assessment-container-{{$note->id}}', init, '#edit-univ_sub_substance_use_assessment-container');
+
+    })();
+</script>

+ 803 - 0
resources/views/app/patient/modules/lifestyle_substances/summary.blade.php

@@ -0,0 +1,803 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+$point = Point::getGlobalSingletonOfCategory($patient, 'LIFESTYLE_SUBSTANCE_USE', false);
+
+if ($point && @$point->data) {
+$contentData = $point->data;
+?>
+
+<div id="v2_substance_use_assessment_section" class="mt-3">
+
+    <div class="row">
+        <div class="col-md-12">
+            <h5 class="bg-light p-1 font-weight-bold">SMOKING AND SUBSTANCE HISTORY</h5>
+            <p><b>NICOTINE/TOBACCO</b> (i.e. cigarettes, e-cigarettes, e-cigarettes/vaping, cigars, chew, snuff)</p>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            Do you use any of the nicotine products listed above?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->nicotine_i_use_any_of_listed_items_above ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <?php if (@$contentData->nicotine_i_use_any_of_listed_items_above == 'Yes') : ?>
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            If yes, do you want to quit using the nicotine/tobacco products?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->nicotine_do_you_want_to_quit_nicotine ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <?php endif; ?>
+
+        <?php if (@$contentData->nicotine_do_you_want_to_quit_nicotine == 'Yes') : ?>
+        <div class="col-md-12">
+            <p class="pl-2 font-weight-bold">If yes, answer the questions below:</p>
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                <label>How soon after you wake up do you use nicotine/tobacco? </label>
+                                <div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_how_soon_in_mins === 'after_60_mins') : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_how_soon_60_min">After 60 minutes</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_how_soon_in_mins === '31_60_mins') : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_how_soon_31_60_min">31-60 minutes</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_how_soon_in_mins === '6_30_mins') : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_how_soon_6_30_min">6-30 minutes</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_how_soon_in_mins === 'within_5_mins') : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_how_soon_within_5_min">Within 5 minutes</label>
+                                    </div>
+                                </div>
+
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                <label>How many cigarettes do you smoke per day?</label>
+                                <div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_how_many_cigarettes_per_day === 'after_60_mins') : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_how_many_10_or_less">10 or less</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_how_many_cigarettes_per_day === '31_60_mins') : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_how_many_11_20">11-20</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_how_many_cigarettes_per_day === '6_30_mins') : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_how_many_21_30">21-30</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_how_many_cigarettes_per_day === 'within_5_mins') : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_how_many_31_plus">31+</label>
+                                    </div>
+                                </div>
+
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <hr />
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                What age did you start smoking?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->nicotine_age_started_smoking ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                What is the longest time period you have stayed quit?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->nicotine_longest_time_stayed_quit ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                What made you start smoking again?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->nicotine_why_started_smoking_again ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                <div>
+                                    Which of the following people smoke around you? <small class="text-muted">Check all that
+                                        apply</small>
+                                </div>
+                                <div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->smokes_around_me && in_array('Friends', $contentData->smokes_around_me)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_friends_smoke_around_me">Friends</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->smokes_around_me && in_array('Family', $contentData->smokes_around_me)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_family_smoke_around_me">Family</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->smokes_around_me && in_array('Partner', $contentData->smokes_around_me)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_partner_smoke_around_me">Partner</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->smokes_around_me && in_array('Co-Workers', $contentData->smokes_around_me)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_co_workers_smoke_around_me">Co-Workers</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->smokes_around_me && in_array('Other', $contentData->smokes_around_me)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_other_smoke_around_me">Other</label>
+                                    </div>
+                                    <div class="form-group mt-3">
+                                        <label>Other</label>
+                                        <?= @$contentData->nicotine_other_smoke_around_me_description ?>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <hr>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                How many times have you seriously tried to quit?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->nicotine_times_seriously_tried_to_quit ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">i.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                For your most recent quit attempt, how long did it last?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->nicotine_recent_quit_duration ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">j.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Who is supporting you to quit smoking?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->nicotine_who_is_supporting_you_to_quit ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">k.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                What is your most important reason to quit smoking?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->nicotine_most_important_reason_to_quit ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <hr>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">l.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Are you currently using or have used any medications to help you quit smoking?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->nicotine_ever_used_medication_to_quit ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">&nbsp;</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                If yes, check with of the following medications you have used:
+                                <div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_medication_used && in_array('Nicotine Patch', $contentData->nicotine_medication_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_medication_used_nicotine_patch">
+                                            Nicotine Patch
+                                        </label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_medication_used && in_array('Nicotine Gum', $contentData->nicotine_medication_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_medication_used_nicotine_gum">
+                                            Nicotine Gum
+                                        </label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_medication_used && in_array('Nicotine Lozenge', $contentData->nicotine_medication_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_medication_used_nicotine_lozenge">
+                                            Nicotine Lozenge
+                                        </label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_medication_used && in_array('Wellbutrin/Bupropion Pill', $contentData->nicotine_medication_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_medication_used_wellbutrin">
+                                            Wellbutrin/Bupropion Pill
+                                        </label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_medication_used && in_array('Chantix/Varenicline Pill', $contentData->nicotine_medication_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_medication_used_chantix">
+                                            Chantix/ Varenicline Pill
+                                        </label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_medication_used && in_array('Other', $contentData->nicotine_medication_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_medication_used_other">
+                                            Other
+                                        </label>
+                                    </div>
+                                    <div class="form-group mt-3">
+                                        <label>Other:</label>
+                                        <?= @$contentData->nicotine_medication_used_other_description ?>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">m.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                If you used any of the medication listed above, did they help?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->nicotine_medication_did_they_help ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <?php if(@$contentData->nicotine_medication_did_they_help === 'Yes'): ?>
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">l.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                If yes, list which ones helped:
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->nicotine_medication_list_helpful_ones ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <?php endif; ?>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">n.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Have you used any methods in the past other than medications to try to quit?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->nicotine_used_any_other_methods_to_quit ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <?php if(@$contentData->nicotine_used_any_other_methods_to_quit === 'Yes'): ?>
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">l.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-12">
+                                If yes, check which of the following methods you have used:
+                                <div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_other_methods_used && in_array('Self-help', $contentData->nicotine_other_methods_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_other_methods_self_help">Self-help</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_other_methods_used && in_array('Gradual reduction', $contentData->nicotine_other_methods_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_other_methods_gradual_reduction">Gradual reduction</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_other_methods_used && in_array('Cold turkey', $contentData->nicotine_other_methods_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_other_methods_cold_turkey">Cold turkey</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_other_methods_used && in_array('Hypnosis', $contentData->nicotine_other_methods_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_other_methods_hypnosis">Hypnosis</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_other_methods_used && in_array('Acupuncture', $contentData->nicotine_other_methods_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_other_methods_acupuncture">Acupuncture</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_other_methods_used && in_array('Acupuncture', $contentData->nicotine_other_methods_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_other_methods_special_filters">Special filters</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_other_methods_used && in_array('Vaping/e-cigarettes', $contentData->nicotine_other_methods_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_other_methods_vapinge">Vaping/e-cigarettes</label>
+                                    </div>
+                                    <div class="form-check form-check-inline">
+                                        <?php if (@$contentData->nicotine_other_methods_used && in_array('Other', $contentData->nicotine_other_methods_used)) : ?>
+                                        <i class="fa fa-check"></i>
+                                        <?php endif; ?>
+                                        <label class="form-check-label" for="nicotine_other_methods_other">Other</label>
+                                    </div>
+
+                                    <div class="form-group mt-3">
+                                        <label>Other:</label>
+                                        <?= @$contentData->nicotine_other_methods_other_description ?>
+                                    </div>
+
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <?php endif; ?>
+
+
+
+        </div>
+        <?php endif; ?>
+
+        <div class="col-md-12">
+            <h6 class="font-weight-bold">ALCOHOL</h6>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="pr-2 text-secondary font-weight-bold width-30px">a.</div>
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            Do you drink alcohol?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->alcohol_do_you_drink_alcohol ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <?php if(@$contentData->alcohol_do_you_drink_alcohol === 'Yes'): ?>
+        <div class="col-md-12">
+            <p class="pl-2 font-weight-bold">If yes, please answer the questions below:</p>
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">b.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                What type of alcohol do you prefer?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->alcohol_prefered_type_of_alcohol ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">c.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                On average, how many servings do you drink per day/week/month/year on average?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->alcohol_how_many_servings_per_day ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">d.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Have you ever felt you should <b>“Cut down”</b> on your drinking?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->alcohol_felt_like_cutting_down ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">e.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Have people <b>Annoyed</b> you by criticizing your drinking?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->alcohol_have_people_criticized_you ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">f.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Have you ever felt <b>Guilty</b> about your drinking?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->alcohol_felt_guilty ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">g.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Have you ever had a drink in the morning to steady your nerves or to get rid of a hangover (<b>eye
+                                    opener</b>)?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->alcohol_drank_in_morning_to_get_rid_of_hangover ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="pr-2 text-secondary font-weight-bold width-30px">h.</div>
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                Do you binge drink (more than 5 drinks for men or 4 drinks for women within 2 hours)?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->alcohol_do_you_binge_drink ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+
+
+        </div>
+        <?php endif; ?>
+
+        <hr>
+
+        <div class="col-md-12">
+            <h6 class="font-weight-bold">Have you used any of the following substances in the past year?</h6>
+        </div>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            Recreational drugs (cocaine, heroin, meth, etc.)
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->recreational_have_you_ever_used_any ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <?php if(@$contentData->recreational_have_you_ever_used_any === 'Yes'): ?>
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            If yes, what level of concern do you have regarding use of the substances
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->recreational_level_of_concern ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                If yes, how much substance do you usually use?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->recreational_how_much_used ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <?php endif; ?>
+
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            <b>Marijuana</b>
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->marijuana_have_you_ever_used_marijuana ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <?php if(@$contentData->marijuana_have_you_ever_used_marijuana === 'Yes'): ?>
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            If yes, what level of concern do you have regarding use of the substances
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->marijuana_level_of_concern ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div>
+                <div class="d-flex align-items-baseline mb-3">
+                    <div class="flex-grow-1">
+                        <div class="row">
+                            <div class="col-6">
+                                If yes, how much substance do you usually use?
+                            </div>
+                            <div class="col-6">
+                                <?= @$contentData->marijuana_how_much_used ?>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <?php endif; ?>
+
+    </div>
+
+    <hr>
+
+    <div class="row">
+        <div class="col-md-12">
+            <h5 class="bg-light p-1 font-weight-bold">TREATMENT HISTORY</h5>
+        </div>
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            Have you ever received treatment for a mental health problem?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->mental_health_ever_received_treatment ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        <div class="col-md-12">
+            <div class="d-flex align-items-baseline mb-3">
+                <div class="flex-grow-1">
+                    <div class="row">
+                        <div class="col-6">
+                            Have you ever received treatment for drug or alcohol use?
+                        </div>
+                        <div class="col-6">
+                            <?= @$contentData->drug_or_alcohol_have_you_ever_received_treatment ?>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+
+</div>
+
+<?php
+} else {
+    echo '<div class="text-secondary">-</div>';
+}
+?>
+

+ 5 - 5
resources/views/app/patient/note/dashboard-bu-b4-pure-soap.blade.php

@@ -2436,7 +2436,7 @@
                                  open-in-stag-popup
                                  mc-initer="medications-center-{{$note->id}}"
                                  title="Medications Center"
-                                 popup-style="medium-large overflow-visible"
+                                 popup-style="overflow-visible"
                                  href="/medications-center/{{$patient->uid}}/{{$note->uid}}">
                                 <i class="fa fa-bolt mr-1"></i>
                                 <span>Rx</span>
@@ -2448,7 +2448,7 @@
                                  open-in-stag-popup
                                  mc-initer="problems-center-{{$note->id}}"
                                  title="Problems Center"
-                                 popup-style="medium-large overflow-visible"
+                                 popup-style="overflow-visible"
                                  href="/problems-center/{{$patient->uid}}/{{$note->uid}}">
                                 <i class="fa fa-bolt mr-1"></i>
                                 <span>Dx</span>
@@ -2460,7 +2460,7 @@
                                  open-in-stag-popup
                                  mc-initer="goals-center-{{$note->id}}"
                                  title="Goals Center"
-                                 popup-style="medium-large overflow-visible"
+                                 popup-style="overflow-visible"
                                  href="/goals-center/{{$patient->uid}}/{{$note->uid}}">
                                 <i class="fa fa-bolt mr-1"></i>
                                 <span>Goals</span>
@@ -2472,7 +2472,7 @@
                                  open-in-stag-popup
                                  mc-initer="allergies-center-{{$note->id}}"
                                  title="Allergies Center"
-                                 popup-style="medium-large overflow-visible"
+                                 popup-style="overflow-visible"
                                  href="/allergies-center/{{$patient->uid}}/{{$note->uid}}">
                                 <i class="fa fa-bolt mr-1"></i>
                                 <span>Allergies</span>
@@ -2484,7 +2484,7 @@
                                  open-in-stag-popup
                                  mc-initer="careteam-center-{{$note->id}}"
                                  title="Care Team Center"
-                                 popup-style="medium-large overflow-visible"
+                                 popup-style="overflow-visible"
                                  href="/careteam-center/{{$patient->uid}}/{{$note->uid}}">
                                 <i class="fa fa-bolt mr-1"></i>
                                 <span>Care Team</span>

+ 71 - 55
resources/views/app/patient/note/dashboard.blade.php

@@ -404,12 +404,10 @@
                 </div>
             </div>
 
-            @if($note->is_signed_by_hcp)
             <div class="px-2 border-left screen-only">
                 <a href="{{route('print-note', ['patient' => $patient, 'note' => $note])}}" native target="_blank" class=""><i class="fa fa-print"></i> Print</a>
             </div>
-            @endif
-
+            
             @if($pro->pro_type === 'ADMIN' || $pro->is_enrolled_as_mcp)
             <div class="px-2 border-left screen-only">
                 <a native target="_blank"
@@ -457,18 +455,68 @@
                     "title" => 'COVID-19 Follow-up',
                     "href" => "/note-segment-view-by-name/{$note->uid}/covid_follow-up/edit",
                     "initer" => "covid-follow-up-{$note->id}"
-                ]
+                ],
+                [], // for separator
+                [
+                    "name" => 'Lifestyle General',
+                    "title" => 'Lifestyle General',
+                    "style" => 'stag-popup-md',
+                    "href" => "/module-view/{$note->uid}/lifestyle_general/edit",
+                    "initer" => "edit-univ_sub_lifestyle_general-container-{$note->id}"
+                ],
+                [
+                    "name" => 'Lifestyle Nutrition',
+                    "title" => 'Lifestyle Nutrition',
+                    "style" => 'stag-popup-md',
+                    "href" => "/module-view/{$note->uid}/lifestyle_nutrition/edit",
+                    "initer" => "edit-univ_sub_nutrition_assessment-container-{$note->id}"
+                ],
+                [
+                    "name" => 'Lifestyle Physical Activity',
+                    "title" => 'Lifestyle Physical Activity',
+                    "style" => 'stag-popup-md',
+                    "href" => "/module-view/{$note->uid}/lifestyle_physical_activity/edit",
+                    "initer" => "edit-univ_sub_physical_activity_assessment-container-{$note->id}"
+                ],
+                [
+                    "name" => 'Lifestyle Sleep',
+                    "title" => 'Lifestyle Sleep',
+                    "style" => 'stag-popup-md',
+                    "href" => "/module-view/{$note->uid}/lifestyle_sleep/edit",
+                    "initer" => "edit-univ_sub_sleep_assessment-container-{$note->id}"
+                ],
+                [
+                    "name" => 'Lifestyle Social',
+                    "title" => 'Lifestyle Social',
+                    "style" => 'stag-popup-md',
+                    "href" => "/module-view/{$note->uid}/lifestyle_social/edit",
+                    "initer" => "edit-univ_sub_social_relationships_assessment-container-{$note->id}"
+                ],
+                [
+                    "name" => 'Lifestyle Stress',
+                    "title" => 'Lifestyle Stress',
+                    "style" => 'stag-popup-md',
+                    "href" => "/module-view/{$note->uid}/lifestyle_stress/edit",
+                    "initer" => "edit-univ_sub_stress_assessment-container-{$note->id}"
+                ],
+                [
+                    "name" => 'Lifestyle Substances',
+                    "title" => 'Lifestyle Substances',
+                    "style" => 'stag-popup-md',
+                    "href" => "/module-view/{$note->uid}/lifestyle_substances/edit",
+                    "initer" => "edit-univ_sub_substance_use_assessment-container-{$note->id}"
+                ],
             ];
             ?>
             <div moe relative class="px-2 border-left screen-only">
-                <a href="#" start show>+ Module</a>
+                <a href="#" start show>+ Form</a>
                 <form url="#" right>
-                    <p class="font-weight-bold text-secondary">Additional Modules</p>
+                    <p class="font-weight-bold text-secondary">Additional Forms</p>
                     @foreach($availableModules as $module)
                         @if(@$module['name'])
                             <a href="{{$module['href']}}"
                                open-in-stag-popup
-                               popup-style="medium-large overflow-visible"
+                               popup-style="overflow-visible {{@$module['style']}}"
                                title="{!! $module['title'] !!}"
                                mc-initer="{{ @$module['initer']  }}"
                                class="d-block mb-1 text-nowrap">{!! $module['name'] !!}</a>
@@ -728,13 +776,16 @@
                 <!-- handouts -->
                 <div class="p-3 border-bottom screen-only" data-non-segment-section="Handouts">
                     <?php $handouts = \App\Models\Handout::where('is_active', true)->get(); ?>
-                    @include('app.patient.handouts-list', compact('patient', 'handouts'))
+                    @include('app.patient.handouts-list', compact('patient', 'handouts', 'note'))
                 </div>
 
                 <div class="p-3 border-bottom screen-only" data-non-segment-section="Prescriptions">
                     @include('app.patient.prescriptions.list', compact('patient', 'note'))
                 </div>
 
+                <div class="p-3 border-bottom screen-only" data-non-segment-section="Incoming Reports">
+                    @include('app.patient.partials.incoming-reports')
+                </div>
 
                 <div class="p-3 border-bottom screen-only" data-non-segment-section="Supply Orders Summary">
                     <div class="">
@@ -2385,7 +2436,7 @@
                              class="c-pointer d-inline-flex align-items-center px-2 py-1"
                              open-in-stag-popup
                              title="Medrisk Vigilence"
-                             popup-style="medium-large overflow-visible mrv-content"
+                             popup-style="overflow-visible mrv-content"
                              href="/mrv-summary/{{$note->uid}}">
                             <span>MRV</span>
                         </div>
@@ -2396,7 +2447,7 @@
                              open-in-stag-popup
                              mc-initer="medications-center-{{$note->id}}"
                              title="Medications Center"
-                             popup-style="medium-large overflow-visible"
+                             popup-style="overflow-visible"
                              href="/medications-center/{{$patient->uid}}/{{$note->uid}}">
                             <i class="fa fa-bolt mr-1"></i>
                             <span>Rx</span>
@@ -2408,7 +2459,7 @@
                              open-in-stag-popup
                              mc-initer="problems-center-{{$note->id}}"
                              title="Problems Center"
-                             popup-style="medium-large overflow-visible"
+                             popup-style="overflow-visible"
                              href="/problems-center/{{$patient->uid}}/{{$note->uid}}">
                             <i class="fa fa-bolt mr-1"></i>
                             <span>Dx</span>
@@ -2420,7 +2471,7 @@
                              open-in-stag-popup
                              mc-initer="goals-center-{{$note->id}}"
                              title="Goals Center"
-                             popup-style="medium-large overflow-visible"
+                             popup-style="overflow-visible"
                              href="/goals-center/{{$patient->uid}}/{{$note->uid}}">
                             <i class="fa fa-bolt mr-1"></i>
                             <span>Goals</span>
@@ -2432,7 +2483,7 @@
                              open-in-stag-popup
                              mc-initer="allergies-center-{{$note->id}}"
                              title="Allergies Center"
-                             popup-style="medium-large overflow-visible"
+                             popup-style="overflow-visible"
                              href="/allergies-center/{{$patient->uid}}/{{$note->uid}}">
                             <i class="fa fa-bolt mr-1"></i>
                             <span>Allergies</span>
@@ -2444,56 +2495,21 @@
                              open-in-stag-popup
                              mc-initer="careteam-center-{{$note->id}}"
                              title="Care Team Center"
-                             popup-style="medium-large overflow-visible"
+                             popup-style="overflow-visible"
                              href="/careteam-center/{{$patient->uid}}/{{$note->uid}}">
                             <i class="fa fa-bolt mr-1"></i>
                             <span>Care Team</span>
                         </div>
                     </div>
-                    <!--<div class="nbt-container border-right border-info d-inline-flex align-self-stretch">
-                        <div class="position-relative on-click-menu d-inline-flex align-items-center px-2 py-1">
-                            <span class="">LS <i class="fa fa-caret-up"></i></span>
-                            <div menu bottom class="bg-white border">
-                                <a href="#" class="ls-segment-trigger px-2 py-1 text-nowrap d-block" data-target="lifestyle_general">General</a>
-                                <a href="#" class="ls-segment-trigger px-2 py-1 text-nowrap d-block" data-target="lifestyle_nutrition">Nutrition</a>
-                                <a href="#" class="ls-segment-trigger px-2 py-1 text-nowrap d-block" data-target="lifestyle_physical_activity">Physical Activity</a>
-                                <a href="#" class="ls-segment-trigger px-2 py-1 text-nowrap d-block" data-target="lifestyle_sleep">Sleep</a>
-                                <a href="#" class="ls-segment-trigger px-2 py-1 text-nowrap d-block" data-target="lifestyle_social">Social Relationships</a>
-                                <a href="#" class="ls-segment-trigger px-2 py-1 text-nowrap d-block" data-target="lifestyle_substances">Substance Use</a>
-                                <a href="#" class="ls-segment-trigger px-2 py-1 text-nowrap d-block" data-target="lifestyle_stress">Stress</a>
-                            </div>
-                        </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 incoming-reports-trigger px-2 py-1"
-                             open-in-stag-popup
-                             mc-initer="incoming-reports"
-                             title="Incoming Reports"
-                             popup-style="wide overflow-visible"
-                             href="/patients/view/{{$patient->uid}}/incoming-reports?noteUid={{$note->uid}}">
-                            <span>Inc. Rpts.</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 documents-trigger px-2 py-1"
-                             open-in-stag-popup
-                             title="Documents"
-                             popup-style="wide overflow-visible"
-                             href="/patients/view/{{$patient->uid}}/documents">
-                            <span>Docs</span>
-                        </div>
+                        <a native="" target="_top"
+                           class="c-pointer d-inline-flex align-items-center handouts-trigger px-2 py-1 text-dark"
+                           data-non-segment-target="Incoming Reports" href="#">Inc. Rpts.</a>
                     </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 handouts-trigger px-2 py-1"
-                             open-in-stag-popup
-                             title="Handouts"
-                             popup-style="wide overflow-visible"
-                             href="/patients/view/{{$patient->uid}}/handouts?noteUid={{$note->uid}}">
-                            <span>Handouts</span>
-                        </div>
+                        <a native="" target="_top"
+                           class="c-pointer d-inline-flex align-items-center handouts-trigger px-2 py-1 text-dark"
+                           data-non-segment-target="Handouts" href="#">Handouts</a>
                     </div>
                     <div class="nbt-container border-right border-info d-inline-flex align-self-stretch">
                         <a native="" target="_top"

+ 4 - 4
resources/views/app/patient/note/dashboard_script-bu-b4-oure-soap.blade.php

@@ -161,7 +161,7 @@
                                 'nutrition-center-{{$note->id}}',
                                 '<img src="/img/nutrition-rx.png" class=""/> Nutrition Rx',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
 
@@ -171,7 +171,7 @@
                                 'exercise-center-{{$note->id}}',
                                 '<img src="/img/exercise-rx.png" class=""/> Exercise Rx',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
 
@@ -181,7 +181,7 @@
                                 'behavior-center-{{$note->id}}',
                                 '<img src="/img/behavior-rx.png" class=""/> Behavior Rx',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
 
@@ -194,7 +194,7 @@
                                 'init-ros-{{$note->id}}',
                                 'Review of Systems',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
                         @endif

+ 4 - 4
resources/views/app/patient/note/dashboard_script-bu-b4-pure-soap.blade.php

@@ -161,7 +161,7 @@
                                 'nutrition-center-{{$note->id}}',
                                 '<img src="/img/nutrition-rx.png" class=""/> Nutrition Rx',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
 
@@ -171,7 +171,7 @@
                                 'exercise-center-{{$note->id}}',
                                 '<img src="/img/exercise-rx.png" class=""/> Exercise Rx',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
 
@@ -181,7 +181,7 @@
                                 'behavior-center-{{$note->id}}',
                                 '<img src="/img/behavior-rx.png" class=""/> Behavior Rx',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
 
@@ -194,7 +194,7 @@
                                 'init-ros-{{$note->id}}',
                                 'Review of Systems',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
                         @endif

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

@@ -217,7 +217,7 @@
                                 'nutrition-center-{{$note->id}}',
                                 '<img src="/img/nutrition-rx.png" class=""/> Nutrition Rx',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
 
@@ -228,7 +228,7 @@
                                 'exercise-center-{{$note->id}}',
                                 '<img src="/img/exercise-rx.png" class=""/> Exercise Rx',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
 
@@ -239,7 +239,7 @@
                                 'behavior-center-{{$note->id}}',
                                 '<img src="/img/behavior-rx.png" class=""/> Behavior Rx',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
 
@@ -257,7 +257,7 @@
                                 'init-ros-{{$note->id}}',
                                 'Review of Systems',
                                 false,
-                                "medium-large overflow-visible");
+                                "overflow-visible");
                             return false;
                         }
                         @endif
@@ -280,6 +280,7 @@
                             if(newEffectiveTop < prevEffectiveTop) {
                                 docRoot.scrollTop(docRoot.scrollTop() - (prevEffectiveTop - newEffectiveTop));
                             }
+                            editParent.find('.ql-editor').first().focus();
                             editParent.trigger('edit-mode-activated');
                         }
 

+ 1 - 0
resources/views/app/patient/note/lhs-tree.blade.php

@@ -48,6 +48,7 @@
     <hr>
     <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="Handouts" href="#">Handouts</a></div>
     <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="Prescriptions" href="#">ERx &amp; Orders</a></div>
+    <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="Incoming Reports" href="#">Incoming Reports</a></div>
     <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="RM Setup" href="#">RM Setup</a></div>
     <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="Supply Orders Summary" href="#">Supply Orders Summary</a></div>
     <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="Vitals Settings" href="#">Vitals Settings</a></div>

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

@@ -16,7 +16,7 @@
 
 	    ?>
         <div class="note-content-node note-content-heading">
-            <div class="py-2 px-3 border-bottom font-size-16 font-weight-bold bg-light text-secondary {{ $previousHeading ? 'mt-4 border-top' : '' }}">
+            <div class="py-2 px-2 border-bottom font-size-16 font-weight-bold bg-light text-dark {{ $previousHeading ? 'mt-4 border-top' : '' }}">
                 {{ $segment->heading }}
             </div>
             <div class="note-content-children ml-5 border-left">

+ 54 - 9
resources/views/app/patient/note/rhs-sidebar.blade.php

@@ -1,4 +1,51 @@
 <div class="note-rhs-sidebar" id="note-rhs-sidebar">
+
+    <?php
+    $cmStartDate = date('Y-m-01', strtotime($note->effective_dateest));
+    $careMonth = \App\Models\CareMonth::where('client_id', $patient->id)->where('start_date', $cmStartDate)->first();
+    ?>
+    <div id="recent-measurements"
+         class="p-2 border-bottom c-pointer on-hover-aliceblue {{$note->is_signed_by_hcp ? 'events-none' : ''}}"
+         open-in-stag-popup
+         mc-initer="care-month-dashboard-{{$patient->uid}}"
+         title="Care Month: {{friendly_month($careMonth->start_date)}}"
+         popup-style="overflow-visible"
+         href="/patients/view/{{ $note->client->uid }}/care-months/view/{{$careMonth->uid}}">
+        <div class="font-weight-bold">
+            Recent Measurements
+        </div>
+        <?php
+        $date = date('Y-m-d');
+        $end = strtotime($date);
+        $start = date_sub(date_create($date), date_interval_create_from_date_string("12 days"))->getTimestamp();
+        $start *= 1000;
+        $end *= 1000;
+        $recentMeasurements = \App\Models\Measurement
+            ::where('client_id', $patient->id)
+            ->whereRaw("(is_removed IS NULL OR is_removed = FALSE)")
+            ->whereNotNull('ts')
+            ->whereRaw("(is_cellular_zero IS NULL OR is_cellular_zero = FALSE)")
+            ->whereRaw("(label = 'BP' OR label = 'Wt. (lbs.)')")
+            ->where('ts', '>=', $start)
+            ->where('ts', '<=', $end)
+            ->orderBy('ts', 'desc')
+            ->skip(0)
+            ->take(10)
+            ->get();
+        ?>
+        @if($recentMeasurements && count($recentMeasurements))
+            <div class="pt-2">
+                @foreach($recentMeasurements as $m)
+                    @if($m->label === 'BP')
+                        <div class="text-sm text-nowrap">BP: {{round($m->sbp_mm_hg)}}/{{round($m->dbp_mm_hg)}} ({{date('m/d/Y', $m->ts/1000)}})</div>
+                    @elseif($m->label === 'Wt. (lbs.)')
+                        <div class="text-sm text-nowrap">Wt: {{round($m->value, 1)}} ({{date('m/d/Y', $m->ts/1000)}})</div>
+                    @endif
+                @endforeach
+            </div>
+        @endif
+    </div>
+
     <?php
     $allergies = \App\Models\Point::getPointsOfCategory($patient, "ALLERGY");
     $medications = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
@@ -13,7 +60,7 @@
          open-in-stag-popup
          mc-initer="allergies-center-{{$note->id}}"
          title="Allergies Center"
-         popup-style="medium-large overflow-visible"
+         popup-style="overflow-visible"
          href="/allergies-center/{{$patient->uid}}/{{$note->uid}}">
         <div class="font-weight-bold mb-2">
             Allergies
@@ -44,7 +91,7 @@
          open-in-stag-popup
          mc-initer="medications-center-{{$note->id}}"
          title="Medications Center"
-         popup-style="medium-large overflow-visible"
+         popup-style="overflow-visible"
          href="/medications-center/{{$patient->uid}}/{{$note->uid}}">
         <div class="font-weight-bold mb-2">
             Medications
@@ -72,7 +119,7 @@
          open-in-stag-popup
          mc-initer="problems-center-{{$note->id}}"
          title="Problems Center"
-         popup-style="medium-large overflow-visible"
+         popup-style="overflow-visible"
          href="/problems-center/{{$patient->uid}}/{{$note->uid}}">
         <div class="font-weight-bold mb-2">
             Problems
@@ -95,7 +142,7 @@
          open-in-stag-popup
          mc-initer="goals-center-{{$note->id}}"
          title="Goals Center"
-         popup-style="medium-large overflow-visible"
+         popup-style="overflow-visible"
          href="/goals-center/{{$patient->uid}}/{{$note->uid}}">
         <div class="font-weight-bold mb-2">
             Goals
@@ -118,7 +165,7 @@
          open-in-stag-popup
          mc-initer="careteam-center-{{$note->id}}"
          title="Care Team Center"
-         popup-style="medium-large overflow-visible"
+         popup-style="overflow-visible"
          href="/careteam-center/{{$patient->uid}}/{{$note->uid}}">
         <div class="font-weight-bold">
             Care Team
@@ -126,12 +173,12 @@
         </div>
     </div>
     <div id="note-prescriptions" class="p-2 border-bottom c-pointer on-hover-aliceblue {{$note->is_signed_by_hcp ? 'events-none' : ''}}" data-non-segment-target="Prescriptions">
-        <div class="font-weight-bold mb-2">
+        <div class="font-weight-bold">
             ERx &amp; Orders
         </div>
         @if($prescriptions && count($prescriptions))
             @foreach($prescriptions as $prescription)
-                <div class="d-flex align-items-baseline px-1">
+                <div class="d-flex align-items-baseline px-1 pt-2">
                     <span class="mr-2 text-secondary text-sm font-weight-bold">{{$prescription->erx_category}}</span>
                     <?php $parsed = json_decode($prescription->clinical_detail_json) ?>
                     <span class="flex-grow-1">
@@ -161,8 +208,6 @@
                     </span>
                 </div>
             @endforeach
-        @else
-            <span class="px-1 text-secondary">-</span>
         @endif
     </div>
 

+ 6 - 2
resources/views/app/patient/note/segment-slim.blade.php

@@ -10,11 +10,15 @@ $isOmegaSystemSegment = (strpos($iName, 'omega_') === 0 && substr($iName, -7) ==
      data-segment-template-uid="{{ $segment->segmentTemplate->uid }}"
      data-segment-template-name="{{ $segment->segmentTemplate->internal_name }}">
 
-    <div class="d-flex align-items-start bg-light text-secondary p-1">
+    <div class="d-flex align-items-start bg-light text-secondary {{$segment->heading ? 'p-1' : 'py-1 pr-1'}}">
 
     <!-- title -->
 
-            <div style="color: black; text-decoration: underline; font-size: 13px;" class="font-weight-bold mr-2 {{$segment->heading ? 'min-width-110px' : 'min-width-140px'}}">
+            <?php
+            $extraClass = $segment->heading ? 'min-width-110px' : 'min-width-140px pl-2';
+            ?>
+
+            <div class="text-dark font-weight-bold font-size-13 mr-2 {{$extraClass}}">
                 {{$segment->display_title}}:
             </div>
 

+ 261 - 0
resources/views/app/patient/partials/incoming-reports.blade.php

@@ -0,0 +1,261 @@
+<div id="incoming-reports">
+    @if(!request()->input('documentViewFromNote'))
+    <div class="d-flex align-items-center pb-2">
+        <h4 class="font-weight-bold text-secondary m-0 font-size-14">Incoming Reports</h4>
+        <span class="mx-2 text-secondary">|</span>
+        <div moe>
+            <a start show class="">Upload</a>
+            <form url="/api/incomingReport/create"
+                  method="post"
+                  enctype="multipart/form-data">
+                <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
+                @if(request()->input('noteUid'))
+                    <input type="hidden" name="noteUid" value="{{ request()->input('noteUid') }}">
+                @endif
+                <div class="mb-2">
+                    <label for="" class="text-sm text-secondary mb-1">Category</label>
+                    <input type="text" class="form-control form-control-sm" name="category"
+                           value="" placeholder="Category">
+                </div>
+                <div class="mb-2">
+                    <label for="" class="text-sm text-secondary mb-1">Sub-category</label>
+                    <input type="text" class="form-control form-control-sm" name="subcategory"
+                           value="" placeholder="Sub-category">
+                </div>
+                <div class="mb-2">
+                    <label for="" class="text-sm text-secondary mb-1">Report Date</label>
+                    <input type="text" class="form-control form-control-sm stag-dp" name="reportDate"
+                           value="" placeholder="Report Date">
+                </div>
+                <div class="mb-2">
+                    <label for="" class="text-sm text-secondary mb-1">Title *</label>
+                    <input type="text" class="form-control form-control-sm" name="title"
+                           value="" placeholder="Title" required>
+                </div>
+                <div class="mb-2">
+                    <label for="" class="text-sm text-secondary mb-1">File *</label>
+                    <input type="file" class="form-control form-control-sm" name="pdf"
+                           value="" placeholder="File" required>
+                </div>
+                <div class="mb-2">
+                    <label for="" class="text-sm text-secondary mb-1">Ordering Pro</label>
+                    <select name="hcpProUid" provider-search data-pro-uid="{{$pro->uid}}" data-pro-name="{{$pro->displayName()}}"
+                            class="form-control form-control-sm">
+                    </select>
+                </div>
+                <div class="mb-2">
+                    <label for="" class="text-sm text-secondary mb-1">Memo</label>
+                    <input type="text" class="form-control form-control-sm" name="memo"
+                           value="" placeholder="Memo">
+                </div>
+                <div class="d-flex align-items-center">
+                    <button class="btn btn-sm btn-primary mr-2" type="button" submit>Save</button>
+                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                </div>
+            </form>
+        </div>
+    </div>
+    @endif
+    <div class="d-flex align-items-start h-100">
+        <div class="flex-grow-1">
+            @if(!request()->input('documentViewFromNote'))
+            <table class="table table-striped table-sm table-bordered mb-0">
+                <thead class="bg-light">
+                <tr>
+                    <th class="border-0 text-secondary">Created</th>
+                    <th class="border-0 text-secondary">Pro</th>
+                    <th class="border-0 text-secondary">Title</th>
+                    <th class="border-0 text-secondary">Report Date</th>
+                    <th class="border-0 text-secondary">Sign</th>
+                    <th class="border-0 text-secondary">Category</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($patient->incomingReports as $document)
+                    <tr class="{{$document->is_entry_error ? 'entry-error' : ''}} {{@$currentReport->uid === $document->uid ? 'bg-aliceblue' : ''}}">
+                        <td>
+                            {{ friendly_date_time($document->created_at, false) }}
+                            @if(request()->input('noteUid') && $document->note && $document->note->uid === request()->input('noteUid'))
+                                <div class="mt-1 text-info text-sm">Created on this note</div>
+                            @endif
+                        </td>
+                        <td>
+                            {{$document->hcp ? $document->hcp->displayName() : '-'}}
+                        </td>
+                        <td>
+                            @if(@$note)
+                                <a open-in-stag-popup
+                                   popup-style="stag-popup-md overflow-visible"
+                                   mc-initer="incoming-reports"
+                                   title="Incoming Report: {{ $document->title ? $document->title : '(not set)' }}"
+                                   href="{{route('patients.view.incoming-reports', ['patient' => $patient, 'currentReport' => $document])}}?noteUid={{request()->input('noteUid') ?: ''}}&{{ @$note ? 'documentViewFromNote=1' : '' }}"
+                                   class="{{@$currentReport->uid === $document->uid ? 'font-weight-bold' : ''}}">
+                                    {{ $document->title ? $document->title : '(not set)' }}
+                                </a>
+                            @else
+                                <a mc-initer="incoming-reports"
+                                   href="{{route('patients.view.incoming-reports', ['patient' => $patient, 'currentReport' => $document])}}{{request()->input('noteUid') ? '?noteUid=' . request()->input('noteUid') : ''}}"
+                                   class="{{@$currentReport->uid === $document->uid ? 'font-weight-bold' : ''}}">
+                                    {{ $document->title ? $document->title : '(not set)' }}
+                                </a>
+                            @endif
+                        </td>
+                        <td>{{ friendly_date_time($document->report_date, false) }}</td>
+                        <td>
+                            @if(!$document->has_hcp_pro_signed)
+                                -
+                            @else
+                                <div class="text-success mb-1">
+                                    <i class="fa fa-check"></i>
+                                    Signed
+                                </div>
+                                @if($document->hcp)
+                                    <div class="text-secondary">
+                                        <div class="text-sm font-weight-bold">{{$document->hcp->displayName()}}</div>
+                                        <div class="text-sm">{{friendlier_date_time($document->hcp_pro_signed_at)}}</div>
+                                    </div>
+                                @endif
+                            @endif
+                        </td>
+                        <td>{{ $document->category }}{{ $document->subcategory ? ' / ' . $document->subcategory : '' }}</td>
+                    </tr>
+                @endforeach
+                @if(!count($patient->incomingReports))
+                    <tr>
+                        <td colspan="6">No records found.</td>
+                    </tr>
+                @endif
+                </tbody>
+            </table>
+            @endif
+        </div>
+        @if(@$currentReport)
+            <div class="{{ request()->input('documentViewFromNote') ? '' : 'min-width-700px max-width-700px ml-2' }} border align-self-stretch p-3">
+                <div class="d-flex align-items-center">
+                    <h3 class="font-size-16 m-0 flex-grow-1 text-ellipsis">{{$currentReport->title ? $currentReport->title : '(not set)'}}</h3>
+                    <div class="d-inline-flex align-items-center ml-auto flex-nowrap mr-2 border-right">
+                        <a class="on-hover-opaque mr-2 pr-1 d-inline-block" native target="_blank"
+                           href="/api/incomingReport/download/{{ $currentReport->uid }}"
+                           title="Download"><i class="fa fa-download"></i></a>
+                        @if(!$currentReport->has_hcp_pro_signed && $currentReport->hcp_pro_id === $pro->id)
+                            <div moe relative class="mr-2 pr-1">
+                                <a href="#" start show class="" title="Sign"><i class="fa fa-signature text-success"></i></a>
+                                <form url="/api/incomingReport/signAsHcp" right>
+                                    <input type="hidden" name="uid" value="{{ $currentReport->uid }}">
+                                    <p class="small">Are you sure you want to sign this report as HCP?</p>
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-success mr-2" submit>Sign</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                        @endif
+                        @if(!$currentReport->has_hcp_pro_signed)
+                            <div moe relative class="mr-2 pr-1">
+                                <a href="#" start show class="on-hover-opaque" title="Edit"><i class="fa fa-edit text-primary"></i></a>
+                                <form url="dummy" action="/api/incomingReport/updateBasic"
+                                      right
+                                      method="post"
+                                      onsubmit="return submitIncomingReport(this)"
+                                      enctype="multipart/form-data">
+                                    <input type="hidden" name="uid" value="{{ $currentReport->uid }}">
+
+                                    <div class="mb-2">
+                                        <label for="" class="text-sm text-secondary mb-1">Category</label>
+                                        <input type="text" class="form-control form-control-sm" name="category"
+                                               value="{{$currentReport->category}}" placeholder="Category">
+                                    </div>
+                                    <div class="mb-2">
+                                        <label for="" class="text-sm text-secondary mb-1">Sub-category</label>
+                                        <input type="text" class="form-control form-control-sm" name="subcategory"
+                                               value="{{$currentReport->subcategory}}" placeholder="Sub-category">
+                                    </div>
+                                    <div class="mb-2">
+                                        <label for="" class="text-sm text-secondary mb-1">Report Date</label>
+                                        <input type="date" class="form-control form-control-sm" name="reportDate"
+                                               value="{{$currentReport->reportDate}}" placeholder="Report Date">
+                                    </div>
+                                    <div class="mb-2">
+                                        <label for="" class="text-sm text-secondary mb-1">Title *</label>
+                                        <input type="text" class="form-control form-control-sm" name="title"
+                                               value="{{$currentReport->title}}" placeholder="Title" required>
+                                    </div>
+                                    <div class="mb-2">
+                                        <label for="" class="text-sm text-secondary mb-1">File *</label>
+                                        <input type="file" class="form-control form-control-sm" name="pdf"
+                                               value="" placeholder="File">
+                                        <span class="text-sm text-secondary">Leave blank if not changing</span>
+                                    </div>
+                                    <div class="mb-2">
+                                        <label for="" class="text-sm text-secondary mb-1">HCP Pro</label>
+                                        <select name="hcpProUid" provider-search
+                                                data-pro-name="{{$currentReport->hcp ? $currentReport->hcp->displayName() : ''}}"
+                                                class="form-control form-control-sm">
+                                        </select>
+                                    </div>
+                                    <div class="mb-2">
+                                        <label for="" class="text-sm text-secondary mb-1">Memo</label>
+                                        <input type="text" class="form-control form-control-sm" name="memo"
+                                               value="{{$currentReport->memo}}" placeholder="Memo">
+                                    </div>
+
+                                    <div class="d-flex align-items-center">
+                                        <button class="btn btn-sm btn-primary mr-2" type="submit">Save</button>
+                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                            @if(!$currentReport->is_entry_error)
+                                <div moe relative class="mr-2 pr-1">
+                                    <a href="#" start show class="on-hover-opaque" title="Mark as entry-error"><i class="fa fa-ban text-danger"></i></a>
+                                    <form url="/api/incomingReport/setIsEntryErrorToTrue" right>
+                                        <input type="hidden" name="uid" value="{{ $currentReport->uid }}">
+                                        <p class="small">Are you sure you want to set this report as entry error?</p>
+                                        <div class="d-flex align-items-center">
+                                            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @else
+                                <div moe relative class="mr-2">
+                                    <a href="#" start show class="on-hover-opaque" title="Undo mark as entry-error"><i class="fa fa-undo"></i></a>
+                                    <form url="/api/incomingReport/setIsEntryErrorToFalse" right>
+                                        <input type="hidden" name="uid" value="{{ $currentReport->uid }}">
+                                        <p class="small">Are you sure you want to set unset this report as entry error?</p>
+                                        <div class="d-flex align-items-center">
+                                            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @endif
+                        @endif
+                    </div>
+                    @if(!request()->input('documentViewFromNote'))
+                    <a class="ml-auto" mc-initer="incoming-reports" href="{{route('patients.view.incoming-reports', ['patient' => $patient, 'currentReport' => null])}}{{request()->input('noteUid') ? '?noteUid=' . request()->input('noteUid') : ''}}">
+                        <i class="fa fa-times-circle on-hover-opaque"></i>
+                    </a>
+                    @endif
+                </div>
+                <hr class="mt-3 mb-0 row">
+                <div class="pdf-viewer-auto row px-3" pdf-url="/api/incomingReport/download/{{ $currentReport->uid }}"></div>
+            </div>
+        @endif
+    </div>
+</div>
+@include('app/pdf/viewer')
+<script>
+    (function() {
+        function init() {
+            $('#incoming-reports').find('input.stag-dp')
+                .prop('readonly', true)
+                .addClass('bg-white')
+                .datepicker({
+                    dateFormat: 'yy-mm-dd'
+                });
+            runMCInitializer('inline-pdf-viewer');
+        }
+        addMCInitializer('incoming-reports', init, '#incoming-reports')
+    }).call(window);
+</script>

+ 1 - 1
resources/views/app/patient/point-based-partials/rx.blade.php

@@ -15,7 +15,7 @@ $medications = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
                update-parent
                mc-initer="medications-center-{{$patient->coreNote->id}}"
                title="Medications Center"
-               popup-style="medium-large overflow-visible"
+               popup-style="overflow-visible"
                href="/medications-center/{{$patient->uid}}/{{$patient->coreNote->uid}}">
                 <i class="fa fa-bolt mr-1"></i>
                 <span>Manage</span>

+ 35 - 36
resources/views/app/patient/prescriptions/list.blade.php

@@ -25,6 +25,12 @@
         @else
             <span class="ml-3 text-warning-mellow">MCP not set on the patient</span>
         @endif
+        <div class="ml-5 width-200px">
+            <select class="form-control form-control-sm" v-model="includeCancelled">
+                <option value="">Exclude Cancelled</option>
+                <option value="include-cancelled">Include Cancelled</option>
+            </select>
+        </div>
     </div>
     <div class="d-flex align-items-start bg-white">
         <div :class="currentPrescription ? 'max-width-300px' : 'flex-grow-1'">
@@ -40,24 +46,24 @@
                 </tr>
                 </thead>
                 <tbody>
-                <tr v-for="(prescription, index) in prescriptions" :class="currentPrescription && currentPrescription.id === prescription.id ? 'bg-aliceblue' : ''">
+                <tr v-for="(prescription, index) in prescriptions"
+                    v-if="includeCancelled === 'include-cancelled' || prescription.pro_declared_status !== 'CANCELLED'"
+                    :class="currentPrescription && currentPrescription.id === prescription.id ? 'bg-aliceblue' : ''">
                     <td class="width-150px" :class="currentPrescription && currentPrescription.id === prescription.id ? 'row-selection-highlight' : ''">
                         <div :class="prescription.pro_declared_status === 'CANCELLED' ? 'on-hover-opaque' : ''">
                             <a href="#" v-on:click.prevent="setCurrentPrescription(prescription, '');"
                                class="text-nowrap"
                                :class="currentPrescription && currentPrescription.id === prescription.id ? 'font-weight-bold' : ''">
                                 @{{prescription.created_at_friendly_short}}
-                            </a>
-                            <div class="mt-1">
+                                |
                                 <b class="text-sm">@{{prescription.erx_category}}</b>
-                                /
-                                <span class="text-sm">@{{prescription.hcpProDisplayName}}</span>
-                            </div>
+                            </a>
+                            <div v-if="currentPrescription" class="text-sm">@{{prescription.hcpProDisplayName}}</div>
                             @if(@$note)
-                                <div v-if="prescription.note_id === {{$note->id}}" class="text-sm text-info mt-1 text-nowrap">* From this note</div>
+                                <div v-if="prescription.note_id === {{$note->id}}" class="text-sm text-info text-nowrap">* From this note</div>
                             @endif
                         </div>
-                        <div v-if="prescription.pro_declared_status === 'CANCELLED'" class="text-sm text-secondary font-weight-bold mt-1 text-sm d-flex align-items-baseline">
+                        <div v-if="currentPrescription && prescription.pro_declared_status === 'CANCELLED'" class="text-sm text-secondary font-weight-bold mt-1 text-sm d-flex align-items-baseline">
                             <i class="fa fa-ban mr-1 text-sm"></i>
                             CANCELLED
                         </div>
@@ -134,30 +140,18 @@
         </div>
         <div v-if="currentPrescription" class="border-top border-right border-bottom align-self-stretch p-3 flex-grow-1 min-width-50">
             <div class="d-flex align-items-center">
-                <h3 class="font-size-16 m-0">
-                    <b class="mr-1 font-size-16">@{{ currentPrescription.erx_category }} ERx <span class="ml-2">@{{ currentPrescription.created_at_friendly_short }}</span></b>
+                <h3 class="font-size-16 m-0 d-flex align-items-baseline">
+                    <b class="mr-1 font-size-16">@{{ currentPrescription.erx_category }} ERx <span class="ml-2">@{{ currentPrescription.created_at_friendly }}</span></b>
+                    @if(@$note)
+                        <div v-if="currentPrescription.note_id === {{$note->id}}" class="text-info mt-1 font-weight-bold text-nowrap ml-2">* From this note</div>
+                    @endif
                 </h3>
                 <a class="ml-auto" href="#" v-on:click.prevent="setCurrentPrescription(null);">
                     <i class="fa fa-times-circle on-hover-opaque"></i>
                 </a>
             </div>
             <hr class="my-3">
-            <div class="pb-2 d-flex align-items-start">
-                <span class="min-width-140px text-secondary text-sm">Created</span>
-                <div>
-                    <span class="text-nowrap">@{{currentPrescription.created_at_friendly}}</span>
-                    @if(@$note)
-                        <div v-if="currentPrescription.note_id === {{$note->id}}" class="text-info mt-1 font-weight-bold text-nowrap">* From this note</div>
-                    @endif
-                </div>
-            </div>
-            @if(!request()->input('erx_category'))
-            <div class="pb-2 d-flex align-items-center">
-                <span class="min-width-140px text-secondary text-sm">Type</span>
-                <span>@{{currentPrescription.erx_category}}</span>
-            </div>
-            @endif
-            <div class="pb-2 d-flex align-items-baseline" v-if="currentPrescription.erx_category !== 'DRUG'">
+            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category !== 'DRUG'">
                 <span class="min-width-140px text-secondary text-sm">Clinical</span>
                 <div class="d-inline-flex align-items-baseline flex-grow-1">
                     <a v-if="!currentPrescription.has_hcp_pro_signed" class="mr-2" href="#" v-on:click.prevent="editClinicalDetails(currentPrescription)"><i class="fa fa-edit on-hover-opaque"></i></a>
@@ -196,8 +190,7 @@
                     <div v-else>-</div>
                 </div>
             </div>
-            <div class="pb-2 d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'DRUG'">
-                <span class="min-width-140px text-secondary text-sm">Medications</span>
+            <div class="d-flex align-items-baseline" v-if="currentPrescription.erx_category === 'DRUG'">
                 <div class="flex-grow-1">
 
                     <div v-if="currentPrescription.clinical_detail_json">
@@ -210,12 +203,12 @@
                                 <div class="d-flex align-items-baseline">
                                     <b class="mr-2">@{{drug.medication ?? '-'}}</b>
                                 </div>
-                                <div v-if="drug.instructions" class="d-flex align-items-baseline text-secondary font-italic">
-                                    @{{ drug.instructions }}
+                                <div v-if="drug.instructions" class="d-inline-flex align-items-baseline text-secondary font-italic mr-2">
+                                    <span class="text-secondary">Instructions: @{{ drug.instructions }}</span>
                                 </div>
                                 <div class="d-flex align-items-baseline">
                                     <span class="text-secondary">Dispense:</span>
-                                    <span class="ml-1">@{{ drug.dispense ? drug.dispense : '-' }}</span>
+                                    <span class="ml-1 mr-2">@{{ drug.dispense ? drug.dispense : '-' }}</span>
                                     <span class="text-secondary ml-2">Refills:</span>
                                     <span class="ml-1">@{{ drug.refills ? drug.refills : '-' }}</span>
                                 </div>
@@ -224,7 +217,7 @@
                     </div>
 
                     @if(@$note)
-                    <div class="d-flex align-items-center mt-3" v-if="!currentPrescription.has_hcp_pro_signed">
+                    <div class="d-flex align-items-center" v-if="!currentPrescription.has_hcp_pro_signed">
                         <a href="#" class="d-block mb-1 mr-2" v-on:click.prevent="setAddMode('existing')">+ Existing</a>
                         <a href="#" class="d-block mb-1" v-on:click.prevent="setAddMode('new')">+ New</a>
                     </div>
@@ -242,7 +235,7 @@
                 <table class="m-0 table table-sm border bg-white table-hover table-bordered">
                     <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">Instructions</th>
                         <th class="align-bottom">Dispense</th>
                         <th class="align-bottom">Refills</th>-->
                         <th class="align-bottom text-secondary">Instructions/Dispense/Refills</th>
@@ -252,7 +245,7 @@
                         <td class="width-200px">@{{ drug.data.name }}</td>
                         <td>
                             <div class="d-flex align-items-center mb-1">
-                                <span class="text-sm min-width-80px">Instructions<br>to Pharmacist</span>
+                                <span class="text-sm min-width-80px">Instructions</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">
@@ -321,7 +314,7 @@
                     </div>
                     <div class="row mb-2">
                         <div class="col-12">
-                            <label class="text-sm text-secondary mb-0">Instructions To Pharmacist</label>
+                            <label class="text-sm text-secondary mb-0">Instructions</label>
                             <input type="text" data-name="instructions"
                                    class="form-control form-control-sm min-width-unset">
                         </div>
@@ -512,6 +505,8 @@ GROUP BY erx_category");
                 delimiters: ['@{{', '}}'],
                 data: {
 
+                    includeCancelled: '',
+
                     prescriptions: <?= json_encode($prescriptions) ?>,
 
                     numUnsigned: <?= json_encode($uCounts) ?>,
@@ -754,6 +749,7 @@ GROUP BY erx_category");
                         };
                         $.post('/api/erx/updateProDeclaredStatus', payload, _data => {
                             if(!hasResponseError(_data)) {
+                                localStorage['currentErx_{{$note->id}}'] = 0;
                                 closeStagPopup();
                                 fastReload();
                             }
@@ -769,12 +765,13 @@ GROUP BY erx_category");
                             let payload = {
                                 noteUid: '{{ @$note ? $note->uid : '' }}',
                                 clientUid: '{{$patient->uid}}',
-                                hcpProUid: '{{$patient->mcp ? $patient->mcp->uid : ''}}',
+                                hcpProUid: '{{@$note && $note->hcpPro ? $note->hcpPro->uid : ($patient->mcp ? $patient->mcp->uid : '')}}',
                                 erxCategory: _type
                             };
                             $.post('/api/erx/create', payload, _data => {
                                 if(!hasResponseError(_data)) {
                                     localStorage.autoOpenNewestPrescription = 1;
+                                    localStorage['currentErx_{{$note->id}}'] = 0;
                                     fastReload();
                                 }
                             }, 'json');
@@ -1141,6 +1138,8 @@ GROUP BY erx_category");
                         $.post('/api/erx/create', payload, _data => {
                             if(!hasResponseError(_data)) {
                                 toastr.success('Prescription added');
+                                localStorage.autoOpenNewestPrescription = 1;
+                                localStorage['currentErx_{{$note->id}}'] = 0;
                                 closeStagPopup();
                                 fastReload();
                             }

+ 68 - 66
resources/views/app/patient/problems-center.blade.php

@@ -70,7 +70,6 @@ if(!@$summaryView) {
                     <th class="border-bottom-0 text-secondary text-center width-30px">Rel.</th>
                 @endif
                 <th class="border-bottom-0 text-secondary">Name</th>
-                @if(!@$summaryView) <th class="border-bottom-0 text-secondary width-50px">Edit</th> @endif
                 <th class="border-bottom-0 text-secondary w-30">Subjective/HPI</th>
                 <th class="border-bottom-0 text-secondary w-30">Plan</th>
                 @if(!@$summaryView) <th class="border-bottom-0 text-secondary width-30px"></th> @endif
@@ -96,13 +95,77 @@ if(!@$summaryView) {
                     @include('app.patient.wizard-partials.relevance-column', ['point' => $point])
                 @endif
                 <td>
-                    <div class="d-flex align-items-baseline">
+                    <div class="d-flex align-items-start">
                         @include('app.patient.wizard-partials.state-icon', ['point' => $problem])
                         <div>
-                            <div>
-                                <b><?= !!@($problem->data->name) ? @($problem->data->name) : '-' ?></b>
+                            @if(!@$summaryView)
+                                <div>
+                                    <div moe huge relative>
+                                        <a start show href="#" title="Edit">
+                                            <?= !!@($problem->data->name) ? @($problem->data->name) : '-' ?>
+                                            <?= !!@($problem->data->icd) ? '/&nbsp;' . @($problem->data->icd) : '' ?>
+                                        </a>
+                                        <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-problem">
+                                            <input type="hidden" name="uid" value="<?= $problem->uid ?>">
+                                            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
+                                            <p class="mb-2"><b>Update Problem</b></p>
+
+                                            <input type="hidden" name="data" value='{{json_encode($problem->data)}}'>
+
+                                            @if($problem->added_in_note_id === $note->id)
+
+                                                <input type="hidden" data-name="dxid" value="{{@$problem->data->dxid}}">
+                                                <input type="hidden" data-name="icd-type" value="{{@$problem->data->{'icd-type'} }}">
+
+                                                <div class="row mb-2">
+                                                    <div class="col-8 pr-0">
+                                                        <label class="text-sm mb-0 font-weight-bold">Problem</label>
+                                                        <input type="text" class="form-control form-control-sm min-width-unset"
+                                                               data-name="name"
+                                                               value="{{@$problem->data->name}}"
+                                                               stag-suggest
+                                                               stag-suggest-ep="/fdb-dx-suggest-v2/json"
+                                                               stag-suggest-text-only>
+                                                    </div>
+                                                    <div class="col-4">
+                                                        <label class="text-sm mb-0 font-weight-bold">ICD</label>
+                                                        <input type="text"
+                                                               data-name="icd"
+                                                               class="form-control form-control-sm"
+                                                               value="{{@$problem->data->icd}}"
+                                                               readonly>
+                                                    </div>
+                                                </div>
+
+                                            @else
+
+                                                <div class="mb-2 bg-light p-2 border">
+                                                    <p class="mb-1 font-weight-bold">
+                                                        {{ @$problem->data->name }}
+                                                    </p>
+                                                    @if($patient->core_note_id !== $note->id)
+                                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the problem was added prior to this visit.</div>
+                                                    @else
+                                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the problem was added on a previous visit.</div>
+                                                    @endif
+                                                </div>
+
+                                            @endif
+
+                                            @include('app.patient.wizard-partials.common-fields', ['label' => 'problem', 'point' => $problem, 'addVerbPT' => 'Diagnosed', 'reviewLabel' => 'Subjective/HPI', 'apTerm' => 'assessment/plan'])
+
+                                            <div class="mt-3 pt-2 d-flex align-items-center border-top">
+                                                <button type="submit" class="btn-save-problem btn btn-sm btn-primary mr-2">Save</button>
+                                                <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                </div>
+                            @else
+                                <?= !!@($problem->data->name) ? @($problem->data->name) : '-' ?>
                                 <?= !!@($problem->data->icd) ? '/&nbsp;' . @($problem->data->icd) : '' ?>
-                            </div>
+                            @endif
+
                             @include('app.patient.wizard-partials.state-badge', ['point' => $problem, 'addedVerb' => 'Diagnosed'])
                         </div>
                         @if(!@$summaryView)
@@ -133,67 +196,6 @@ if(!@$summaryView) {
                         @endif
                     </div>
                 </td>
-                @if(!@$summaryView)
-                <td>
-                    <div moe huge relative>
-                        <a start show href="#" title="Edit">Edit</a>
-                        <form url="/api/visitPoint/updateTopLevel" class="mcp-theme-1 frm-edit-problem">
-                            <input type="hidden" name="uid" value="<?= $problem->uid ?>">
-                            <input type="hidden" name="noteUid" value="<?= $note->uid ?>">
-                            <p class="mb-2"><b>Update Problem</b></p>
-
-                            <input type="hidden" name="data" value='{{json_encode($problem->data)}}'>
-
-                            @if($problem->added_in_note_id === $note->id)
-
-                                <input type="hidden" data-name="dxid" value="{{@$problem->data->dxid}}">
-                                <input type="hidden" data-name="icd-type" value="{{@$problem->data->{'icd-type'} }}">
-
-                                <div class="row mb-2">
-                                    <div class="col-8 pr-0">
-                                        <label class="text-sm mb-0 font-weight-bold">Problem</label>
-                                        <input type="text" class="form-control form-control-sm min-width-unset"
-                                               data-name="name"
-                                               value="{{@$problem->data->name}}"
-                                               stag-suggest
-                                               stag-suggest-ep="/fdb-dx-suggest-v2/json"
-                                               stag-suggest-text-only>
-                                    </div>
-                                    <div class="col-4">
-                                        <label class="text-sm mb-0 font-weight-bold">ICD</label>
-                                        <input type="text"
-                                               data-name="icd"
-                                               class="form-control form-control-sm"
-                                               value="{{@$problem->data->icd}}"
-                                               readonly>
-                                    </div>
-                                </div>
-
-                            @else
-
-                                <div class="mb-2 bg-light p-2 border">
-                                    <p class="mb-1 font-weight-bold">
-                                        {{ @$problem->data->name }}
-                                    </p>
-                                    @if($patient->core_note_id !== $note->id)
-                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the problem was added prior to this visit.</div>
-                                    @else
-                                        <div class="text-secondary text-sm">Clinical details cannot be modified since the problem was added on a previous visit.</div>
-                                    @endif
-                                </div>
-
-                            @endif
-
-                            @include('app.patient.wizard-partials.common-fields', ['label' => 'problem', 'point' => $problem, 'addVerbPT' => 'Diagnosed', 'reviewLabel' => 'Subjective/HPI', 'apTerm' => 'assessment/plan'])
-
-                            <div class="mt-3 pt-2 d-flex align-items-center border-top">
-                                <button type="submit" class="btn-save-problem btn btn-sm btn-primary mr-2">Save</button>
-                                <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
-                            </div>
-                        </form>
-                    </div>
-                </td>
-                @endif
                 <td>
                     <?php
                     $segment = $note->getSegmentByInternalName('intake_problems');

+ 3 - 3
resources/views/app/patient/segment-templates/_child_review/delete-review.php

@@ -1,11 +1,11 @@
 <div visit-moe relative class="d-block">
-    <a start show href="#" class="px-1" title="Delete Subjective">
-        Delete Subjective
+    <a start show href="#" class="px-1" title="Undo Changes">
+        <i class="fa fa-undo"></i> Undo Changes
     </a>
     <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1">
         <input type="hidden" name="uid" value="<?= $point->uid ?>">
 
-        <p class="mb-2">Delete this subjective?</p>
+        <p class="mb-2">Undo Changes?</p>
 
         <div>
             <button submit class="btn btn-sm btn-danger mr-2">Delete</button>

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

@@ -64,13 +64,13 @@ else {
     </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">
+            <a start show href="#" class="pl-2 pr-1 text-center d-block" title="Undo Changes">
                 <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>
+                <p class="mb-2">Undo Changes?</p>
 
                 <div>
                     <button submit class="btn btn-sm btn-danger mr-2">Delete</button>

+ 2 - 2
resources/views/app/patient/segment-templates/_child_review/edit-review.php

@@ -68,13 +68,13 @@ else {
 </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">
+        <a start show href="#" class="px-1 text-center d-block" title="Undo Changes">
             <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>
+            <p class="mb-2">Undo Changes?</p>
 
             <div>
                 <button submit class="btn btn-sm btn-danger mr-2">Delete</button>

+ 3 - 3
resources/views/app/patient/segment-templates/_child_review/nutrition/DAILY_INTAKE_CALORIES/edit-review.php

@@ -64,13 +64,13 @@ if (@$point) {
 </div>
 <?php if(!empty($currentValue)): ?>
     <div visit-moe relative class="d-block">
-        <a start show href="#" class="px-1 text-left" title="Delete Subjective">
-            Delete Subjective
+        <a start show href="#" class="px-1 text-left" title="Undo Changes">
+            <i class="fa fa-undo"></i> Undo Changes
         </a>
         <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
 
-            <p class="mb-2">Delete this subjective?</p>
+            <p class="mb-2">Undo Changes?</p>
 
             <div>
                 <button submit class="btn btn-sm btn-danger mr-2">Delete</button>

+ 3 - 3
resources/views/app/patient/segment-templates/_child_review/nutrition/DAILY_INTAKE_CARBOHYDRATES/edit-review.php

@@ -64,13 +64,13 @@ if (@$point) {
 </div>
 <?php if(!empty($currentValue)): ?>
     <div visit-moe relative class="d-block">
-        <a start show href="#" class="px-1 text-left" title="Delete Subjective">
-            Delete Subjective
+        <a start show href="#" class="px-1 text-left" title="Undo Changes">
+            <i class="fa fa-undo"></i> Undo Changes
         </a>
         <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
 
-            <p class="mb-2">Delete this subjective?</p>
+            <p class="mb-2">Undo Changes?</p>
 
             <div>
                 <button submit class="btn btn-sm btn-danger mr-2">Delete</button>

+ 3 - 3
resources/views/app/patient/segment-templates/_child_review/nutrition/FAST_FOOD/edit-review.php

@@ -71,13 +71,13 @@ if (@$point) {
 </div>
 <?php if(!empty($currentMealsPerWeek) || !empty($currentSelfPreparedMealsPerWeek)): ?>
     <div visit-moe relative class="d-block">
-        <a start show href="#" class="px-1 text-left" title="Delete Subjective">
-            Delete Subjective
+        <a start show href="#" class="px-1 text-left" title="Undo Changes">
+            <i class="fa fa-undo"></i> Undo Changes
         </a>
         <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
 
-            <p class="mb-2">Delete this subjective?</p>
+            <p class="mb-2">Undo Changes?</p>
 
             <div>
                 <button submit class="btn btn-sm btn-danger mr-2">Delete</button>

+ 3 - 3
resources/views/app/patient/segment-templates/_child_review/nutrition/HIGH_SUGAR_BEVERAGES/edit-review.php

@@ -62,13 +62,13 @@ if (@$point) {
 </div>
 <?php if(!empty($currentValue)): ?>
     <div visit-moe relative class="d-block">
-        <a start show href="#" class="px-1 text-left" title="Delete Subjective">
-            Delete Subjective
+        <a start show href="#" class="px-1 text-left" title="Undo Changes">
+            <i class="fa fa-undo"></i> Undo Changes
         </a>
         <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
 
-            <p class="mb-2">Delete this subjective?</p>
+            <p class="mb-2">Undo Changes?</p>
 
             <div>
                 <button submit class="btn btn-sm btn-danger mr-2">Delete</button>

+ 3 - 3
resources/views/app/patient/segment-templates/_child_review/nutrition/PORTION_SIZES/edit-review.php

@@ -64,13 +64,13 @@ if (@$point) {
 </div>
 <?php if(!empty($currentValue)): ?>
     <div visit-moe relative class="d-block">
-        <a start show href="#" class="px-1 text-left" title="Delete Subjective">
-            Delete Subjective
+        <a start show href="#" class="px-1 text-left" title="Undo Changes">
+            <i class="fa fa-undo"></i> Undo Changes
         </a>
         <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
 
-            <p class="mb-2">Delete this subjective?</p>
+            <p class="mb-2">Undo Changes?</p>
 
             <div>
                 <button submit class="btn btn-sm btn-danger mr-2">Delete</button>

+ 3 - 3
resources/views/app/patient/segment-templates/_child_review/nutrition/SNACKS/edit-review.php

@@ -71,13 +71,13 @@ if (@$point) {
 </div>
 <?php if(!empty($currentUnhealthySnacks) || !empty($currentHealthySnacks)): ?>
     <div visit-moe relative class="d-block">
-        <a start show href="#" class="px-1 text-left" title="Delete Subjective">
-            Delete Subjective
+        <a start show href="#" class="px-1 text-left" title="Undo Changes">
+            <i class="fa fa-undo"></i> Undo Changes
         </a>
         <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
 
-            <p class="mb-2">Delete this subjective?</p>
+            <p class="mb-2">Undo Changes?</p>
 
             <div>
                 <button submit class="btn btn-sm btn-danger mr-2">Delete</button>

+ 3 - 3
resources/views/app/patient/segment-templates/_child_review/nutrition/VEGETABLES/edit-review.php

@@ -64,13 +64,13 @@ if (@$point) {
 </div>
 <?php if(!empty($currentValue)): ?>
     <div visit-moe relative class="d-block">
-        <a start show href="#" class="px-1 text-left" title="Delete Subjective">
-            Delete Subjective
+        <a start show href="#" class="px-1 text-left" title="Undo Changes">
+            <i class="fa fa-undo"></i> Undo Changes
         </a>
         <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
 
-            <p class="mb-2">Delete this subjective?</p>
+            <p class="mb-2">Undo Changes?</p>
 
             <div>
                 <button submit class="btn btn-sm btn-danger mr-2">Delete</button>

+ 3 - 3
resources/views/app/patient/segment-templates/_child_review/nutrition/WATER_INTAKE/edit-review.php

@@ -64,13 +64,13 @@ if (@$point) {
 </div>
 <?php if(!empty($currentValue)): ?>
     <div visit-moe relative class="d-block">
-        <a start show href="#" class="px-1 text-left" title="Delete Subjective">
-            Delete Subjective
+        <a start show href="#" class="px-1 text-left" title="Undo Changes">
+            <i class="fa fa-undo"></i> Undo Changes
         </a>
         <form url="/api/visitPoint/destroyCurrentChildReview" class="mcp-theme-1">
             <input type="hidden" name="uid" value="<?= $point->uid ?>">
 
-            <p class="mb-2">Delete this subjective?</p>
+            <p class="mb-2">Undo Changes?</p>
 
             <div>
                 <button submit class="btn btn-sm btn-danger mr-2">Delete</button>

+ 12 - 1
resources/views/app/patient/segment-templates/informed_consent/edit.blade.php

@@ -23,8 +23,17 @@ if (!!@$point->data) {
             <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                 <input type="checkbox" data-name="informed_consent" {{@($contentData["informed_consent"] ? 'checked' : '')}}>
             </div>
-            <span>Informed consent for treatment obtained and patient questions answered.</span>
+            <span> This is a {{$note->method}} visit that was performed on {{friendly_date($note->effective_dateest)}}. Verbal consent to participate in a video visit was obtained.</span>
         </label>
+        
+        <div class="mb-2">
+            <div>This visit occurred during the Coronavirus (COVID-19) Public Health Emergency.</div>
+            <div>I discussed with the patient the nature of our visit, that:</div>
+            <div class="ml-3">- I would evaluate the patient and recommend diagnostics and treatments based on my assessment.</div>
+            <div class="ml-3">- Our sessions are not being recorded, and that personal health information is protected.</div>
+            <div class="ml-3">- Our team would provide follow-up care in person if/when the patient needs it.</div>
+            <div class="ml-3">- No physical exam was performed due to the remote nature of this evaluation.</div>
+        </div>
 
         <div class="pt-2">
             <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
@@ -38,3 +47,5 @@ if (!!@$point->data) {
         </div>
     </form>
 </div>
+
+

+ 12 - 1
resources/views/app/patient/segment-templates/informed_consent/summary.blade.php

@@ -22,5 +22,16 @@ if (!!@$point->data) {
             -
         @endif
     </div>
-    <span class="flex-grow-1">Informed consent for treatment obtained and patient questions answered.</span>
+    <span class="flex-grow-1">This is a {{$note->method}} visit that was performed on {{friendly_date($note->effective_dateest)}}. Verbal consent to participate in a video visit was obtained.</span>
 </div>
+
+@if(@($contentData["informed_consent"]))
+    <div class="mb-2">
+        <div>This visit occurred during the Coronavirus (COVID-19) Public Health Emergency.</div>
+        <div>I discussed with the patient the nature of our visit, that:</div>
+        <div class="ml-3">- I would evaluate the patient and recommend diagnostics and treatments based on my assessment.</div>
+        <div class="ml-3">- Our sessions are not being recorded, and that personal health information is protected.</div>
+        <div class="ml-3">- Our team would provide follow-up care in person if/when the patient needs it.</div>
+        <div class="ml-3">- No physical exam was performed due to the remote nature of this evaluation.</div>
+    </div>
+@endif

+ 6 - 7
resources/views/app/patient/segment-templates/omega_allergies/summary.blade.php

@@ -40,14 +40,13 @@ $plural = 'Allergies';
                 </div>
 		    </td>
             <td class="width-300px">
-                <div class="pl-3">
+                <div class="d-flex align-items-baseline pl-2">
                     <?php $review = $point->childReviewAddedInNote($note); ?>
                     <?php if(!!$review): ?>
-                            <span>{!! $review->data->value !!}</span>
+                        <span class="pr-2">{!! $review->data->value !!}</span>
                     <?php endif; ?>
-                </div>	
-                <div class="pl-3">
-                    <?php if ($point->is_removed): ?>
+                    <span>
+                        <?php if ($point->is_removed): ?>
                             @if($point->removal_reason_category === 'DURING_VISIT')
                                 <span class="text-sm text-secondary">Removed during visit</span>
                             @elseif($point->removal_reason_category === 'ON_INTAKE')
@@ -60,8 +59,8 @@ $plural = 'Allergies';
                                 <span class="text-sm text-info">* Added on intake</span>
                             <?php endif;?>
                         <?php endif; ?>
-                </div>	
-
+                    </span>
+                </div>
             </td>
             <td></td>
         </tr>

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

@@ -34,7 +34,7 @@ foreach ($points as $point) {
            href="/allergies-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="allergies-center-{{$note->id}}"
            title="Allergies Center"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Allergies
         </a>
         <div class="flex-grow-1 text-dark">
@@ -50,7 +50,7 @@ foreach ($points as $point) {
            href="/problems-center/{{$note->client->uid}}/{{$note->uid}}"
            mc-initer="problems-center-{{$note->id}}"
            title="Problems Center"
-           popup-style="medium-large overflow-visible">
+           popup-style="overflow-visible">
             Problems
         </a>
         <div class="flex-grow-1 text-dark">

+ 14 - 16
resources/views/app/patient/segment-templates/omega_care_team/summary.blade.php

@@ -34,29 +34,27 @@ $plural = 'Care team members';
                     <?= !!@($point->data->date) ? '&nbsp;/&nbsp;Date: ' . @($point->data->date) : '' ?>
                 </div>
             </td>
-            <td class="px-2 width-300px">
-                <div>
+            <td class="width-300px">
+                <div class="d-flex align-items-baseline pl-2">
                     <?php $review = $point->childReviewAddedInNote($note); ?>
                     <?php if(!!$review): ?>
-                        <div class="pl-3 mt-1 d-flex align-items-baseline">
-                            <span>{!! $review->data->value !!}</span>
-                        </div>
+                    <span class="pr-2">{!! $review->data->value !!}</span>
                     <?php endif; ?>
-                </div>
-                <div class="d-flex align-items-baseline">
-                    <?php if ($point->is_removed): ?>
+                    <span>
+                        <?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="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="text-sm text-secondary">Removed on intake</span>
                         @endif
-                    <?php elseif ($point->added_in_note_id === $note->id): ?>
+                        <?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>
-                        <?php else: ?>
-                            <span class="ml-2 text-sm text-info">* Added on intake</span>
-                        <?php endif;?>
-                    <?php endif; ?>
+                                <span class="text-sm text-success">* Added during visit</span>
+                            <?php else: ?>
+                                <span class="text-sm text-info">* Added on intake</span>
+                            <?php endif;?>
+                        <?php endif; ?>
+                    </span>
                 </div>
             </td>
             <td></td>

+ 14 - 16
resources/views/app/patient/segment-templates/omega_goals/summary.blade.php

@@ -29,29 +29,27 @@ $plural = 'Goals';
                     <?= !!@($point->data->goal) ? @($point->data->goal) : '-' ?>
                 </div>
             </td>
-            <td class="px-2 width-300px">
-                <div>
+            <td class="width-300px">
+                <div class="d-flex align-items-baseline pl-2">
                     <?php $review = $point->childReviewAddedInNote($note); ?>
                     <?php if(!!$review): ?>
-                        <div class="pl-3 mt-1 d-flex align-items-baseline">
-                            <span>{!! $review->data->value !!}</span>
-                        </div>
+                    <span class="pr-2">{!! $review->data->value !!}</span>
                     <?php endif; ?>
-                </div>
-                <div class="d-flex align-items-baseline">                
-                    <?php if ($point->is_removed): ?>
+                    <span>
+                        <?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="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="text-sm text-secondary">Removed on intake</span>
                         @endif
-                    <?php elseif ($point->added_in_note_id === $note->id): ?>
+                        <?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">* Prescribed during visit</span>
-                        <?php else: ?>
-                            <span class="ml-2 text-sm text-info">* Added on intake</span>
-                        <?php endif;?>
-                    <?php endif; ?>
+                                <span class="text-sm text-success">* Added during visit</span>
+                            <?php else: ?>
+                                <span class="text-sm text-info">* Added on intake</span>
+                            <?php endif;?>
+                        <?php endif; ?>
+                    </span>
                 </div>
             </td>
             <td></td>

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

@@ -70,10 +70,10 @@ if($contentData && !$contentData['unknown'] && !!$contentData['count']) {
         }
         ?>
         @if(count($positives))
-            <div class="pt-1"><b>Positive for</b>: {!!  implode(', ', $positives) !!}</div>
+            <div class=""><b>Positive for</b>: {!!  implode(', ', $positives) !!}</div>
         @endif
         @if(count($negatives))
-            <div class="pt-1"><b>Negative for</b>: {!!  implode(', ', $negatives) !!}</div>
+            <div class=""><b>Negative for</b>: {!!  implode(', ', $negatives) !!}</div>
         @endif
     </div>
     <?php if(isset($contentData['items'][$i]['comments']) && !empty($contentData['items'][$i]['comments'])): ?>

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

@@ -13,20 +13,28 @@ if (!!@$point->data) {
     $contentData = json_decode($point->data, true);
 }
 ?>
-<div visit-moe close-on-save close-on-cancel class="d-block px-3">
+<div visit-moe close-on-save close-on-cancel class="d-block pb-2">
     <form show url="/api/visitPoint/<?= $endPoint ?>" class="mcp-theme-1">
         <input type="hidden" name="segmentUid" value="<?= $segment->uid ?>">
         <input type="hidden" name="category" value="<?= $category ?>">
         <input type="hidden" name="data" value="{{json_encode($contentData)}}">
 
-        <label class="d-flex align-items-baseline mb-1">
+        <label class="d-flex align-items-baseline mb-2">
             <div class="mr-2 align-self-stretch" style="padding-top: 2px;">
                 <input type="checkbox" data-name="informed_consent" {{@($contentData["informed_consent"] ? 'checked' : '')}}>
             </div>
-            <span>Informed consent for treatment obtained and patient questions answered.</span>
+            <div>
+                <div>This is a {{$note->method}} visit that was performed on {{friendly_date($note->effective_dateest)}}. Verbal consent to participate in a video visit was obtained.</div>
+                <div>This visit occurred during the Coronavirus (COVID-19) Public Health Emergency.</div>
+                <div>I discussed with the patient the nature of our visit, that:</div>
+                <div class="ml-3">- I would evaluate the patient and recommend diagnostics and treatments based on my assessment.</div>
+                <div class="ml-3">- Our sessions are not being recorded, and that personal health information is protected.</div>
+                <div class="ml-3">- Our team would provide follow-up care in person if/when the patient needs it.</div>
+                <div class="ml-3">- No physical exam was performed due to the remote nature of this evaluation.</div>
+            </div>
         </label>
 
-        <div class="">
+        <div class="pt-2">
             <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <div class="d-inline-flex align-self-stretch align-items-center">
                 <span class="autosave-indicator saving text-sm text-secondary">Saving changes &hellip;</span>
@@ -38,3 +46,5 @@ if (!!@$point->data) {
         </div>
     </form>
 </div>
+
+

+ 19 - 7
resources/views/app/patient/segment-templates/omega_informed_consent/summary.blade.php

@@ -14,13 +14,25 @@ if (!!@$point->data) {
 }
 ?>
 
-<div class="d-flex align-items-baseline">
-    <div class="align-self-stretch mr-2 text-left">
-        @if(@($contentData["informed_consent"]))
-            <i class="fa fa-check"></i>
-        @else
+<div class="d-flex align-items-baseline mb-2">
+    @if(!@($contentData["informed_consent"]))
+        <div class="align-self-stretch min-width-30px text-left">
             <i class="fa fa-exclamation-triangle"></i>
-        @endif
+        </div>
+    @endif
+    <div class="flex-grow-1">
+    @if(@($contentData["informed_consent"]))
+        <div>
+            <div>This is a {{$note->method}} visit that was performed on {{friendly_date($note->effective_dateest)}}. Verbal consent to participate in a video visit was obtained.</div>
+            <div>This visit occurred during the Coronavirus (COVID-19) Public Health Emergency.</div>
+            <div>I discussed with the patient the nature of our visit, that:</div>
+            <div class="ml-3">- I would evaluate the patient and recommend diagnostics and treatments based on my assessment.</div>
+            <div class="ml-3">- Our sessions are not being recorded, and that personal health information is protected.</div>
+            <div class="ml-3">- Our team would provide follow-up care in person if/when the patient needs it.</div>
+            <div class="ml-3">- No physical exam was performed due to the remote nature of this evaluation.</div>
+        </div>
+    @else
+        <div>Please click here to document informed consent.</div>
+    @endif
     </div>
-    <span class="flex-grow-1">Informed consent for treatment obtained and patient questions answered.</span>
 </div>

+ 15 - 17
resources/views/app/patient/segment-templates/omega_medications/summary.blade.php

@@ -35,28 +35,26 @@ $plural = 'Medications';
 			</div>
 		</td>
 		<td class="width-300px">
-			<div class="pl-3">
+			<div class="d-flex align-items-baseline pl-2">
 				<?php $review = $point->childReviewAddedInNote($note); ?>
 				<?php if(!!$review): ?>
-					<div class="d-flex align-items-baseline">
-						<span>{!! $review->data->value !!}</span>
-					</div>
+					<span class="pr-2">{!! $review->data->value !!}</span>
 				<?php endif; ?>
-			</div>
-			<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>
-					@elseif($point->removal_reason_category === 'ON_INTAKE')
-						<span class="text-sm text-secondary">Removed on intake</span>
-					@endif
+				<span>
+					<?php if ($point->is_removed): ?>
+				@if($point->removal_reason_category === 'DURING_VISIT')
+					<span class="text-sm text-secondary">Removed during visit</span>
+				@elseif($point->removal_reason_category === 'ON_INTAKE')
+					<span class="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="text-sm text-success">* Prescribed during visit</span>
-					<?php else: ?>
-						<span class="text-sm text-info">* Added on intake</span>
-					<?php endif;?>
+				<?php if ($point->addition_reason_category === 'DURING_VISIT'): ?>
+					<span class="text-sm text-success">* Prescribed during visit</span>
+				<?php else: ?>
+					<span class="text-sm text-info">* Prescribed on intake</span>
+				<?php endif;?>
 				<?php endif; ?>
+				</span>
 			</div>
 		</td>
 		<td></td>

+ 15 - 0
resources/views/app/patient/segment-templates/omega_objective_system/edit.blade.php

@@ -36,6 +36,21 @@ if (!!@$point->data) {
         <label class="d-flex align-items-center mb-2">
             <input type="checkbox" data-name="reviewed_relevant_rpm_data" {{@$contentData["reviewed_relevant_rpm_data"] ? 'checked' : ''}} class="mr-2">
             <span>Reviewed relevant remote measurements.</span>
+            <?php
+            // resolve care month from the effective date of this note
+            $cmStartDate = date('Y-m-01', strtotime($note->effective_dateest));
+            $careMonth = \App\Models\CareMonth::where('client_id', $note->client->id)->where('start_date', $cmStartDate)->first();
+            ?>
+            @if($careMonth)
+                <a href="/patients/view/{{ $note->client->uid }}/care-months/view/{{$careMonth->uid}}"
+                   class="text-nowrap ml-3"
+                   native target="_blank"
+                   open-in-stag-popup
+                   popup-style="tall overflow-visible"
+                   mc-initer="care-month-dashboard-{{$note->client->uid}}"
+                   title="Current Care Month RPM Data"
+                >Current Care Month RPM Data</a>
+            @endif
         </label>
 
         <div class="mb-2 align-items-baseline {{ @$contentData["reviewed_relevant_rpm_data"] ? 'd-flex' : 'd-none' }}" if-reviewed-rpm>

+ 23 - 25
resources/views/app/patient/segment-templates/omega_problems/summary.blade.php

@@ -29,31 +29,29 @@ $plural = 'Problems';
                     <?= !!@($point->data->name) ? @($point->data->name) : '-' ?>
                 </div>
             </td>
-            <td class="px-2 width-300px">
-                <div>
-                    <?php $review = $point->childReviewAddedInNote($note); ?>
-                    <?php if(!!$review): ?>
-                        <div class="pl-3 mt-1 d-flex align-items-baseline">
-                            <span>{!! $review->data->value !!}</span>
-                        </div>
-                    <?php endif; ?>
-                </div>
-                <div class="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>
-                        @elseif($point->removal_reason_category === 'ON_INTAKE')
-                            <span class="ml-2 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">* Diagnosed during visit</span>
-                        <?php else: ?>
-                            <span class="ml-2 text-sm text-info">* Added on intake</span>
-                        <?php endif;?>
-                    <?php endif; ?>
-                </div>
-            </td>
+           <td class="width-300px">
+               <div class="d-flex align-items-baseline pl-2">
+                   <?php $review = $point->childReviewAddedInNote($note); ?>
+                   <?php if(!!$review): ?>
+                   <span class="pr-2">{!! $review->data->value !!}</span>
+                   <?php endif; ?>
+                   <span>
+                       <?php if ($point->is_removed): ?>
+                       @if($point->removal_reason_category === 'DURING_VISIT')
+                           <span class="text-sm text-secondary">Removed during visit</span>
+                       @elseif($point->removal_reason_category === 'ON_INTAKE')
+                           <span class="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="text-sm text-success">* Diagnosed during visit</span>
+                            <?php else: ?>
+                                <span class="text-sm text-info">* Diagnosed on intake</span>
+                            <?php endif;?>
+                       <?php endif; ?>
+                    </span>
+               </div>
+           </td>
            <td></td>
         </tr>
     <?php endforeach; ?>

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

@@ -197,7 +197,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
     $contentData = $point->lastChildReview->data;
 
     if(!!@$contentData['declaration']) {
-        echo '<div class="mb-2">';
+        echo '<div class="mb-1">';
         echo '<i class="fa fa-check"></i>&nbsp;';
         echo "Except for the systems documented in the HPI or detailed below, all other systems were reviewed and negative.";
         echo '</div>';
@@ -233,7 +233,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
 
     foreach($display as $head => $line) {
         ?>
-        <div class="mb-2">
+        <div class="">
             <span class="font-weight-bold mr-1">{{$head}}:</span>
             <span class="">{!! $line !!}</span>
         </div>
@@ -241,7 +241,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
     }
     ?>
     @if(isset($contentData['comments']) && !empty(trim($contentData['comments'])))
-        <div class="mt-2 mb-1">
+        <div class="mt-2">
             <b>Comments: </b><?= $contentData['comments'] ?>
         </div>
     @endif

+ 11 - 2
resources/views/app/patient/segment-templates/omega_subjective_system/summary.blade.php

@@ -5,7 +5,7 @@ use App\Models\Point;
 /** @var \App\Models\Client $patient */
 /** @var \App\Models\Note $note */
 
-$points = Point::getIntakePoints($patient, $note);
+$points = Point::getIntakePointsWithChildReview($patient, $note);
 
 $topLevelPointToRendererMap = [
     'HIGH_SUGAR_BEVERAGES' => 'nutrition',
@@ -18,11 +18,20 @@ $topLevelPointToRendererMap = [
     'DAILY_INTAKE_CALORIES' => 'nutrition',
     'AEROBIC_ACTIVITY' => 'exercise',
     'STRENGTH_TRAINING' => 'exercise',
-    'NEAT,' => 'exercise',
+    'NEAT' => 'exercise',
     'SELF_MONITORING' => 'behavior',
     'FOOD_TRIGGERS' => 'behavior',
     'CRAVINGS' => 'behavior',
     'SLEEP_HABITS' => 'behavior',
+
+    // lifestyle
+    'LIFESTYLE_GENERAL' => 'lifestyle_general',
+    'LIFESTYLE_NUTRITION' => 'lifestyle_nutrition',
+    'LIFESTYLE_PHYSICAL_ACTIVITY' => 'lifestyle_physical_activity',
+    'LIFESTYLE_SLEEP' => 'lifestyle_sleep',
+    'LIFESTYLE_SOCIAL_RELATIONSHIPS' => 'lifestyle_social_relationships',
+    'LIFESTYLE_STRESS' => 'lifestyle_stress',
+    'LIFESTYLE_SUBSTANCE_USE' => 'lifestyle_substance_use',
 ];
 
 $pointMap = [];

+ 1 - 1
resources/views/app/patient/segment-templates/omega_vitals/edit.blade.php

@@ -90,7 +90,7 @@ $copyTriggerAdded = [];
         <table class="table table-sm table-bordered mb-2 table-edit-sheet">
             <thead>
             <tr class="bg-light">
-                <th class="px-2 text-secondary border-bottom-0 w-25">Vital</th>
+                <th class="px-2 text-secondary border-bottom-0 width-150px">Vital</th>
                 <th class="px-2 text-secondary border-bottom-0 w-25">{{friendly_date($contentData['date'])}}</th>
                 @if(!$previousData || !count($previousData))
                     <th class="px-2 text-secondary border-bottom-0">Previous</th>

+ 146 - 153
resources/views/app/patient/vitals-settings/bp-management-form.blade.php

@@ -4,171 +4,145 @@
         <input type="hidden" name="uid" value="{{$patient->uid}}">
         <p class="text-secondary font-weight-bold font-size-14">BP Management</p>
 
-        <div class="row mx-0">
-            <div class="col-6 pl-0 pr-2 border-right">
-                <div class="text-secondary font-weight-bold mb-3">Usual BP:</div>
-                <div class="pl-3 mb-2">
-                    <div class="text-secondary font-weight-bold mb-2">
-                        <i class="fa fa-sun"></i>
-                        AM
-                    </div>
-                    <div class="pl-3">
-                        <div class="mb-2 d-flex align-items-center">
-                            <span class="text-secondary width-70px">SBP:</span>
-                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
-                            <div class="width-70px mr-2"><?= vsElement('usual_am_resting_sbp_min', 'number', 'usualAmRestingSbpMin', $patient) ?></div>
-                            <span class="text-secondary mr-2">and</span>
-                            <div class="width-70px"><?= vsElement('usual_am_resting_sbp_max', 'number', 'usualAmRestingSbpMax', $patient) ?></div>
-                        </div>
-                        <div class="mb-2 d-flex align-items-center">
-                            <span class="text-secondary width-70px">DBP:</span>
-                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
-                            <div class="width-70px mr-2"><?= vsElement('usual_am_resting_dbp_min', 'number', 'usualAmRestingDbpMin', $patient) ?></div>
-                            <span class="text-secondary mr-2">and</span>
-                            <div class="width-70px"><?= vsElement('usual_am_resting_dbp_max', 'number', 'usualAmRestingDbpMax', $patient) ?></div>
-                        </div>
-                        <div class="mb-1 d-flex align-items-center">
-                            <span class="text-secondary width-70px">Pulse:</span>
-                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
-                            <div class="width-70px mr-2"><?= vsElement('usual_am_resting_pulse_min', 'number', 'usualAmRestingPulseMin', $patient) ?></div>
-                            <span class="text-secondary mr-2">and</span>
-                            <div class="width-70px"><?= vsElement('usual_am_resting_pulse_max', 'number', 'usualAmRestingPulseMax', $patient) ?></div>
-                        </div>
-                    </div>
-                </div>
-                <div class="pl-3 mb-3">
-                    <div class="text-secondary font-weight-bold mb-2">
-                        <i class="fa fa-moon"></i>
-                        PM
-                    </div>
-                    <div class="pl-3">
-                        <div class="mb-2 d-flex align-items-center">
-                            <span class="text-secondary width-70px">SBP:</span>
-                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
-                            <div class="width-70px mr-2"><?= vsElement('usual_pm_resting_sbp_min', 'number', 'usualPmRestingSbpMin', $patient) ?></div>
-                            <span class="text-secondary mr-2">and</span>
-                            <div class="width-70px"><?= vsElement('usual_pm_resting_sbp_max', 'number', 'usualPmRestingSbpMax', $patient) ?></div>
-                        </div>
-                        <div class="mb-2 d-flex align-items-center">
-                            <span class="text-secondary width-70px">DBP:</span>
-                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
-                            <div class="width-70px mr-2"><?= vsElement('usual_pm_resting_dbp_min', 'number', 'usualPmRestingDbpMin', $patient) ?></div>
-                            <span class="text-secondary mr-2">and</span>
-                            <div class="width-70px"><?= vsElement('usual_pm_resting_dbp_max', 'number', 'usualPmRestingDbpMax', $patient) ?></div>
-                        </div>
-                        <div class="mb-1 d-flex align-items-center">
-                            <span class="text-secondary width-70px">Pulse:</span>
-                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
-                            <div class="width-70px mr-2"><?= vsElement('usual_pm_resting_pulse_min', 'number', 'usualPmRestingPulseMin', $patient) ?></div>
-                            <span class="text-secondary mr-2">and</span>
-                            <div class="width-70px"><?= vsElement('usual_pm_resting_pulse_max', 'number', 'usualPmRestingPulseMax', $patient) ?></div>
-                        </div>
-                    </div>
-                </div>
-                <hr class="my-3">
+        <div id="bpManagementComponent" class="row mx-0" v-cloak>
+            <div class="col-7 border-right">
+                <div class="text-secondary font-weight-bold mb-3">Blood Pressure & Pulse:</div>
+                <div class="pl-3">
+                    <h6 class="text-secondary mb-3"><b>Usual:</b></h6>
+                    <div class="d-flex pl-3">
+                        <div class="d-flex flex-column">
+                            <div v-if="form.doesUsualBpHaveAmPmVariation" class="text-secondary font-weight-bold mb-2">
+                                <i class="fa fa-sun mr-2"></i>AM
+                            </div>
+                            <div class="d-flex align-items-center mb-3">
+                                <h6 v-if="form.doesUsualBpHaveRange" class="mb-0 mr-3">LOWEST:</h6>
+                                <h6 class="mb-0 mr-3">BP:</h6>
+                                <input type="text" class="inline-input-underlined width-50" name="usualAmRestingSbpMin" value="{{ $patient->usual_am_resting_sbp_min }}" />
+                                <span>/</span>
+                                <input type="text" class="inline-input-underlined width-50 mr-3" name="usualAmRestingDbpMin" value="{{ $patient->usual_am_resting_dbp_min }}" />
+                                <span>mm Hg Pulse:</span>
+                                <input type="text" class="inline-input-underlined width-50" name="usualAmRestingPulseMin" value="{{ $patient->usual_am_resting_pulse_min }}" />
+                                <span>BPM</span>
+                            </div>
 
-                <div class="text-secondary font-weight-bold mb-3">Ideal BP:</div>
-                <div class="pl-3 mb-3">
-                    <div class="pl-3">
-                        <div class="mb-1 d-flex align-items-center">
-                            <span class="text-secondary min-width-70px">SBP:</span>
-                            <div class="width-70px mr-2"><?= vsElement('ideal_am_resting_sbp', 'number', 'idealAmRestingSbp', $patient) ?></div>
-                            <span class="text-secondary">Goal: &nbsp;</span>
-                            <div class="flex-grow-1">
-                                <select class="form-control form-control-sm min-width-unset rounded-0" name="sbpManagementGoalCategory">
-                                    <option value="">-- select --</option>
-                                    <option {{$patient->sbp_management_goal_category === 'LOWER' ? 'selected' : ''}} value="LOWER">Lower</option>
-                                    <option {{$patient->sbp_management_goal_category === 'INCREASE' ? 'selected' : ''}} value="INCREASE">Increase</option>
-                                    <option {{$patient->sbp_management_goal_category === 'MAINTAIN' ? 'selected' : ''}} value="MAINTAIN">Maintain</option>
-                                </select>
+                            <div v-if="form.doesUsualBpHaveRange" class="d-flex align-items-center mb-3">
+                                <h6 class="mb-0 mr-3">HIGHEST:</h6>
+                                <h6 class="mb-0 mr-3">BP:</h6>
+                                <input type="text" class="inline-input-underlined width-50" name="usualAmRestingSbpMax" value="{{ $patient->usual_am_resting_sbp_max }}" />
+                                <span>/</span>
+                                <input type="text" class="inline-input-underlined width-50 mr-3" name="usualAmRestingDbpMax" value="{{ $patient->usual_am_resting_dbp_max }}" />
+                                <span>mm Hg Pulse:</span>
+                                <input type="text" class="inline-input-underlined width-50" name="usualAmRestingPulseMax" value="{{ $patient->usual_am_resting_pulse_max }}" />
+                                <span>BPM</span>
                             </div>
-                        </div>
-                        <div class="mb-1 d-flex align-items-center">
-                            <span class="text-secondary min-width-70px">DBP:</span>
-                            <div class="width-70px mr-2"><?= vsElement('ideal_am_resting_dbp', 'number', 'idealAmRestingDbp', $patient) ?></div>
-                            <span class="text-secondary">Goal: &nbsp;</span>
-                            <div class="flex-grow-1">
-                                <select class="form-control form-control-sm min-width-unset rounded-0" name="dbpManagementGoalCategory">
-                                    <option value="">-- select --</option>
-                                    <option {{$patient->dbp_management_goal_category === 'LOWER' ? 'selected' : ''}} value="LOWER">Lower</option>
-                                    <option {{$patient->dbp_management_goal_category === 'INCREASE' ? 'selected' : ''}} value="INCREASE">Increase</option>
-                                    <option {{$patient->dbp_management_goal_category === 'MAINTAIN' ? 'selected' : ''}} value="MAINTAIN">Maintain</option>
-                                </select>
+
+                            <div v-if="form.doesUsualBpHaveAmPmVariation">
+                                <!-- Moon -->
+                                <div class="text-secondary font-weight-bold mb-2">
+                                    <i class="fa fa-moon mr-2"></i>PM
+                                </div>
+                                <div class="d-flex align-items-center mb-3">
+                                    <h6 v-if="form.doesUsualBpHaveRange" class="mb-0 mr-3">LOWEST:</h6>
+                                    <h6 class="mb-0 mr-3">BP:</h6>
+                                    <input type="text" class="inline-input-underlined width-50" name="usualPmRestingSbpMin" value="{{ $patient->usual_pm_resting_sbp_min }}" />
+                                    <span>/</span>
+                                    <input type="text" class="inline-input-underlined width-50 mr-3" name="usualPmRestingDbpMin" value="{{ $patient->usual_pm_resting_dbp_min }}" />
+                                    <span>mm Hg Pulse:</span>
+                                    <input type="text" class="inline-input-underlined width-50" name="usualPmRestingPulseMin" value="{{ $patient->usual_pm_resting_pulse_min }}" />
+                                    <span>BPM</span>
+                                </div>
+                                <div v-if="form.doesUsualBpHaveRange" class="d-flex align-items-center mb-3">
+                                    <h6 class="mb-0 mr-3">HIGHEST:</h6>
+                                    <h6 class="mb-0 mr-3">BP:</h6>
+                                    <input type="text" class="inline-input-underlined width-50" name="usualPmRestingSbpMax" value="{{ $patient->usual_pm_resting_sbp_max }}" />
+                                    <span>/</span>
+                                    <input type="text" class="inline-input-underlined width-50 mr-3" name="usualPmRestingDbpMax" value="{{ $patient->usual_pm_resting_dbp_max }}" />
+                                    <span>mm Hg Pulse:</span>
+                                    <input type="text" class="inline-input-underlined width-50" name="usualPmRestingPulseMax" value="{{ $patient->usual_pm_resting_pulse_max }}" />
+                                    <span>BPM</span>
+                                </div>
+
                             </div>
-                        </div>
-                        <div class="mb-1 d-flex align-items-center">
-                            <span class="text-secondary min-width-70px">Pulse:</span>
-                            <div class="width-70px mr-2"><?= vsElement('ideal_am_resting_pulse', 'number', 'idealAmRestingPulse', $patient) ?></div>
-                            <span class="text-secondary">Goal: &nbsp;</span>
-                            <div class="flex-grow-1">
-                                <select class="form-control form-control-sm min-width-unset rounded-0" name="pulseManagementGoalCategory">
-                                    <option value="">-- select --</option>
-                                    <option {{$patient->pulse_management_goal_category === 'LOWER' ? 'selected' : ''}} value="LOWER">Lower</option>
-                                    <option {{$patient->pulse_management_goal_category === 'INCREASE' ? 'selected' : ''}} value="INCREASE">Increase</option>
-                                    <option {{$patient->pulse_management_goal_category === 'MAINTAIN' ? 'selected' : ''}} value="MAINTAIN">Maintain</option>
-                                </select>
+
+                            <div>
+                                <div class="form-check mb-2">
+                                    <input type="checkbox" class="form-check-input" id="amPmVariation" name="doesUsualBpHaveAmPmVariation" v-model="form.doesUsualBpHaveAmPmVariation">
+                                    <label class="form-check-label" for="amPmVariation">AM/PM Variation</label>
+                                </div>
+                                <div class="form-check">
+                                    <input type="checkbox" class="form-check-input" id="bpRange" name="doesUsualBpHaveRange" v-model="form.doesUsualBpHaveRange">
+                                    <label class="form-check-label" for="bpRange">Range</label>
+                                </div>
                             </div>
+
                         </div>
                     </div>
-                </div>
-                <hr class="my-3">
-            </div>
-            <div class="col-6 pr-0 pl-2">
-                <div class="text-secondary font-weight-bold mb-3">Alerts</div>
-                <div class="pl-3 mb-3">
-                    <div class="text-secondary font-weight-bold mb-2">
-                        <i class="fa fa-circle text-danger"></i>
-                        Red
-                    </div>
-                    <div class="pl-3">
-                        <div class="mb-2 d-flex align-items-center">
-                            <span class="text-secondary width-70px">SBP: </span>
-                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"> <?= vsElement('red_alert_when_sbp_above', 'number', 'redAlertWhenSbpAbove', $patient) ?></div>
-                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
-                            <div class="width-70px"><?= vsElement('red_alert_when_sbp_below', 'number', 'redAlertWhenSbpBelow', $patient) ?></div>
-                        </div>
-                        <div class="mb-2 d-flex align-items-center">
-                            <span class="text-secondary width-70px">DBP: </span>
-                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"> <?= vsElement('red_alert_when_dbp_above', 'number', 'redAlertWhenDbpAbove', $patient) ?></div>
-                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
-                            <div class="width-70px"><?= vsElement('red_alert_when_dbp_below', 'number', 'redAlertWhenDbpBelow', $patient) ?></div>
-                        </div>
-                        <div class="mb-2 d-flex align-items-center">
-                            <span class="text-secondary width-70px">Pulse: </span>
-                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"><?= vsElement('red_alert_when_pulse_above', 'number', 'redAlertWhenPulseAbove', $patient) ?></div>
-                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
-                            <div class="width-70px"><?= vsElement('red_alert_when_pulse_below', 'number', 'redAlertWhenPulseBelow', $patient) ?></div>
+                    
+                    <hr class="my-3">
+                    <div class="text-secondary font-weight-bold mb-3">Ideal BP:</div>
+                    <div class="pl-3 mb-3">
+                        <div class="d-flex align-items-center mb-3">
+                            <h6 class="mb-0 mr-3">Target:</h6>
+                            <h6 class="mb-0 mr-3">BP:</h6>
+                            <input type="text" class="inline-input-underlined width-50" name="idealAmRestingSbpMin" value="{{ $patient->ideal_am_resting_sbp_min }}" />
+                            <span>/</span>
+                            <input type="text" class="inline-input-underlined width-50 mr-3" name="idealAmRestingDbpMin" value="{{ $patient->ideal_am_resting_dbp_min }}" />
+                            <span>mm Hg Pulse:</span>
+                            <input type="text" class="inline-input-underlined width-50" name="idealAmRestingPulse" value="{{ $patient->ideal_am_resting_pulse }}" />
+                            <span>BPM</span>
                         </div>
                     </div>
-                </div>
-                <div class="pl-3 mb-2">
-                    <div class="text-secondary font-weight-bold mb-2">
-                        <i class="fa fa-circle text-warning-mellow"></i>
-                        Yellow
-                    </div>
-                    <div class="pl-3">
-                        <div class="mb-2 d-flex align-items-center">
-                            <span class="text-secondary width-70px">SBP: </span>
-                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"><?= vsElement('yellow_alert_when_sbp_above', 'number', 'yellowAlertWhenSbpAbove', $patient) ?></div>
-                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
-                            <div class="width-70px"><?= vsElement('yellow_alert_when_sbp_below', 'number', 'yellowAlertWhenSbpBelow', $patient) ?></div>
+                    <hr class="my-3">
+                    <div class="text-secondary font-weight-bold mb-3">Alerts</div>
+                    <div class="pl-3 mb-3">
+                        <div class="text-secondary font-weight-bold mb-2"><i class="fa fa-circle text-danger mr-2"></i>Red</div>
+                        <div class="d-flex align-items-center mb-3">
+                            <h6 class="mb-0 mr-3">Above:</h6>
+                            <h6 class="mb-0 mr-3">BP:</h6>
+                            <input type="text" class="inline-input-underlined width-50" name="redAlertWhenSbpAbove" value="{{ $patient->red_alert_when_sbp_above }}" />
+                            <span>/</span>
+                            <input type="text" class="inline-input-underlined width-50 mr-3" name="redAlertWhenDbpAbove" value="{{ $patient->red_alert_when_dbp_above }}" />
+                            <span>mm Hg Pulse:</span>
+                            <input type="text" class="inline-input-underlined width-50" name="redAlertWhenPulseAbove" value="{{ $patient->red_alert_when_pulse_above }}" />
+                            <span>BPM</span>
                         </div>
-                        <div class="mb-2 d-flex align-items-center">
-                            <span class="text-secondary width-70px">DBP: </span>
-                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"><?= vsElement('yellow_alert_when_dbp_above', 'number', 'yellowAlertWhenDbpAbove', $patient) ?></div>
-                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
-                            <div class="width-70px"><?= vsElement('yellow_alert_when_dbp_below', 'number', 'yellowAlertWhenDbpBelow', $patient) ?></div>
-                        </div>
-                        <div class="mb-2 d-flex align-items-center">
-                            <span class="text-secondary width-70px">Pulse: </span>
-                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"><?= vsElement('yellow_alert_when_pulse_above', 'number', 'yellowAlertWhenPulseAbove', $patient) ?></div>
-                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
-                            <div class="width-70px"><?= vsElement('yellow_alert_when_pulse_below', 'number', 'yellowAlertWhenPulseBelow', $patient) ?></div>
+                        <div class="d-flex align-items-center mb-3">
+                            <h6 class="mb-0 mr-3">Below:</h6>
+                            <h6 class="mb-0 mr-3">BP:</h6>
+                            <input type="text" class="inline-input-underlined width-50" name="redAlertWhenSbpBelow" value="{{ $patient->red_alert_when_sbp_below }}" />
+                            <span>/</span>
+                            <input type="text" class="inline-input-underlined width-50 mr-3" name="redAlertWhenDbpBelow" value="{{ $patient->red_alert_when_dbp_below }}" />
+                            <span>mm Hg Pulse:</span>
+                            <input type="text" class="inline-input-underlined width-50" name="redAlertWhenPulseBelow" value="{{ $patient->red_alert_when_pulse_below }}" />
+                            <span>BPM</span>
+                        </div> 
+                    </div>
+                    <div class="pl-3 mb-3">
+                        <div class="text-secondary font-weight-bold mb-2"><i class="fa fa-circle text-warning-mellow mr-2"></i>Yellow</div>
+                        <div class="d-flex align-items-center mb-3">
+                            <h6 class="mb-0 mr-3">Above:</h6>
+                            <h6 class="mb-0 mr-3">BP:</h6>
+                            <input type="text" class="inline-input-underlined width-50" name="yellowAlertWhenSbpAbove" value="{{ $patient->yellow_alert_when_sbp_above }}" />
+                            <span>/</span>
+                            <input type="text" class="inline-input-underlined width-50 mr-3" name="yellowAlertWhenDbpAbove" value="{{ $patient->yellow_alert_when_dbp_above }}" />
+                            <span>mm Hg Pulse:</span>
+                            <input type="text" class="inline-input-underlined width-50" name="yellowAlertWhenPulseAbove" value="{{ $patient->yellow_alert_when_pulse_above }}" />
+                            <span>BPM</span>
                         </div>
+                        <div class="d-flex align-items-center mb-3">
+                            <h6 class="mb-0 mr-3">Below:</h6>
+                            <h6 class="mb-0 mr-3">BP:</h6>
+                            <input type="text" class="inline-input-underlined width-50" name="yellowAlertWhenSbpBelow" value="{{ $patient->yellow_alert_when_sbp_below }}" />
+                            <span>/</span>
+                            <input type="text" class="inline-input-underlined width-50 mr-3" name="yellowAlertWhenDbpBelow" value="{{ $patient->yellow_alert_when_dbp_below }}" />
+                            <span>mm Hg Pulse:</span>
+                            <input type="text" class="inline-input-underlined width-50" name="yellowAlertWhenPulseBelow" value="{{ $patient->yellow_alert_when_pulse_below }}" />
+                            <span>BPM</span>
+                        </div> 
                     </div>
                 </div>
-                <hr class="my-3">
-
+            </div>
+            <div class="col-5">
                 <div class="mb-2 d-flex align-items-start">
                     <span class="text-secondary min-width-140px w-50">Reports prehypertension?</span>
                     <div class="w-50">
@@ -279,6 +253,24 @@
     </form>
 </div>
 <script>
+    var doesUsualBpHaveAmPmVariation = <?= $patient->does_usual_bp_have_am_pm_variation ? 1:0 ?>;
+    var doesUsualBpHaveRange = <?= $patient->does_usual_bp_have_range ? 1:0 ?>;
+    // BP Management
+    var BPManagementComponent = new Vue({
+        el:'#bpManagementComponent',
+        data:{
+            form:{
+                doesUsualBpHaveAmPmVariation: parseInt(doesUsualBpHaveAmPmVariation),
+                doesUsualBpHaveRange: parseInt(doesUsualBpHaveRange)
+            }
+        },
+        methods:{
+            
+            init: function(){
+                console.log({form:this.form});
+            }
+        }
+    });
     (function() {
 
         function initICDAutoSuggest(_codeElem, _descElem) {
@@ -306,6 +298,7 @@
             // for (let i = 1; i <= 4; i++) {
             //     initICDAutoSuggest($('[name="whyIsBpMonitoringNeededIcd' + i + '"]'), $('[name="whyIsBpMonitoringNeededDescription' + i + '"]'));
             // }
+            BPManagementComponent.init();
         }
 
         addMCInitializer('bp-management-settings', init, '#bp-management-settings');

+ 314 - 0
resources/views/app/patient/vitals-settings/bp-management-form_depricated.blade.php

@@ -0,0 +1,314 @@
+<div moe extra-huge id="bp-management-settings">
+    <a href="#" start show>Update</a>
+    <form url="/api/client/updateBpManagementSettingsValue">
+        <input type="hidden" name="uid" value="{{$patient->uid}}">
+        <p class="text-secondary font-weight-bold font-size-14">BP Management</p>
+
+        <div class="row mx-0">
+            <div class="col-6 pl-0 pr-2 border-right">
+                <div class="text-secondary font-weight-bold mb-3">Usual BP:</div>
+                <div class="pl-3 mb-2">
+                    <div class="text-secondary font-weight-bold mb-2">
+                        <i class="fa fa-sun"></i>
+                        AM
+                    </div>
+                    <div class="pl-3">
+                        <div class="mb-2 d-flex align-items-center">
+                            <span class="text-secondary width-70px">SBP:</span>
+                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
+                            <div class="width-70px mr-2"><?= vsElement('usual_am_resting_sbp_min', 'number', 'usualAmRestingSbpMin', $patient) ?></div>
+                            <span class="text-secondary mr-2">and</span>
+                            <div class="width-70px"><?= vsElement('usual_am_resting_sbp_max', 'number', 'usualAmRestingSbpMax', $patient) ?></div>
+                        </div>
+                        <div class="mb-2 d-flex align-items-center">
+                            <span class="text-secondary width-70px">DBP:</span>
+                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
+                            <div class="width-70px mr-2"><?= vsElement('usual_am_resting_dbp_min', 'number', 'usualAmRestingDbpMin', $patient) ?></div>
+                            <span class="text-secondary mr-2">and</span>
+                            <div class="width-70px"><?= vsElement('usual_am_resting_dbp_max', 'number', 'usualAmRestingDbpMax', $patient) ?></div>
+                        </div>
+                        <div class="mb-1 d-flex align-items-center">
+                            <span class="text-secondary width-70px">Pulse:</span>
+                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
+                            <div class="width-70px mr-2"><?= vsElement('usual_am_resting_pulse_min', 'number', 'usualAmRestingPulseMin', $patient) ?></div>
+                            <span class="text-secondary mr-2">and</span>
+                            <div class="width-70px"><?= vsElement('usual_am_resting_pulse_max', 'number', 'usualAmRestingPulseMax', $patient) ?></div>
+                        </div>
+                    </div>
+                </div>
+                <div class="pl-3 mb-3">
+                    <div class="text-secondary font-weight-bold mb-2">
+                        <i class="fa fa-moon"></i>
+                        PM
+                    </div>
+                    <div class="pl-3">
+                        <div class="mb-2 d-flex align-items-center">
+                            <span class="text-secondary width-70px">SBP:</span>
+                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
+                            <div class="width-70px mr-2"><?= vsElement('usual_pm_resting_sbp_min', 'number', 'usualPmRestingSbpMin', $patient) ?></div>
+                            <span class="text-secondary mr-2">and</span>
+                            <div class="width-70px"><?= vsElement('usual_pm_resting_sbp_max', 'number', 'usualPmRestingSbpMax', $patient) ?></div>
+                        </div>
+                        <div class="mb-2 d-flex align-items-center">
+                            <span class="text-secondary width-70px">DBP:</span>
+                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
+                            <div class="width-70px mr-2"><?= vsElement('usual_pm_resting_dbp_min', 'number', 'usualPmRestingDbpMin', $patient) ?></div>
+                            <span class="text-secondary mr-2">and</span>
+                            <div class="width-70px"><?= vsElement('usual_pm_resting_dbp_max', 'number', 'usualPmRestingDbpMax', $patient) ?></div>
+                        </div>
+                        <div class="mb-1 d-flex align-items-center">
+                            <span class="text-secondary width-70px">Pulse:</span>
+                            <span class="text-secondary mr-2 text-center text-sm">ranging between</span>
+                            <div class="width-70px mr-2"><?= vsElement('usual_pm_resting_pulse_min', 'number', 'usualPmRestingPulseMin', $patient) ?></div>
+                            <span class="text-secondary mr-2">and</span>
+                            <div class="width-70px"><?= vsElement('usual_pm_resting_pulse_max', 'number', 'usualPmRestingPulseMax', $patient) ?></div>
+                        </div>
+                    </div>
+                </div>
+                <hr class="my-3">
+
+                <div class="text-secondary font-weight-bold mb-3">Ideal BP:</div>
+                <div class="pl-3 mb-3">
+                    <div class="pl-3">
+                        <div class="mb-1 d-flex align-items-center">
+                            <span class="text-secondary min-width-70px">SBP:</span>
+                            <div class="width-70px mr-2"><?= vsElement('ideal_am_resting_sbp', 'number', 'idealAmRestingSbp', $patient) ?></div>
+                            <span class="text-secondary">Goal: &nbsp;</span>
+                            <div class="flex-grow-1">
+                                <select class="form-control form-control-sm min-width-unset rounded-0" name="sbpManagementGoalCategory">
+                                    <option value="">-- select --</option>
+                                    <option {{$patient->sbp_management_goal_category === 'LOWER' ? 'selected' : ''}} value="LOWER">Lower</option>
+                                    <option {{$patient->sbp_management_goal_category === 'INCREASE' ? 'selected' : ''}} value="INCREASE">Increase</option>
+                                    <option {{$patient->sbp_management_goal_category === 'MAINTAIN' ? 'selected' : ''}} value="MAINTAIN">Maintain</option>
+                                </select>
+                            </div>
+                        </div>
+                        <div class="mb-1 d-flex align-items-center">
+                            <span class="text-secondary min-width-70px">DBP:</span>
+                            <div class="width-70px mr-2"><?= vsElement('ideal_am_resting_dbp', 'number', 'idealAmRestingDbp', $patient) ?></div>
+                            <span class="text-secondary">Goal: &nbsp;</span>
+                            <div class="flex-grow-1">
+                                <select class="form-control form-control-sm min-width-unset rounded-0" name="dbpManagementGoalCategory">
+                                    <option value="">-- select --</option>
+                                    <option {{$patient->dbp_management_goal_category === 'LOWER' ? 'selected' : ''}} value="LOWER">Lower</option>
+                                    <option {{$patient->dbp_management_goal_category === 'INCREASE' ? 'selected' : ''}} value="INCREASE">Increase</option>
+                                    <option {{$patient->dbp_management_goal_category === 'MAINTAIN' ? 'selected' : ''}} value="MAINTAIN">Maintain</option>
+                                </select>
+                            </div>
+                        </div>
+                        <div class="mb-1 d-flex align-items-center">
+                            <span class="text-secondary min-width-70px">Pulse:</span>
+                            <div class="width-70px mr-2"><?= vsElement('ideal_am_resting_pulse', 'number', 'idealAmRestingPulse', $patient) ?></div>
+                            <span class="text-secondary">Goal: &nbsp;</span>
+                            <div class="flex-grow-1">
+                                <select class="form-control form-control-sm min-width-unset rounded-0" name="pulseManagementGoalCategory">
+                                    <option value="">-- select --</option>
+                                    <option {{$patient->pulse_management_goal_category === 'LOWER' ? 'selected' : ''}} value="LOWER">Lower</option>
+                                    <option {{$patient->pulse_management_goal_category === 'INCREASE' ? 'selected' : ''}} value="INCREASE">Increase</option>
+                                    <option {{$patient->pulse_management_goal_category === 'MAINTAIN' ? 'selected' : ''}} value="MAINTAIN">Maintain</option>
+                                </select>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <hr class="my-3">
+            </div>
+            <div class="col-6 pr-0 pl-2">
+                <div class="text-secondary font-weight-bold mb-3">Alerts</div>
+                <div class="pl-3 mb-3">
+                    <div class="text-secondary font-weight-bold mb-2">
+                        <i class="fa fa-circle text-danger"></i>
+                        Red
+                    </div>
+                    <div class="pl-3">
+                        <div class="mb-2 d-flex align-items-center">
+                            <span class="text-secondary width-70px">SBP: </span>
+                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"> <?= vsElement('red_alert_when_sbp_above', 'number', 'redAlertWhenSbpAbove', $patient) ?></div>
+                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
+                            <div class="width-70px"><?= vsElement('red_alert_when_sbp_below', 'number', 'redAlertWhenSbpBelow', $patient) ?></div>
+                        </div>
+                        <div class="mb-2 d-flex align-items-center">
+                            <span class="text-secondary width-70px">DBP: </span>
+                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"> <?= vsElement('red_alert_when_dbp_above', 'number', 'redAlertWhenDbpAbove', $patient) ?></div>
+                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
+                            <div class="width-70px"><?= vsElement('red_alert_when_dbp_below', 'number', 'redAlertWhenDbpBelow', $patient) ?></div>
+                        </div>
+                        <div class="mb-2 d-flex align-items-center">
+                            <span class="text-secondary width-70px">Pulse: </span>
+                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"><?= vsElement('red_alert_when_pulse_above', 'number', 'redAlertWhenPulseAbove', $patient) ?></div>
+                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
+                            <div class="width-70px"><?= vsElement('red_alert_when_pulse_below', 'number', 'redAlertWhenPulseBelow', $patient) ?></div>
+                        </div>
+                    </div>
+                </div>
+                <div class="pl-3 mb-2">
+                    <div class="text-secondary font-weight-bold mb-2">
+                        <i class="fa fa-circle text-warning-mellow"></i>
+                        Yellow
+                    </div>
+                    <div class="pl-3">
+                        <div class="mb-2 d-flex align-items-center">
+                            <span class="text-secondary width-70px">SBP: </span>
+                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"><?= vsElement('yellow_alert_when_sbp_above', 'number', 'yellowAlertWhenSbpAbove', $patient) ?></div>
+                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
+                            <div class="width-70px"><?= vsElement('yellow_alert_when_sbp_below', 'number', 'yellowAlertWhenSbpBelow', $patient) ?></div>
+                        </div>
+                        <div class="mb-2 d-flex align-items-center">
+                            <span class="text-secondary width-70px">DBP: </span>
+                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"><?= vsElement('yellow_alert_when_dbp_above', 'number', 'yellowAlertWhenDbpAbove', $patient) ?></div>
+                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
+                            <div class="width-70px"><?= vsElement('yellow_alert_when_dbp_below', 'number', 'yellowAlertWhenDbpBelow', $patient) ?></div>
+                        </div>
+                        <div class="mb-2 d-flex align-items-center">
+                            <span class="text-secondary width-70px">Pulse: </span>
+                            <span class="text-secondary text-sm mr-2">above</span> <div class="width-70px mr-2"><?= vsElement('yellow_alert_when_pulse_above', 'number', 'yellowAlertWhenPulseAbove', $patient) ?></div>
+                            <span class="text-secondary text-sm text-nowrap mr-2">or below</span>
+                            <div class="width-70px"><?= vsElement('yellow_alert_when_pulse_below', 'number', 'yellowAlertWhenPulseBelow', $patient) ?></div>
+                        </div>
+                    </div>
+                </div>
+                <hr class="my-3">
+
+                <div class="mb-2 d-flex align-items-start">
+                    <span class="text-secondary min-width-140px w-50">Reports prehypertension?</span>
+                    <div class="w-50">
+                        <select type="text" class="form-control form-control-sm min-width-unset" name="hasPrehypertensionDx">
+                            <option value="">-- select --</option>
+                            <option {{$patient->has_prehypertension_dx === 'YES' ? 'selected' : ''}} value="YES">Yes</option>
+                            <option {{$patient->has_prehypertension_dx === 'NO' ? 'selected' : ''}} value="NO">No</option>
+                            <option {{$patient->has_prehypertension_dx === 'UNKNOWN' ? 'selected' : ''}} value="UNKNOWN">Unknown</option>
+                        </select>
+                    </div>
+                </div>
+                <div class="mb-2 d-flex align-items-start">
+                    <span class="text-secondary min-width-140px w-50">Reports HTN?</span>
+                    <div class="w-50">
+                        <select type="text" class="form-control form-control-sm min-width-unset" name="hasHypertensionDx">
+                            <option value="">-- select --</option>
+                            <option {{$patient->has_hypertension_dx === 'YES' ? 'selected' : ''}} value="YES">Yes</option>
+                            <option {{$patient->has_hypertension_dx === 'NO' ? 'selected' : ''}} value="NO">No</option>
+                            <option {{$patient->has_hypertension_dx === 'UNKNOWN' ? 'selected' : ''}} value="UNKNOWN">Unknown</option>
+                        </select>
+                    </div>
+                </div>
+                <div class="mb-2 d-flex align-items-start">
+                    <span class="text-secondary min-width-140px w-50">Reports HTN medicine?</span>
+                    <div class="w-50">
+                        <select type="text" class="form-control form-control-sm min-width-unset" name="isPrescribedHypertensionMedicine">
+                            <option value="">-- select --</option>
+                            <option {{$patient->is_prescribed_hypertension_medicine === 'YES' ? 'selected' : ''}} value="YES">Yes</option>
+                            <option {{$patient->is_prescribed_hypertension_medicine === 'NO' ? 'selected' : ''}} value="NO">No</option>
+                            <option {{$patient->is_prescribed_hypertension_medicine === 'UNKNOWN' ? 'selected' : ''}} value="UNKNOWN">Unknown</option>
+                        </select>
+                    </div>
+                </div>
+                <div class="mb-2 d-flex align-items-start">
+                    <span class="text-secondary min-width-140px w-50">Goal to reduce HTN medicine?</span>
+                    <div class="w-50">
+                        <select type="text" class="form-control form-control-sm min-width-unset" name="isGoalToReduceHypertensionMedicine">
+                            <option value="">-- select --</option>
+                            <option {{$patient->is_goal_to_reduce_hypertension_medicine === 'YES' ? 'selected' : ''}} value="YES">Yes</option>
+                            <option {{$patient->is_goal_to_reduce_hypertension_medicine === 'NO' ? 'selected' : ''}} value="NO">No</option>
+                            <option {{$patient->is_goal_to_reduce_hypertension_medicine === 'UNKNOWN' ? 'selected' : ''}} value="UNKNOWN">Unknown</option>
+                        </select>
+                    </div>
+                </div>
+
+                <div class="text-secondary min-width-140px mb-1">Describe the goal:</div>
+                <input type="text" class="form-control form-control-sm min-width-unset" name="goalToReduceHypertensionMedicineMemo" value="{{$patient->goal_to_reduce_hypertension_medicine_memo}}">
+
+                <div class="my-3 d-flex align-items-center">
+            <span class="text-secondary min-width-140px w-50">
+                <strong>BP monitoring prescribed?</strong>
+            </span>
+                    <div class="w-50">
+                        <select type="text" class="form-control form-control-sm min-width-unset" name="isBpMonitoringNeeded">
+                            <option value="">-- select --</option>
+                            <option {{$patient->is_bp_monitoring_needed === 'YES' ? 'selected' : ''}} value="YES">Yes</option>
+                            <option {{$patient->is_bp_monitoring_needed === 'NO' ? 'selected' : ''}} value="NO">No</option>
+                            <option {{$patient->is_bp_monitoring_needed === 'UNKNOWN' ? 'selected' : ''}} value="UNKNOWN">Unknown</option>
+                        </select>
+                    </div>
+                </div>
+
+                {{--
+                <hr class="my-3">
+                <div class="text-secondary min-width-140px mb-1">ICDs</div>
+                <table class="table table-sm table-striped table-bordered mb-3">
+                    <thead>
+                    <tr class="bg-light text-secondary">
+                        <th class="border-bottom-0 width-30px">#</th>
+                        <th class="border-bottom-0 w-25">Code</th>
+                        <th class="border-bottom-0">Description</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    <tr>
+                        <td class="p-0 align-middle text-center">1</td>
+                        <td class="p-0 align-middle text-center"><?= vsElement('why_is_bp_monitoring_needed_icd1', 'text', 'whyIsBpMonitoringNeededIcd1', $patient) ?></td>
+                        <td class="p-0 align-middle text-center"><?= vsElement('why_is_bp_monitoring_needed_description1', 'text', 'whyIsBpMonitoringNeededDescription1', $patient) ?></td>
+                    </tr>
+                    <tr>
+                        <td class="p-0 align-middle text-center">2</td>
+                        <td class="p-0 align-middle text-center"><?= vsElement('why_is_bp_monitoring_needed_icd2', 'text', 'whyIsBpMonitoringNeededIcd2', $patient) ?></td>
+                        <td class="p-0 align-middle text-center"><?= vsElement('why_is_bp_monitoring_needed_description2', 'text', 'whyIsBpMonitoringNeededDescription2', $patient) ?></td>
+                    </tr>
+                    <tr>
+                        <td class="p-0 align-middle text-center">3</td>
+                        <td class="p-0 align-middle text-center"><?= vsElement('why_is_bp_monitoring_needed_icd3', 'text', 'whyIsBpMonitoringNeededIcd3', $patient) ?></td>
+                        <td class="p-0 align-middle text-center"><?= vsElement('why_is_bp_monitoring_needed_description3', 'text', 'whyIsBpMonitoringNeededDescription3', $patient) ?></td>
+                    </tr>
+                    <tr>
+                        <td class="p-0 align-middle text-center">4</td>
+                        <td class="p-0 align-middle text-center"><?= vsElement('why_is_bp_monitoring_needed_icd4', 'text', 'whyIsBpMonitoringNeededIcd4', $patient) ?></td>
+                        <td class="p-0 align-middle text-center"><?= vsElement('why_is_bp_monitoring_needed_description4', 'text', 'whyIsBpMonitoringNeededDescription4', $patient) ?></td>
+                    </tr>
+                    </tbody>
+                </table>
+                --}}
+                <div class="text-secondary min-width-140px mb-1">Remarks on clinical need:</div>
+                <input type="text" class="form-control form-control-sm min-width-unset" name="whyIsBpMonitoringNeeded" value="{{$patient->why_is_bp_monitoring_needed}}">
+
+            </div>
+        </div>
+
+        <div class="pt-2">
+            <button class="btn btn-primary btn-sm" submit>Submit</button>
+            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+        </div>
+    </form>
+</div>
+<script>
+    (function() {
+
+        function initICDAutoSuggest(_codeElem, _descElem) {
+            if(_codeElem.is('[ac-initialized]')) return false;
+            var elem = _codeElem[0], descElem = _descElem[0], dynID = 'icd-' + Math.ceil(Math.random() * 1000000);
+            $(elem).attr('id', dynID);
+            new window.Def.Autocompleter.Search(dynID,
+                'https://clinicaltables.nlm.nih.gov/api/icd10cm/v3/search?sf=code,name&ef=name', {
+                    tableFormat: true,
+                    valueCols: [0],
+                    colHeaders: ['Code', 'Name'],
+                }
+            );
+            window.Def.Autocompleter.Event.observeListSelections(dynID, function() {
+                let acData = elem.autocomp.getSelectedItemData();
+                if(!acData[0] || !acData[0].data) return false;
+                $(elem).val(acData[0].code);
+                $(descElem).val(acData[0].data.name);
+                return false;
+            });
+            $(elem).attr('ac-initialized', 1);
+        }
+
+        function init() {
+            // for (let i = 1; i <= 4; i++) {
+            //     initICDAutoSuggest($('[name="whyIsBpMonitoringNeededIcd' + i + '"]'), $('[name="whyIsBpMonitoringNeededDescription' + i + '"]'));
+            // }
+        }
+
+        addMCInitializer('bp-management-settings', init, '#bp-management-settings');
+
+    }).call(window);
+</script>

+ 157 - 209
resources/views/app/patient/vitals-settings/bp-management-summary.blade.php

@@ -1,226 +1,174 @@
+
 <div class="row">
-    <div class="col-6 border-right">
-        <div class="text-secondary font-weight-bold mb-3">Usual BP:</div>
-        <div class=" mb-3">
-            <div class="text-secondary font-weight-bold mb-2">
-                <i class="fa fa-sun"></i>
-                AM
-            </div>
-            <div class="">
-                <div class="mb-1 d-flex align-items-center">
-                    <span class="text-secondary width-50px">SBP:</span>
-                    <span class="text-secondary">(range
-                    <?= vsValue('usual_am_resting_sbp_min', $patient) ?>
-                    to
-                    <?= vsValue('usual_am_resting_sbp_max', $patient) ?>)</span>
-                </div>
-                <div class="mb-1 d-flex align-items-center">
-                    <span class="text-secondary width-50px">DBP:</span>
-                    <span class="text-secondary">(range
-                    <?= vsValue('usual_am_resting_dbp_min', $patient) ?>
-                    to
-                    <?= vsValue('usual_am_resting_dbp_max', $patient) ?>)</span>
-                </div>
-                <div class="mb-1 d-flex align-items-center">
-                    <span class="text-secondary width-50px">Pulse:</span>
-                    <span class="text-secondary">(range
-                    <?= vsValue('usual_am_resting_pulse_min', $patient) ?>
-                    to
-                    <?= vsValue('usual_am_resting_pulse_max', $patient) ?>)</span>
-                </div>
-            </div>
-        </div>
-        <div class=" ">
-            <div class="text-secondary font-weight-bold mb-2">
-                <i class="fa fa-moon"></i>
-                PM
-            </div>
-            <div class="">
-                <div class="mb-1 d-flex align-items-center">
-                    <span class="text-secondary width-50px">SBP:</span>
-                    <span class="text-secondary">(range
-                    <?= vsValue('usual_pm_resting_sbp_min', $patient) ?>
-                    to
-                    <?= vsValue('usual_pm_resting_sbp_max', $patient) ?>)</span>
-                </div>
-                <div class="mb-1 d-flex align-items-center">
-                    <span class="text-secondary width-50px">DBP:</span>
-                    <span class="text-secondary">(range
-                    <?= vsValue('usual_pm_resting_dbp_min', $patient) ?>
-                    to
-                    <?= vsValue('usual_pm_resting_dbp_max', $patient) ?>)</span>
-                </div>
+    <div class="col-5 border-right">
+        <h6 class="text-secondary font-weight-bold mb-3">Usual:</h6>
+        <div class="d-flex mb-3">
+            <div class="pl-3">
+                @if($patient->does_usual_bp_have_am_pm_variation)
+                    <div class="text-secondary font-weight-bold mb-2"><i class="fa fa-sun"></i> AM</div>
+                @endif
                 <div class="d-flex align-items-center">
-                    <span class="text-secondary width-50px">Pulse:</span>
-                    <span class="text-secondary">(range
-                    <?= vsValue('usual_pm_resting_pulse_min', $patient) ?>
-                    to
-                    <?= vsValue('usual_pm_resting_pulse_max', $patient) ?>)</span>
-                </div>
-            </div>
-        </div>
-    </div>
-    <div class="col-6">
-        <div class="text-secondary font-weight-bold mb-3">Ideal BP:</div>
-        <div class=" ">
-            <div class="">
-                <div class="mb-1 d-flex align-items-center">
-                    <span class="text-secondary width-50px">SBP:</span>
-                    <div class="font-weight-bold"><?= vsValue('ideal_am_resting_sbp', $patient) ?></div>
-                </div>
-                <div class="mb-3 d-flex align-items-center">
-                    <span class="text-secondary width-50px">Goal: &nbsp;</span>
-                    <div class="flex-grow-1">
-                        <?= vsValue('sbp_management_goal_category', $patient) ?>
+                    @if($patient->does_usual_bp_have_range)
+                        <h6 class="mb-0 mr-2">LOWEST:</h6>
+                    @endif
+                    <h6 class="mb-0 mr-2">BP:</h6>
+                    <span><b><?= vsValue('usual_am_resting_sbp_min', $patient) ?></b></span>
+                    <span>/</span>
+                    <span class="mr-2"><b><?= vsValue('usual_am_resting_dbp_min', $patient) ?></b></span>
+                    <span class="mr-2">mm Hg Pulse:</span>
+                    <span><b><?= vsValue('usual_am_resting_pulse_min', $patient) ?></b></span>
+                    <span class="ml-2">BPM</span>
+                </div>
+                @if($patient->does_usual_bp_have_range)
+                    <div class="d-flex align-items-center">
+                        <h6 class="mb-0 mr-2">HIGHEST:</h6>
+                        <h6 class="mb-0 mr-2">BP:</h6>
+                        <span><b><?= vsValue('usual_am_resting_sbp_max', $patient) ?></b></span>
+                        <span>/</span>
+                        <span class="mr-2"><b><?= vsValue('usual_am_resting_dbp_max', $patient) ?></b></span>
+                        <span class="mr-2">mm Hg Pulse:</span>
+                        <span><b><?= vsValue('usual_am_resting_pulse_max', $patient) ?></b></span>
+                        <span class="ml-2">BPM</span>
                     </div>
-                </div>
-                <div class="mb-1 d-flex align-items-center">
-                    <span class="text-secondary width-50px">DBP:</span>
-                    <div class="font-weight-bold"><?= vsValue('ideal_am_resting_dbp', $patient) ?></div>
-                </div>
-                <div class="mb-3 d-flex align-items-center">
-                    <span class="text-secondary width-50px">Goal: &nbsp;</span>
-                    <div class="flex-grow-1">
-                        <?= vsValue('dbp_management_goal_category', $patient) ?>
+                @endif
+                @if($patient->does_usual_bp_have_am_pm_variation)
+                    <div class="text-secondary font-weight-bold my-2"><i class="fa fa-moon"></i> PM</div>
+                    <div class="d-flex align-items-center">
+                        @if($patient->does_usual_bp_have_range)
+                            <h6 class="mb-0 mr-2">LOWEST:</h6>
+                        @endif
+                        <h6 class="mb-0 mr-2">BP:</h6>
+                        <span><b><?= vsValue('usual_pm_resting_sbp_min', $patient) ?></b></span>
+                        <span>/</span>
+                        <span class="mr-2"><b><?= vsValue('usual_pm_resting_dbp_min', $patient) ?></b></span>
+                        <span class="mr-2">mm Hg Pulse:</span>
+                        <span><b><?= vsValue('usual_pm_resting_pulse_min', $patient) ?></b></span>
+                        <span class="ml-2">BPM</span>
                     </div>
-                </div>
-                <div class="mb-1 d-flex align-items-center">
-                    <span class="text-secondary width-50px">Pulse:</span>
-                    <div class="font-weight-bold"><?= vsValue('ideal_am_resting_pulse', $patient) ?></div>
-                </div>
-                <div class="mb-3 d-flex align-items-center">
-                    <span class="text-secondary width-50px">Goal: &nbsp;</span>
-                    <div class="flex-grow-1">
-                        <?= vsValue('pulse_management_goal_category', $patient) ?>
+                @endif
+                @if($patient->does_usual_bp_have_range)
+                    <div class="d-flex align-items-center">
+                        @if($patient->does_usual_bp_have_range)
+                            <h6 class="mb-0 mr-2">HIGHEST:</h6>
+                        @endif
+                        <h6 class="mb-0 mr-2">BP:</h6>
+                        <span><b><?= vsValue('usual_pm_resting_sbp_max', $patient) ?></b></span>
+                        <span>/</span>
+                        <span class="mr-2"><b><?= vsValue('usual_pm_resting_dbp_max', $patient) ?></b></span>
+                        <span class="mr-2">mm Hg Pulse:</span>
+                        <span><b><?= vsValue('usual_pm_resting_pulse_max', $patient) ?></b></span>
+                        <span class="ml-2">BPM</span>
                     </div>
-                </div>
+                @endif
             </div>
         </div>
-    </div>
-</div>
-
-<hr class="my-3">
-
-<div class="text-secondary font-weight-bold mb-3">Alerts</div>
-
-<div class="row">
-    <div class="col-6 border-right">
-        <div class="">
-            <div class="text-secondary font-weight-bold mb-2">
-                <i class="fa fa-circle text-danger"></i>
-                Red
-            </div>
-            <div class="">
-                <div class="mb-2 d-flex align-items-center">
-                    <span class="text-secondary">SBP: above</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_sbp_above', $patient) ?></div>
-                    <span class="text-secondary text-center">or below</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_sbp_below', $patient) ?></div>
-                </div>
-                <div class="mb-2 d-flex align-items-center">
-                    <span class="text-secondary">DBP: above</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_dbp_above', $patient) ?></div>
-                    <span class="text-secondary text-center">or below</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_dbp_below', $patient) ?></div>
-                </div>
+        <div class="mb-3">
+            <h6 class="text-secondary font-weight-bold">Ideal BP</h6>
+            <div class="pl-3">
                 <div class="d-flex align-items-center">
-                    <span class="text-secondary">Pulse: above</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_pulse_above', $patient) ?></div>
-                    <span class="text-secondary text-center">or below</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_pulse_below', $patient) ?></div>
+                    <h6 class="mb-0 mr-2">Target:</h6>
+                    <h6 class="mb-0 mr-2">BP:</h6>
+                    <span><b><?= vsValue('ideal_am_resting_sbp_min', $patient) ?></b></span>
+                    <span>/</span>
+                    <span class="mr-2"><b><?= vsValue('ideal_am_resting_dbp_min', $patient) ?></b></span>
+                    <span class="mr-2">mm Hg Pulse:</span>
+                    <span><b><?= vsValue('ideal_am_resting_pulse', $patient) ?></b></span>
+                    <span class="ml-2">BPM</span>
                 </div>
             </div>
         </div>
-    </div>
-    <div class="col-6">
-        <div class="">
-            <div class="text-secondary font-weight-bold mb-2">
-                <i class="fa fa-circle text-warning-mellow"></i>
-                Yellow
-            </div>
-            <div class="">
-                <div class="mb-2 d-flex align-items-center">
-                    <span class="text-secondary">SBP: above</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_sbp_above', $patient) ?></div>
-                    <span class="text-secondary text-center">or below</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_sbp_below', $patient) ?></div>
-                </div>
-                <div class="mb-2 d-flex align-items-center">
-                    <span class="text-secondary">DBP: above</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_dbp_above', $patient) ?></div>
-                    <span class="text-secondary text-center">or below</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_dbp_below', $patient) ?></div>
-                </div>
-                <div class="d-flex align-items-center">
-                    <span class="text-secondary">Pulse: above</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_pulse_above', $patient) ?></div>
-                    <span class="text-secondary text-center">or below</span>
-                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_pulse_below', $patient) ?></div>
+
+        <div class="mb-3">
+            <h6 class="text-secondary font-weight-bold mb-3">Alerts</h6>
+            <div class="pl-3">
+                <div class="mb-3">
+                    <div class="mb-2"><i class="fa fa-circle text-danger"></i> Red</div>
+                    <div class="d-flex align-items-center">
+                        <h6 class="mb-0 mr-2">Above:</h6>
+                        <h6 class="mb-0 mr-2">BP:</h6>
+                        <span><b><?= vsValue('red_alert_when_sbp_above', $patient) ?></b></span>
+                        <span>/</span>
+                        <span class="mr-2"><b><?= vsValue('red_alert_when_dbp_above', $patient) ?></b></span>
+                        <span class="mr-2">mm Hg Pulse:</span>
+                        <span><b><?= vsValue('red_alert_when_pulse_above', $patient) ?></b></span>
+                        <span class="ml-2">BPM</span>
+                    </div>
+                    <div class="d-flex align-items-center">
+                        <h6 class="mb-0 mr-2">Below:</h6>
+                        <h6 class="mb-0 mr-2">BP:</h6>
+                        <span><b><?= vsValue('red_alert_when_sbp_below', $patient) ?></b></span>
+                        <span>/</span>
+                        <span class="mr-2"><b><?= vsValue('red_alert_when_dbp_below', $patient) ?></b></span>
+                        <span class="mr-2">mm Hg Pulse:</span>
+                        <span><b><?= vsValue('red_alert_when_pulse_below', $patient) ?></b></span>
+                        <span class="ml-2">BPM</span>
+                    </div>
                 </div>
-            </div>
+                <div class="mb-3">
+                    <div class="mb-2"><i class="fa fa-circle text-warning-mellow"></i> Yellow</div>
+                    <div class="d-flex align-items-center">
+                        <h6 class="mb-0 mr-2">Above:</h6>
+                        <h6 class="mb-0 mr-2">BP:</h6>
+                        <span><b><?= vsValue('yellow_alert_when_sbp_above', $patient) ?></b></span>
+                        <span>/</span>
+                        <span class="mr-2"><b><?= vsValue('yellow_alert_when_dbp_above', $patient) ?></b></span>
+                        <span class="mr-2">mm Hg Pulse:</span>
+                        <span><b><?= vsValue('yellow_alert_when_pulse_above', $patient) ?></b></span>
+                        <span class="ml-2">BPM</span>
+                    </div>
+                    <div class="d-flex align-items-center">
+                        <h6 class="mb-0 mr-2">Below:</h6>
+                        <h6 class="mb-0 mr-2">BP:</h6>
+                        <span><b><?= vsValue('yellow_alert_when_sbp_below', $patient) ?></b></span>
+                        <span>/</span>
+                        <span class="mr-2"><b><?= vsValue('yellow_alert_when_dbp_below', $patient) ?></b></span>
+                        <span class="mr-2">mm Hg Pulse:</span>
+                        <span><b><?= vsValue('yellow_alert_when_pulse_below', $patient) ?></b></span>
+                        <span class="ml-2">BPM</span>
+                    </div>
+                </div>   
+            </div>         
         </div>
-    </div>
-</div>
-
-<hr class="my-3">
 
-<div class="row mb-2">
-    <div class="col-6 border-right">
-        <div class="d-flex align-items-start">
-            <span class="text-secondary min-width-140px pr-3">Reports prehypertension?</span>
-            <div>
-                <?= vsValue('has_prehypertension_dx', $patient) ?>
-            </div>
-        </div>
     </div>
-    <div class="col-6">
-        <div class="d-flex align-items-start">
-            <span class="text-secondary min-width-140px pr-3">Reports hypertension?</span>
-            <div>
-                <?= vsValue('has_hypertension_dx', $patient) ?>
-            </div>
-        </div>
-    </div>
-</div>
-<div class="row mb-2">
-    <div class="col-6 border-right">
-        <div class="d-flex align-items-start">
-            <span class="text-secondary min-width-140px pr-3">Reports hypertension medicine?</span>
-            <div>
-                <?= vsValue('is_prescribed_hypertension_medicine', $patient) ?>
-            </div>
-        </div>
-    </div>
-    <div class="col-6">
-        <div class="d-flex align-items-start">
-            <span class="text-secondary min-width-140px pr-3">Is it a goal to reduce<br>hypertension medicine?</span>
-            <div>
-                <?= vsValue('is_goal_to_reduce_hypertension_medicine', $patient) ?>
-            </div>
-        </div>
-    </div>
-</div>
-<div class="row mb-2">
-    <div class="col-6 border-right">
-        <div class="d-flex align-items-start">
-            <span class="text-secondary min-width-140px pr-3">Describe the goal</span>
-            <div>
-                <?= vsValue('goal_to_reduce_hypertension_medicine_memo', $patient) ?>
-            </div>
-        </div>
-    </div>
-    <div class="col-6">
-        <div class="d-flex align-items-center mb-2">
-            <span class="text-secondary min-width-140px pr-3">BP monitoring prescribed?</span>
-            <div>
-                <?= vsValue('is_bp_monitoring_needed', $patient) ?>
-            </div>
-        </div>
-        <div class="d-flex align-items-baseline">
-            <span class="text-secondary pr-3">Remarks</span>
-            <div class="flex-grow-1">
-                <?= vsValue('why_is_bp_monitoring_needed', $patient) ?>
-            </div>
+    <div class="col-6 offset-1">
+        <div class="table-responsive">
+            <table class="table table-sm table-striped table-bordered">
+                <tbody>
+                    <tr>
+                        <td>Reports prehypertension?</td>
+                        <td><?= vsValue('has_prehypertension_dx', $patient) ?></td>
+                    </tr>
+                    <tr>
+                        <td>Reports hypertension?</td>
+                        <td><?= vsValue('has_hypertension_dx', $patient) ?></td>
+                    </tr>
+                    <tr>
+                        <td>Reports hypertension medicine?</td>
+                        <td><?= vsValue('is_prescribed_hypertension_medicine', $patient) ?></td>
+                    </tr>
+                    <tr>
+                        <td>Is it a goal to reduce<br>hypertension medicine?</td>
+                        <td><?= vsValue('is_goal_to_reduce_hypertension_medicine', $patient) ?></td>
+                    </tr>
+                    <tr>
+                        <td>Describe the goal</td>
+                        <td><?= vsValue('goal_to_reduce_hypertension_medicine_memo', $patient) ?></td>
+                    </tr>
+                    <tr>
+                        <td>BP monitoring prescribed?</td>
+                        <td><?= vsValue('is_bp_monitoring_needed', $patient) ?></td>
+                    </tr>
+                    <tr>
+                        <td>BP monitoring prescribed?</td>
+                        <td><?= vsValue('is_bp_monitoring_needed', $patient) ?></td>
+                    </tr>
+                    <tr>
+                        <td>Remarks</td>
+                        <td><?= vsValue('why_is_bp_monitoring_needed', $patient) ?></td>
+                    </tr>
+                </tbody>
+            </table>
         </div>
     </div>
-</div>
+</div>

+ 226 - 0
resources/views/app/patient/vitals-settings/bp-management-summary_depricated.blade.php

@@ -0,0 +1,226 @@
+<div class="row">
+    <div class="col-6 border-right">
+        <div class="text-secondary font-weight-bold mb-3">Usual BP:</div>
+        <div class=" mb-3">
+            <div class="text-secondary font-weight-bold mb-2">
+                <i class="fa fa-sun"></i>
+                AM
+            </div>
+            <div class="">
+                <div class="mb-1 d-flex align-items-center">
+                    <span class="text-secondary width-50px">SBP:</span>
+                    <span class="text-secondary">(range
+                    <?= vsValue('usual_am_resting_sbp_min', $patient) ?>
+                    to
+                    <?= vsValue('usual_am_resting_sbp_max', $patient) ?>)</span>
+                </div>
+                <div class="mb-1 d-flex align-items-center">
+                    <span class="text-secondary width-50px">DBP:</span>
+                    <span class="text-secondary">(range
+                    <?= vsValue('usual_am_resting_dbp_min', $patient) ?>
+                    to
+                    <?= vsValue('usual_am_resting_dbp_max', $patient) ?>)</span>
+                </div>
+                <div class="mb-1 d-flex align-items-center">
+                    <span class="text-secondary width-50px">Pulse:</span>
+                    <span class="text-secondary">(range
+                    <?= vsValue('usual_am_resting_pulse_min', $patient) ?>
+                    to
+                    <?= vsValue('usual_am_resting_pulse_max', $patient) ?>)</span>
+                </div>
+            </div>
+        </div>
+        <div class=" ">
+            <div class="text-secondary font-weight-bold mb-2">
+                <i class="fa fa-moon"></i>
+                PM
+            </div>
+            <div class="">
+                <div class="mb-1 d-flex align-items-center">
+                    <span class="text-secondary width-50px">SBP:</span>
+                    <span class="text-secondary">(range
+                    <?= vsValue('usual_pm_resting_sbp_min', $patient) ?>
+                    to
+                    <?= vsValue('usual_pm_resting_sbp_max', $patient) ?>)</span>
+                </div>
+                <div class="mb-1 d-flex align-items-center">
+                    <span class="text-secondary width-50px">DBP:</span>
+                    <span class="text-secondary">(range
+                    <?= vsValue('usual_pm_resting_dbp_min', $patient) ?>
+                    to
+                    <?= vsValue('usual_pm_resting_dbp_max', $patient) ?>)</span>
+                </div>
+                <div class="d-flex align-items-center">
+                    <span class="text-secondary width-50px">Pulse:</span>
+                    <span class="text-secondary">(range
+                    <?= vsValue('usual_pm_resting_pulse_min', $patient) ?>
+                    to
+                    <?= vsValue('usual_pm_resting_pulse_max', $patient) ?>)</span>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="col-6">
+        <div class="text-secondary font-weight-bold mb-3">Ideal BP:</div>
+        <div class=" ">
+            <div class="">
+                <div class="mb-1 d-flex align-items-center">
+                    <span class="text-secondary width-50px">SBP:</span>
+                    <div class="font-weight-bold"><?= vsValue('ideal_am_resting_sbp', $patient) ?></div>
+                </div>
+                <div class="mb-3 d-flex align-items-center">
+                    <span class="text-secondary width-50px">Goal: &nbsp;</span>
+                    <div class="flex-grow-1">
+                        <?= vsValue('sbp_management_goal_category', $patient) ?>
+                    </div>
+                </div>
+                <div class="mb-1 d-flex align-items-center">
+                    <span class="text-secondary width-50px">DBP:</span>
+                    <div class="font-weight-bold"><?= vsValue('ideal_am_resting_dbp', $patient) ?></div>
+                </div>
+                <div class="mb-3 d-flex align-items-center">
+                    <span class="text-secondary width-50px">Goal: &nbsp;</span>
+                    <div class="flex-grow-1">
+                        <?= vsValue('dbp_management_goal_category', $patient) ?>
+                    </div>
+                </div>
+                <div class="mb-1 d-flex align-items-center">
+                    <span class="text-secondary width-50px">Pulse:</span>
+                    <div class="font-weight-bold"><?= vsValue('ideal_am_resting_pulse', $patient) ?></div>
+                </div>
+                <div class="mb-3 d-flex align-items-center">
+                    <span class="text-secondary width-50px">Goal: &nbsp;</span>
+                    <div class="flex-grow-1">
+                        <?= vsValue('pulse_management_goal_category', $patient) ?>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+<hr class="my-3">
+
+<div class="text-secondary font-weight-bold mb-3">Alerts</div>
+
+<div class="row">
+    <div class="col-6 border-right">
+        <div class="">
+            <div class="text-secondary font-weight-bold mb-2">
+                <i class="fa fa-circle text-danger"></i>
+                Red
+            </div>
+            <div class="">
+                <div class="mb-2 d-flex align-items-center">
+                    <span class="text-secondary">SBP: above</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_sbp_above', $patient) ?></div>
+                    <span class="text-secondary text-center">or below</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_sbp_below', $patient) ?></div>
+                </div>
+                <div class="mb-2 d-flex align-items-center">
+                    <span class="text-secondary">DBP: above</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_dbp_above', $patient) ?></div>
+                    <span class="text-secondary text-center">or below</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_dbp_below', $patient) ?></div>
+                </div>
+                <div class="d-flex align-items-center">
+                    <span class="text-secondary">Pulse: above</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_pulse_above', $patient) ?></div>
+                    <span class="text-secondary text-center">or below</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('red_alert_when_pulse_below', $patient) ?></div>
+                </div>
+            </div>
+        </div>
+    </div>
+    <div class="col-6">
+        <div class="">
+            <div class="text-secondary font-weight-bold mb-2">
+                <i class="fa fa-circle text-warning-mellow"></i>
+                Yellow
+            </div>
+            <div class="">
+                <div class="mb-2 d-flex align-items-center">
+                    <span class="text-secondary">SBP: above</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_sbp_above', $patient) ?></div>
+                    <span class="text-secondary text-center">or below</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_sbp_below', $patient) ?></div>
+                </div>
+                <div class="mb-2 d-flex align-items-center">
+                    <span class="text-secondary">DBP: above</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_dbp_above', $patient) ?></div>
+                    <span class="text-secondary text-center">or below</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_dbp_below', $patient) ?></div>
+                </div>
+                <div class="d-flex align-items-center">
+                    <span class="text-secondary">Pulse: above</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_pulse_above', $patient) ?></div>
+                    <span class="text-secondary text-center">or below</span>
+                    <div class="px-2 font-weight-bold"><?= vsValue('yellow_alert_when_pulse_below', $patient) ?></div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+<hr class="my-3">
+
+<div class="row mb-2">
+    <div class="col-6 border-right">
+        <div class="d-flex align-items-start">
+            <span class="text-secondary min-width-140px pr-3">Reports prehypertension?</span>
+            <div>
+                <?= vsValue('has_prehypertension_dx', $patient) ?>
+            </div>
+        </div>
+    </div>
+    <div class="col-6">
+        <div class="d-flex align-items-start">
+            <span class="text-secondary min-width-140px pr-3">Reports hypertension?</span>
+            <div>
+                <?= vsValue('has_hypertension_dx', $patient) ?>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="row mb-2">
+    <div class="col-6 border-right">
+        <div class="d-flex align-items-start">
+            <span class="text-secondary min-width-140px pr-3">Reports hypertension medicine?</span>
+            <div>
+                <?= vsValue('is_prescribed_hypertension_medicine', $patient) ?>
+            </div>
+        </div>
+    </div>
+    <div class="col-6">
+        <div class="d-flex align-items-start">
+            <span class="text-secondary min-width-140px pr-3">Is it a goal to reduce<br>hypertension medicine?</span>
+            <div>
+                <?= vsValue('is_goal_to_reduce_hypertension_medicine', $patient) ?>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="row mb-2">
+    <div class="col-6 border-right">
+        <div class="d-flex align-items-start">
+            <span class="text-secondary min-width-140px pr-3">Describe the goal</span>
+            <div>
+                <?= vsValue('goal_to_reduce_hypertension_medicine_memo', $patient) ?>
+            </div>
+        </div>
+    </div>
+    <div class="col-6">
+        <div class="d-flex align-items-center mb-2">
+            <span class="text-secondary min-width-140px pr-3">BP monitoring prescribed?</span>
+            <div>
+                <?= vsValue('is_bp_monitoring_needed', $patient) ?>
+            </div>
+        </div>
+        <div class="d-flex align-items-baseline">
+            <span class="text-secondary pr-3">Remarks</span>
+            <div class="flex-grow-1">
+                <?= vsValue('why_is_bp_monitoring_needed', $patient) ?>
+            </div>
+        </div>
+    </div>
+</div>

+ 5 - 5
resources/views/app/patient/wizard-partials/show-review.blade.php

@@ -6,14 +6,14 @@
         </div>
         <div class="d-flex align-items-baseline pt-1 border-top mt-1 mb-2">
             @if ($point->last_child_review_point_scoped_note_id === $patient->core_note_id)
-                <span class="text-sm">(updated on the patient's chart)</span>
+                <span class="text-sm text-nowrap">(upd. on the chart)</span>
             @else
                 @if ($point->last_child_review_point_scoped_note_id === $note->id)
-                    <span class="text-sm">(updated on this note)</span>
+                    <span class="text-sm text-nowrap">(upd. on this note)</span>
                 @else
                     <div class="d-inline position-relative on-click-menu">
-                        <span class="text-sm text-primary c-pointer">
-                            Updated <?= relative_friendly_date($review->note->effective_dateest) ?>
+                        <span class="text-sm text-primary c-pointer text-nowrap">
+                            Upd. <?= relative_friendly_date($review->note->effective_dateest) ?>
                         </span>
                         <div menu right class="bg-white border">
                             <a native target="_blank"
@@ -24,7 +24,7 @@
                 @endif
             @endif
             <span class="mx-2 text-secondary text-sm">|</span>
-            <a class="text-sm copy-to-new-subjective" href="#">Copy to new subjective</a>
+            <a class="text-sm copy-to-new-subjective" href="#">Copy to new subj.</a>
         </div>
     @else
         <span class="text-secondary text-sm">-</span>

+ 3 - 3
resources/views/app/patient/wizard-partials/state-icon.blade.php

@@ -1,7 +1,7 @@
 @if($point->state === 'ACTIVE')
-    <i class="text-success fa fa-circle text-sm on-hover-opaque mr-2 active-record"></i>
+    <i class="mt-1 text-success fa fa-circle text-sm on-hover-opaque mr-2 active-record"></i>
 @elseif($point->state === 'HISTORIC')
-    <i class="text-warning-mellow fa fa-circle text-sm on-hover-opaque mr-2 active-record"></i>
+    <i class="mt-1 text-warning-mellow fa fa-circle text-sm on-hover-opaque mr-2 active-record"></i>
 @elseif($point->state === 'ENTRY_ERROR')
-    <i class="text-secondary fa fa-circle text-sm on-hover-opaque mr-2"></i>
+    <i class="mt-1 text-secondary fa fa-circle text-sm on-hover-opaque mr-2"></i>
 @endif

+ 141 - 0
resources/views/app/practice-management/remote-monitoring-admin-row-markup.blade.php

@@ -0,0 +1,141 @@
+<tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
+    <td class="pl-2">
+        <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}" class="text-nowrap"
+           native target="_blank"
+           open-in-stag-popup
+           update-parent="refresh-rpm-row-{{$trIndex}}"
+           popup-style="tall overflow-visible"
+           mc-initer="care-month-dashboard-{{$iPatient->client_uid}}"
+           title="{{$iPatient->client_name}}"
+        ><span class="sort-data">{{ $iPatient->client_name }}</span></a>
+    </td>
+
+    <td>{{friendly_date($iPatient->dob)}}</td>
+    <td>{!! $iPatient->is_enrolled_in_rm === 'YES' ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
+    <td>{!! $iPatient->is_assigned_cellular_bp_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
+    <td>{!! $iPatient->is_assigned_cellular_weight_scale_device ? '<i class="fa fa-check text-success"></i>' : 'No' !!}</td>
+    <td>
+        <div class="text-nowrap">
+            <span class="sort-data">{{$iPatient->most_recent_cellular_bp_sbp_mm_hg ?: '-'}}</span>/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg ?: '-'}}
+            @if($iPatient->most_recent_cellular_bp_measurement_at)
+                <span class="text-sm text-secondary text-nowrap ml-1"
+                      title="{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}">({{friendly_date($iPatient->most_recent_cellular_bp_measurement_at)}})</span>
+            @endif
+        </div>
+    </td>
+    <td>
+        <div class="text-nowrap">
+            <span class="sort-data">{{$iPatient->most_recent_cellular_weight_value ? round($iPatient->most_recent_cellular_weight_value, 1) : '-'}}</span>
+            @if($iPatient->most_recent_cellular_weight_measurement_at)
+                <span class="text-sm text-secondary text-nowrap ml-1"
+                      title="{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}">({{friendly_date($iPatient->most_recent_cellular_weight_measurement_at)}})</span>
+            @endif
+        </div>
+    </td>
+    <td>
+        <div class="d-flex align-items-baseline">
+            @if($iPatient->most_recent_completed_mcp_note_uid_cm)
+                <a href = "/patients/view/{{$iPatient->client_uid}}/notes/view/{{$iPatient->most_recent_completed_mcp_note_uid_cm}}">
+                    <span class="sort-data">{{$iPatient->most_recent_completed_mcp_note_date_cm ? friendly_date($iPatient->most_recent_completed_mcp_note_date_cm) : '-'}}</span>
+                </a>
+            @else
+                <span class="sort-data">-</span>
+            @endif
+        </div>
+    </td>
+    <td>
+        <div class="d-flex align-items-baseline">
+            <i class="mr-1 text-sm fa {{$lastVisitWithin90Days ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
+            <span class="sort-data">{{$daysDiff !== -1 ? $daysDiff : '-'}}</span>
+        </div>
+    </td>
+    <td>
+        <div class="d-flex align-items-baseline">
+            <i class="mr-1 text-sm fa {{$iPatient->has_mcp_interacted_with_client_about_rm ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
+            <span>{{$iPatient->has_mcp_interacted_with_client_about_rm ? 'Yes' : 'No'}}</span>
+        </div>
+        {{--@if(!$iPatient->has_mcp_interacted_with_client_about_rm)
+            <div class="text-sm font-italic text-secondary">{{$performerRole === 'MCP' ? 'Not' : "MCP hasn't"}} interacted this month!</div>
+        @endif--}}
+    </td>
+    <td>
+        <div class="d-flex align-items-baseline">
+            <i class="mr-1 text-sm fa {{$iPatient->number_of_days_with_remote_measurements >= 16 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
+            <span class="sort-data">{{$iPatient->number_of_days_with_remote_measurements ?: 0}}</span>
+        </div>
+        {{--@if($iPatient->number_of_days_with_remote_measurements < 16)
+            <div class="text-sm font-italic text-secondary">Meas. days < 16</div>
+        @endif--}}
+    </td>
+    <td>
+        <div class="d-flex align-items-baseline">
+            <span class="sort-data">{{$iPatient->rm_num_measurements_not_stamped_by_mcp}}</span>
+        </div>
+    </td>
+    <td>
+        <div class="d-flex align-items-baseline">
+            <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds_by_mcp >= 1200 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
+            <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_mcp / 60)}}m {{round($iPatient->rm_total_time_in_seconds_by_mcp % 60)}}s</span>
+            <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_mcp}}</span>
+        </div>
+    </td>
+    <td>
+        <div class="d-flex align-items-baseline">
+            <i class="mr-1 text-sm fa {{$iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200 ? 'fa-check text-success' : 'fa-exclamation-triangle text-danger'}}"></i>
+            <span class="text-nowrap">{{round($iPatient->rm_total_time_in_seconds_by_rmm_pro / 60)}}m {{round($iPatient->rm_total_time_in_seconds_by_rmm_pro % 60)}}s</span>
+            <span class="sort-data d-none">{{$iPatient->rm_total_time_in_seconds_by_rmm_pro}}</span>
+        </div>
+    </td>
+    <td>{{$iPatient->mcp_pro_name}}</td>
+    <td>{{$iPatient->rmm_pro_name}}</td>
+    <td>
+        @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_mcp >= 1200)
+            <span class="text-success font-weight-bold">
+                <i class="fa fa-check"></i>
+                Yes
+            </span>
+        @else
+            <span class="text-danger font-weight-normal">
+                Not yet
+            </span>
+        @endif
+    </td>
+    <td>
+        @if($lastVisitWithin90Days && $iPatient->has_mcp_interacted_with_client_about_rm && $iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->rm_total_time_in_seconds_by_rmm_pro >= 1200)
+            <span class="text-success font-weight-bold">
+                <i class="fa fa-check"></i>
+                Yes
+            </span>
+        @else
+            <span class="text-danger font-weight-normal">
+                Not yet
+            </span>
+        @endif
+    </td>
+    <td>
+        @if($iPatient->number_of_days_with_remote_measurements >= 16 && $lastVisitWithin90Days)
+            <span class="text-success font-weight-bold">
+                <i class="fa fa-check"></i>
+                Yes
+            </span>
+        @else
+            <span class="text-danger font-weight-normal">
+                Not yet
+            </span>
+        @endif
+    </td>
+    <td>
+        @if($iPatient->number_of_days_with_remote_measurements >= 16 && $iPatient->has_anyone_interacted_with_client_about_rm &&
+            $lastVisitWithin90Days &&
+            ($iPatient->rm_total_time_in_seconds_by_mcp + $iPatient->rm_total_time_in_seconds_by_rmm_pro) >= 1200)
+            <span class="text-success font-weight-bold">
+                <i class="fa fa-check"></i>
+                Yes
+            </span>
+        @else
+            <span class="text-danger font-weight-normal">
+                Not yet
+            </span>
+        @endif
+    </td>
+</tr>

+ 157 - 104
resources/views/app/practice-management/remote-monitoring-admin.blade.php

@@ -1,41 +1,65 @@
 @extends ('layouts/template')
 
 @section('content')
-
-    <div class="p-3 mcp-theme-1" id="admin-remote-monitoring">
+    <style>
+        #admin-table-rm-matrix_wrapper {
+            padding-top: 10px;
+        }
+    </style>
+    <link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.min.css">
+    <script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
+    <style>
+        #table-rm-matrix_length, #table-rm-matrix_info {
+            padding-left: 0.5rem;
+        }
+        #table-rm-matrix_filter {
+            padding-right: 0.5rem;
+        }
+        #table-rm-matrix_paginate {
+            padding: 0.5rem;
+        }
+    </style>
+    <div class="p-3 mcp-theme-1" id="practice-remote-monitoring" v-cloak>
 
         <div class="card">
 
-            <div class="card-header px-2 py-2 d-flex align-items-center">
+            <div class="card-header px-2 py-2 d-flex align-items-baseline">
                 <span class="mr-4">
                     <span class="font-size-14">Remote Monitoring</span>
                     <i class="fas fa-arrow-right text-sm mx-1"></i>
                     <b class="font-size-14">{{friendly_month(date((request()->input('y') ?: 'Y') . '-' . (request()->input('m') ?: 'm') . '-d'))}}</b>
                 </span>
-                <form class="ml-auto d-inline-flex flex-nowrap align-items-center" action="" method="GET">
+                <?php
 
+                $mStr = request()->input('m') ? request()->input('m') : date('m');
+                $yStr = request()->input('y') ? request()->input('y') : date('Y');
+                $rcmStartDate = $yStr . '-' . $mStr . '-' . '01';
+                $m = +$mStr;
+                $y = +$yStr;
+                ?>
+                <form class="ml-auto d-inline-flex flex-nowrap align-items-center" action="" method="GET">
                     <span class="mr-2">Month</span>
                     <select class="form-control form-control-sm min-width-unset width-100px mr-3" name="m"
-                            onchange="fastLoad('{{route('practice-management.remote-monitoring-admin')}}?' + $(this).closest('form').serialize())">
-                        <option value="01" {{request()->input('m') === '01' ? 'selected' : ''}}>Jan</option>
-                        <option value="02" {{request()->input('m') === '02' ? 'selected' : ''}}>Feb</option>
-                        <option value="03" {{request()->input('m') === '03' ? 'selected' : ''}}>Mar</option>
-                        <option value="04" {{request()->input('m') === '04' ? 'selected' : ''}}>Apr</option>
-                        <option value="05" {{request()->input('m') === '05' ? 'selected' : ''}}>May</option>
-                        <option value="06" {{request()->input('m') === '06' ? 'selected' : ''}}>Jun</option>
-                        <option value="07" {{request()->input('m') === '07' ? 'selected' : ''}}>Jul</option>
-                        <option value="08" {{request()->input('m') === '08' ? 'selected' : ''}}>Aug</option>
-                        <option value="09" {{request()->input('m') === '09' ? 'selected' : ''}}>Sep</option>
-                        <option value="10" {{request()->input('m') === '10' ? 'selected' : ''}}>Oct</option>
-                        <option value="11" {{request()->input('m') === '11' ? 'selected' : ''}}>Nov</option>
-                        <option value="12" {{request()->input('m') === '12' ? 'selected' : ''}}>Dec</option>
+                            onchange="fastLoad('{{route('practice-management.remote-monitoring')}}?' + $(this).closest('form').serialize())">
+                        <option value="01" {{$m === 1 ? 'selected' : ''}}>Jan</option>
+                        <option value="02" {{$m === 2 ? 'selected' : ''}}>Feb</option>
+                        <option value="03" {{$m === 3 ? 'selected' : ''}}>Mar</option>
+                        <option value="04" {{$m === 4 ? 'selected' : ''}}>Apr</option>
+                        <option value="05" {{$m === 5 ? 'selected' : ''}}>May</option>
+                        <option value="06" {{$m === 6 ? 'selected' : ''}}>Jun</option>
+                        <option value="07" {{$m === 7 ? 'selected' : ''}}>Jul</option>
+                        <option value="08" {{$m === 8 ? 'selected' : ''}}>Aug</option>
+                        <option value="09" {{$m === 9 ? 'selected' : ''}}>Sep</option>
+                        <option value="10" {{$m === 10 ? 'selected' : ''}}>Oct</option>
+                        <option value="11" {{$m === 11 ? 'selected' : ''}}>Nov</option>
+                        <option value="12" {{$m === 12 ? 'selected' : ''}}>Dec</option>
                     </select>
                     <span class="mr-2">Year</span>
                     <select class="form-control form-control-sm min-width-unset width-100px" name="y"
-                            onchange="fastLoad('{{route('practice-management.remote-monitoring-admin')}}?' + $(this).closest('form').serialize())">
-                        <option value="2020" {{request()->input('y') === '2020' ? 'selected' : ''}}>2020</option>
-                        <option value="2021" {{request()->input('y') === '2021' ? 'selected' : ''}}>2021</option>
-                        <option value="2022" {{request()->input('y') === '2022' ? 'selected' : ''}}>2022</option>
+                            onchange="fastLoad('{{route('practice-management.remote-monitoring')}}?' + $(this).closest('form').serialize())">
+                        <option value="2020" {{$y === 2020 ? 'selected' : ''}}>2020</option>
+                        <option value="2021" {{$y === 2021 ? 'selected' : ''}}>2021</option>
+                        <option value="2022" {{$y === 2022 ? 'selected' : ''}}>2022</option>
                     </select>
                 </form>
             </div>
@@ -44,94 +68,69 @@
 
             <div class="card-body p-0">
                 <div class="d-flex align-items-start m-0">
-                    <div class="p-0">
-                        @include('app.practice-management.remote-monitoring-admin-tree')
-                    </div>
-                    <div class="flex-grow-1 border-left p-0">
-                        @if($rc == 4)
-                            <?php $rc2 = request()->input('rc2') ? request()->input('rc2') : 2; ?>
-                            <div class="d-flex align-items-baseline p-2 border-bottom">
-                                <a href="{{route('practice-management.remote-monitoring-admin')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=4&rc2=1" class="border p-2 mr-2 {{$rc2 == 1 ? 'bg-aliceblue font-weight-bold' : ''}}" >Patients not seen in over 90 days</a>
-                                <a href="{{route('practice-management.remote-monitoring-admin')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=4&rc2=2" class="border p-2 mr-2 {{$rc2 == 2 ? 'bg-aliceblue font-weight-bold' : ''}}" >Patients seen w/in last 90 days</a>
-                            </div>
-                        @elseif($rc == 5)
-                            <?php $rc2 = request()->input('rc2') ? request()->input('rc2') : 2; ?>
-                            <div class="d-flex align-items-baseline p-2 border-bottom">
-                                <a href="{{route('practice-management.remote-monitoring-admin')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=5&rc2=1" class="border p-2 mr-2 {{$rc2 == 1 ? 'bg-aliceblue font-weight-bold' : ''}}" >Patients not spoken to this month</a>
-                                <a href="{{route('practice-management.remote-monitoring-admin')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=5&rc2=2" class="border p-2 mr-2 {{$rc2 == 2 ? 'bg-aliceblue font-weight-bold' : ''}}" >Patients spoken to this month</a>
-                            </div>
-                        @elseif($rc == 6)
-                            <?php $rc2 = request()->input('rc2') ? request()->input('rc2') : 2; ?>
-                            <div class="d-flex align-items-baseline p-2 border-bottom">
-                                <a href="{{route('practice-management.remote-monitoring-admin')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=6&rc2=1" class="border p-2 mr-2 {{$rc2 == 1 ? 'bg-aliceblue font-weight-bold' : ''}}" >Unstamped Measurements > 0</a>
-                                <a href="{{route('practice-management.remote-monitoring-admin')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=6&rc2=2" class="border p-2 mr-2 {{$rc2 == 2 ? 'bg-aliceblue font-weight-bold' : ''}}" >All Measurements Stamped</a>
-                            </div>
-                        @elseif($rc == 7)
-                            <?php $rc2 = request()->input('rc2') ? request()->input('rc2') : 2; ?>
-                            <div class="d-flex align-items-baseline p-2 border-bottom">
-                                <a href="{{route('practice-management.remote-monitoring-admin')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=7&rc2=1" class="border p-2 mr-2 {{$rc2 == 1 ? 'bg-aliceblue font-weight-bold' : ''}}" >Measurement Days < 16</a>
-                                <a href="{{route('practice-management.remote-monitoring-admin')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=7&rc2=2" class="border p-2 mr-2 {{$rc2 == 2 ? 'bg-aliceblue font-weight-bold' : ''}}" >Measurement Days >= 16</a>
-                            </div>
-                        @elseif($rc == 10)
-                            <?php $rc2 = request()->input('rc2') ? request()->input('rc2') : 2; ?>
-                            <div class="d-flex align-items-baseline p-2 border-bottom">
-                                <a href="{{route('practice-management.remote-monitoring-admin')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=10&rc2=1" class="border p-2 mr-2 {{$rc2 == 1 ? 'bg-aliceblue font-weight-bold' : ''}}" >Billing Minutes < 20</a>
-                                <a href="{{route('practice-management.remote-monitoring-admin')}}?m={{request()->input('m')}}&y={{request()->input('y')}}&rc=10&rc2=2" class="border p-2 mr-2 {{$rc2 == 2 ? 'bg-aliceblue font-weight-bold' : ''}}" >Billing Minutes >= 20</a>
-                            </div>
-                        @endif
-                        <table class="table table-sm table-striped table-hover p-0 m-0 foo-bar-t" id="admin-table-rm-matrix">
+                    <div class="flex-grow-1 px-0 pt-2">
+                        <?php $trIndex = 0; ?>
+                        @foreach ($patients as $iPatient)
+                            <script>
+                                addMCHook(
+                                    'refresh-rpm-row-{{$trIndex}}',
+                                    function () {
+                                        refreshRpmRow({{$trIndex}});
+                                    }
+                                );
+                            </script>
+                            <?php $trIndex++; ?>
+                        @endforeach
+                        <table class="table table-sm table-striped table-hover p-0 m-0 border-top" id="table-rm-matrix">
                             <thead class="bg-light">
-                            <tr>
-                                <th class="border-0">Patient</th>
-                                <th class="border-0">MCP</th>
+                            <tr stag-title="Click to sort. Shift+Click to multi-sort.">
+                                <th class="border-0 pl-2">Name</th>
                                 <th class="border-0">DOB</th>
-                                <th class="border-0">Enrolled in RPM?</th>
-                                <th class="border-0">Cellular BP?</th>
-                                <th class="border-0">Cellular Scale?</th>
-                                <th class="border-0">Latest BP</th>
-                                <th class="border-0">Latest Weight</th>
-                                <th class="border-0">Latest Visit</th>
-                                <th class="border-0">RPM Interaction This Month?</th>
-                                <th class="border-0">Measurements Pending Stamp</th>
-                                <th class="border-0"># Meas. Days This Month</th>
-                                <th class="border-0"># RPM Minutes</th>
-
+                                <th class="border-0">RPM?</th>
+                                <th class="border-0">Cell. BP?</th>
+                                <th class="border-0">Cell. Scale?</th>
+                                <th class="border-0">Last BP</th>
+                                <th class="border-0">Last Wt</th>
+                                <th class="border-0">Last Visit</th>
+                                <th class="border-0">Days Since<br>Last Visit</th>
+                                <th class="border-0">Interacted?</th>
+                                <th class="border-0">#Meas. Days</th>
+                                <th class="border-0">#Unstamped</th>
+                                <th class="border-0">MCP Mins.</th>
+                                <th class="border-0">RMM Mins.</th>
+                                <th class="border-0">MCP</th>
+                                <th class="border-0">RMM</th>
+                                <th class="border-0">MCP Billable</th>
+                                <th class="border-0">RMM Billable</th>
+                                <th class="border-0">454</th>
+                                <th class="border-0">457</th>
                             </tr>
                             </thead>
                             <tbody>
+                            <?php $trIndex = 0; ?>
                             @foreach ($patients as $iPatient)
-                                <?php $oPatient = \App\Models\Client::where('uid', $iPatient->client_uid)->first(); ?>
-                                <tr>
-                                    <td class="">
-                                        <a href="/patients/view/{{ $iPatient->client_uid }}" class="text-nowrap">{{ $oPatient->displayName() }}</a>
-                                    </td>
-                                    <td class="">
-                                        {{$oPatient->mcp ? $oPatient->mcp->displayName() : '-'}}
-                                    </td>
+                                <?php
+
+                                $daysDiff = -1;
+                                if($iPatient->most_recent_completed_mcp_note_date) {
+                                    $careMonthLastDay = date_add(date_create($rcmStartDate), date_interval_create_from_date_string("1 month"));
+                                    $careMonthLastDay = date_sub($careMonthLastDay, date_interval_create_from_date_string("1 day"));
+                                    $daysDiff = date_diff($careMonthLastDay, date_create($iPatient->most_recent_completed_mcp_note_date))->days;
+                                }
+                                $lastVisitWithin90Days = ($daysDiff !== -1 && $daysDiff <= 90);
 
-                                    <td>{{friendly_date($iPatient->dob)}}</td>
-                                    <td>{{ucwords(strtolower($iPatient->is_enrolled_in_rm ?: ''))}}</td>
-                                    <td>{{$oPatient->hasBPDevice() ? 'Yes' : 'No'}}</td>
-                                    <td>{{$oPatient->hasBPDevice() ? 'Yes' : 'No'}}</td>
-                                    <td>
-                                        {{$iPatient->most_recent_cellular_bp_sbp_mm_hg ?: '-'}}/{{$iPatient->most_recent_cellular_bp_dbp_mm_hg ?: '-'}}
-                                        @if($iPatient->most_recent_cellular_bp_measurement_at)
-                                            <div class="text-sm text-secondary text-nowrap">{{friendly_date_time($iPatient->most_recent_cellular_bp_measurement_at)}}</div>
-                                        @endif
-                                    </td>
-                                    <td>
-                                        {{$iPatient->most_recent_cellular_weight_value ? round($iPatient->most_recent_cellular_weight_value, 1) : '-'}}
-                                        @if($iPatient->most_recent_cellular_weight_measurement_at)
-                                            <div class="text-sm text-secondary text-nowrap">{{friendly_date_time($iPatient->most_recent_cellular_weight_measurement_at)}}</div>
-                                        @endif
-                                    </td>
-                                    <td>{{$iPatient->most_recent_completed_mcp_note_date ? friendly_date($iPatient->most_recent_completed_mcp_note_date) : '-'}}</td>
-                                    <td>{{$iPatient->has_anyone_interacted_with_client_about_rm_outside_note ? 'Yes' : 'No'}}</td>
-                                    <td>{{$iPatient->rm_num_measurements_not_stamped_by_mcp}}</td>
-                                    <td>{{$iPatient->number_of_days_with_remote_measurements ?: 0}}</td>
-                                    <td>{{floor($iPatient->rm_total_time_in_seconds_by_mcp / 60)}}</td>
+                                $performerRole = false;
+                                if ($pro->pro_type === 'ADMIN') {
+                                    $performerRole = 'ADMIN';
+                                } else if ($iPatient->care_month_mcp_pro_id === $pro->id) {
+                                    $performerRole = 'MCP';
+                                } else if ($iPatient->care_month_rmm_pro_id === $pro->id) {
+                                    $performerRole = 'RMM';
+                                }
 
-                                </tr>
+                                ?>
+                                @include('app.practice-management.remote-monitoring-admin-row-markup')
+                                <?php $trIndex++; ?>
                             @endforeach
                             </tbody>
                         </table>
@@ -142,12 +141,66 @@
     </div>
     <script>
         (function() {
+            let dataTableInst = null;
+            window.refreshRpmRow = function(_index) {
+                let tr = $('#table-rm-matrix tbody tr:eq(' + _index + ')');
+                if(!tr.length) return;
+                let clientUid = tr.attr('data-client-uid'), careMonthUid = tr.attr('data-care-month-uid');
+                $.get('/rpm-matrix-row?m={{$mStr}}&y={{$yStr}}&clientUid=' + clientUid + '&careMonthUid=' + careMonthUid + '&trIndex=' + _index, _data => {
+                    let row = $(_data);
+                    row.find('>td').each(function(_columnIndex) {
+                        dataTableInst.cell(_index, _columnIndex).data(this.innerHTML); //.draw();
+                    });
+                    $('#practice-remote-monitoring [moe][initialized]').removeAttr('initialized');
+                    initMoes();
+                    tr.addClass('post-refresh-highlight');
+                    setTimeout(function() {
+                        tr.removeClass('post-refresh-highlight');
+                    }, 1000);
+                });
+            }
             function init() {
-                $('#admin-table-rm-matrix').DataTable({
-                    "pageLength": 100
+                dataTableInst = $('#table-rm-matrix').DataTable({
+                    paging: false,
+                    columnDefs: [
+                        {
+                            targets: 0,
+                            type: 'string',
+                            render: function (data, type, row, meta) {
+                                if(type === 'sort') {
+                                    return $(data).find('.sort-data').first().text();
+                                }
+                                return data;
+                            },
+                        },
+                        {targets: 1, type: 'date'},
+                        {
+                            targets: 7,
+                            type: 'date',
+                            render: function (data, type, row, meta) {
+                                if(type === 'sort') {
+                                    return $(data).find('.sort-data').first().text();
+                                }
+                                return data;
+                            },
+                        },
+                        {
+                            targets: [5, 6, 8, 10, 11, 12],
+                            type: 'num',
+                            render: function (data, type, row, meta) {
+                                if(type === 'sort') {
+                                    return +($(data).find('.sort-data').first().text());
+                                }
+                                return data;
+                            },
+                        },
+                    ]
                 });
+                $('#practice-remote-monitoring').removeAttr('v-cloak');
+                $('#practice-remote-monitoring [moe][initialized]').removeAttr('initialized');
+                initMoes();
             }
-            addMCInitializer('admin-remote-monitoring', init, '#admin-remote-monitoring');
+            addMCInitializer('practice-remote-monitoring', init, '#practice-remote-monitoring');
         }).call(window);
     </script>
 @endsection

Vissa filer visades inte eftersom för många filer har ändrats