Samson Mutunga 3 gadi atpakaļ
vecāks
revīzija
ca4c71d6ca
42 mainītis faili ar 1130 papildinājumiem un 146 dzēšanām
  1. 9 9
      app/Http/Controllers/McpController.php
  2. 11 1
      app/Http/Controllers/NoteController.php
  3. 14 3
      app/Http/Controllers/PracticeManagementController.php
  4. 14 4
      app/Models/Client.php
  5. 6 1
      app/Models/Pro.php
  6. 8 4
      public/css/style.css
  7. 4 4
      public/css/z.css
  8. 1 1
      resources/views/app/mcp/bills.blade.php
  9. 2 2
      resources/views/app/mcp/dashboard/calls_memos.blade.php
  10. 3 3
      resources/views/app/mcp/dashboard/messages.blade.php
  11. 73 31
      resources/views/app/mcp/patients-table.blade.php
  12. 2 2
      resources/views/app/patient/canvas-sections/allergies/summary.php
  13. 3 3
      resources/views/app/patient/canvas-sections/dx/summary.php
  14. 1 1
      resources/views/app/patient/canvas-sections/pmhx/summary.php
  15. 1 1
      resources/views/app/patient/canvas-sections/pshx/summary.php
  16. 2 2
      resources/views/app/patient/canvas-sections/rx/summary.php
  17. 1 1
      resources/views/app/patient/canvas-sections/sochx/summary.php
  18. 31 27
      resources/views/app/patient/dashboard.blade.php
  19. 15 3
      resources/views/app/patient/note/dashboard.blade.php
  20. 5 0
      resources/views/app/patient/note/dashboard_script.blade.php
  21. 2 2
      resources/views/app/patient/note/note-segment-list.blade.php
  22. 23 0
      resources/views/app/patient/note/rhs-sidebar.blade.php
  23. 14 1
      resources/views/app/patient/note/segment.blade.php
  24. 38 2
      resources/views/app/patient/notes.blade.php
  25. 5 1
      resources/views/app/patient/point-based-partials/allergies.blade.php
  26. 4 0
      resources/views/app/patient/point-based-partials/care-team.blade.php
  27. 4 0
      resources/views/app/patient/point-based-partials/dx.blade.php
  28. 4 0
      resources/views/app/patient/point-based-partials/rx.blade.php
  29. 35 0
      resources/views/app/patient/point-based-partials/supplements.blade.php
  30. 58 0
      resources/views/app/patient/segment-templates/intake_supplements/summary.blade.php
  31. 81 0
      resources/views/app/patient/segment-templates/plan_supplements/summary.blade.php
  32. 35 0
      resources/views/app/patient/settings.blade.php
  33. 307 0
      resources/views/app/patient/supplements-center.blade.php
  34. 89 0
      resources/views/app/patient/supplements-reconcile.blade.php
  35. 1 1
      resources/views/app/patient/wizard-partials/common-fields.blade.php
  36. 4 4
      resources/views/app/patient/wizard-partials/common-script.blade.php
  37. 4 1
      resources/views/app/patients.blade.php
  38. 81 0
      resources/views/app/practice-management/rpm-matrix.blade.php
  39. 2 30
      resources/views/layouts/patient.blade.php
  40. 6 0
      resources/views/layouts/template.blade.php
  41. 6 1
      routes/web.php
  42. 121 0
      spec/core_child_plan_spec.txt

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

@@ -93,7 +93,7 @@ class McpController extends Controller
                 break;
         }
 
-        $patients = $patients->orderBy('created_at', 'DESC')->paginate(20);
+        $patients = $patients->orderBy('created_at', 'DESC')->paginate(50);
         return view('app.mcp.patients', compact('patients', 'filters'));
     }
 
@@ -103,9 +103,9 @@ class McpController extends Controller
         $notes = Note::query();
         $notes = $notes->where('hcp_pro_id', $this->performer->pro->id);
         $this->filterMultiQuery($request, $notes, 'effective_time', 'date_category', 'date_value_1', 'date_value_2');
-        $this->filterSimpleQuery($request, $notes, 'new_or_fu_or_na', 'new_or_fu_or_na');   
+        $this->filterSimpleQuery($request, $notes, 'new_or_fu_or_na', 'new_or_fu_or_na');
         $notes = $notes->orderBy('created_at', 'DESC')->paginate(20);
-        
+
 
         return view('app.mcp.notes', compact('notes','filters'));
     }
@@ -136,7 +136,7 @@ class McpController extends Controller
 
     public function clients_bdt_devices(Request $request){
         $filters = $request->all();
-        
+
         $devices = ClientBDTDevice::select('client_bdt_device.*')
         ->join('client', 'client.id', '=', 'client_bdt_device.client_id')
         ->where('client.mcp_pro_id', $this->performer->pro->id);
@@ -154,7 +154,7 @@ class McpController extends Controller
 
     public function memos(Request $request){
         $filters = $request->all();
-        
+
         $memos = ClientMemo::select('client_memo.*')
         ->join('client', 'client.id', '=', 'client_memo.client_id')
         ->where('client.mcp_pro_id', $this->performer->pro->id);
@@ -198,7 +198,7 @@ class McpController extends Controller
         $filters = $request->all();
         $supplyOrders = SupplyOrder::select('supply_order.*')->where('supply_order.signed_by_pro_id', $this->performer->pro->id);
         $this->filterMultiQuery($request, $supplyOrders, 'created_at', 'date_category', 'date_value_1', 'date_value_2');
-        $status = $request->get('status');        
+        $status = $request->get('status');
         if($status){
             if($status == 'CLEARED_FOR_SHIPMENT'){
                 $supplyOrders = $supplyOrders->where('is_cleared_for_shipment', true);
@@ -207,16 +207,16 @@ class McpController extends Controller
             }elseif($status == 'CANCELLED'){
                 $supplyOrders = $supplyOrders->where('is_cancelled', true);
             }else{
-             $supplyOrders = $supplyOrders->join('shipment', 'shipment.id', '=', 'supply_order.shipment_id')->where('shipment.status', $status);   
+             $supplyOrders = $supplyOrders->join('shipment', 'shipment.id', '=', 'supply_order.shipment_id')->where('shipment.status', $status);
             }
-            
+
         }
         $supplyOrders = $supplyOrders->orderBy('created_at', 'DESC')->paginate(20);
         return view('app.mcp.supply_orders', compact('supplyOrders', 'filters'));
     }
 
     public function client_messages(Request $request)
-    {      
+    {
         $filters = $request->all();
 
         $clientMessages = ClientSMS::select('client_sms.*')

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

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

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

@@ -46,6 +46,17 @@ use Illuminate\Http\Request;
 class PracticeManagementController extends Controller
 {
 
+    public function rpmMatrix(Request $request)
+    {
+        $proID = $this->performer()->pro->id;
+        $isAdmin = $this->performer()->pro->pro_type == 'ADMIN';
+        $query = Client::whereNull('shadow_pro_id');
+        if(!$isAdmin) $query->where('mcp_pro_id', '=', $proID);
+        $clients = $query->orderByRaw('most_recent_cellular_measurement_at desc nulls last')
+            ->paginate(50);
+        return view ('app.practice-management.rpm-matrix', compact('clients'));
+    }
+
     public function mcCodeChecks(Request $request)
 	{
 		$checks = McCodeCheck::orderBy('next_eligible_date_professional', 'asc')->get();
@@ -2025,7 +2036,7 @@ ORDER BY c.name_last, c.name_first
 
     public function clientsBdtDevices(Request $request){
         $filters = $request->all();
-        
+
         $devices = ClientBDTDevice::select('client_bdt_device.*')
         ->join('client', 'client.id', '=', 'client_bdt_device.client_id');
 
@@ -2045,7 +2056,7 @@ ORDER BY c.name_last, c.name_first
 
     public function memos(Request $request){
         $filters = $request->all();
-        
+
         $memos = ClientMemo::select('client_memo.*')
         ->join('client', 'client.id', '=', 'client_memo.client_id');
 
@@ -2060,6 +2071,6 @@ ORDER BY c.name_last, c.name_first
         return view('app.practice-management.memos', compact('memos', 'filters'));
     }
 
-    
+
 
 }

+ 14 - 4
app/Models/Client.php

@@ -94,7 +94,8 @@ class Client extends Model
     {
         return $this->hasMany(Note::class, 'client_id', 'id')
            // ->where('is_core_note', false)
-            ->orderBy('effective_dateest', 'desc');
+            ->orderBy('effective_dateest', 'desc')
+            ->orderBy('created_at', 'desc');
     }
 
     public function prescriptions()
@@ -123,7 +124,8 @@ class Client extends Model
     public function notesAscending()
     {
         return $this->hasMany(Note::class, 'client_id', 'id')
-            ->orderBy('effective_dateest', 'asc');
+            ->orderBy('effective_dateest', 'asc')
+            ->orderBy('created_at', 'desc');;
     }
 
     public function mcCodeChecks(){
@@ -143,7 +145,8 @@ class Client extends Model
         return $this->hasMany(Note::class, 'client_id', 'id')
             ->where('is_cancelled', false)
             ->where('id', '<>', $this->core_note_id)
-            ->orderBy('effective_dateest', 'desc');
+            ->orderBy('effective_dateest', 'desc')
+            ->orderBy('created_at', 'desc');;
     }
 
     public function cancelledNotes()
@@ -151,7 +154,8 @@ class Client extends Model
         return $this->hasMany(Note::class, 'client_id', 'id')
             ->where('is_cancelled', true)
             ->where('id', '<>', $this->core_note_id)
-            ->orderBy('effective_dateest', 'desc');
+            ->orderBy('effective_dateest', 'desc')
+            ->orderBy('created_at', 'desc');;
     }
 
     public function sections()
@@ -843,4 +847,10 @@ ORDER BY m.ts DESC
     }
 
     
+    public function nonCoreVisitNotes() {
+        return $this->hasMany(Note::class, 'client_id', 'id')
+            ->where('id', '<>', $this->core_note_id)
+            ->whereNotNull('visit_template_id')
+            ->orderBy('created_at', 'desc');
+    }
 }

+ 6 - 1
app/Models/Pro.php

@@ -56,7 +56,8 @@ class Pro extends Model
 
     public function isDefaultNA()
     {
-        return $this->is_considered_for_dna;
+        // TODO are we using this?
+        return true; // $this->is_considered_for_dna;
     }
 
     public function lastPayment() {
@@ -465,10 +466,14 @@ WHERE mcp_pro_id = :pro_id
         return $this->get_patients_overdue_for_visit_for_dna_query()->count();
     }
 
+    
+
     function get_patients_without_remote_measurement_in_48_hours_count_as_mcp() {
+        return DB::select("SELECT COUNT(*) as count FROM client WHERE ((most_recent_cellular_measurement_at+ interval '48 hour')::timestamp < NOW() OR most_recent_cellular_measurement_id IS NULL) AND client.mcp_pro_id = :mcp_pro_id AND is_active IS TRUE", ['mcp_pro_id'=>$this->id])[0]->count; 
     }
 
     function get_patients_without_remote_measurement_in_48_hours_count_as_dna() {
+        return DB::select("SELECT COUNT(*) as count FROM client WHERE ((most_recent_cellular_measurement_at+ interval '48 hour')::timestamp < NOW() OR most_recent_cellular_measurement_id IS NULL) AND client.default_na_pro_id = :default_na_pro_id AND is_active IS TRUE", ['default_na_pro_id'=>$this->id])[0]->count; 
     }
 
     function get_cancelled_appointments_pending_acknowledgement_count_as_mcp_query() {

+ 8 - 4
public/css/style.css

@@ -201,6 +201,9 @@ body.stag_rhs_collapsed .app-right-panel {
 .mcp-theme-1 a, .mcp-theme-1 a:link {
     color: rgb(13, 89, 175);
 }
+.mcp-theme-1 .text-primary {
+    color: rgb(13, 89, 175) !important;
+}
 .mcp-theme-1 .btn.btn-primary {
     background: rgb(13, 89, 175);
     border-color: rgb(13, 89, 175);
@@ -264,7 +267,8 @@ body>nav.navbar {
 [moe][huge] form, [moe][huge] [url] {
     width: 750px;
 }
-[moe][bottom] form {
+[moe][bottom] form,
+[moe][bottom] div[url]{
     bottom: 100%;
 }
 .moe-disabled[moe] {
@@ -337,6 +341,9 @@ body>nav.navbar {
 .mcp-theme-1 .width-70px {
     width: 70px !important;
 }
+.mcp-theme-1 .min-width-50 {
+    min-width: 50% !important;
+}
 .mcp-theme-1 .min-width-70px {
     min-width: 70px !important;
 }
@@ -2316,9 +2323,6 @@ body.in-iframe .main-row > .sidebar {
     background: #fff;
 }
 tr.relevant-to-visit td:nth-child(1) {
-    background: aliceblue;
-}
-tr.relevant-to-visit td:nth-child(2) {
     color: #17a2b8;
 }
 .autosave-indicator {

+ 4 - 4
public/css/z.css

@@ -52,16 +52,16 @@
 .z .header {}
 .z .thumbnail {
     --shadow-color: #aaa;
-    --size: 25px;
+    --size: 14px;
     align-items: center;
     background: #ccc;
-    box-shadow: 0 0 6px var(--shadow-color);
+    box-shadow: 0 0 0px var(--shadow-color);
     border-radius: 50%;
     display: flex;
     flex-shrink: 0;
     justify-content: center;
-    font-size: 12px;
-    padding: 15px;
+    font-size: 10px;
+    padding: 12px;
     height: var(--size);
     width: var(--size);
 } .z .thumbnail.online {

+ 1 - 1
resources/views/app/mcp/bills.blade.php

@@ -28,7 +28,7 @@
                 <tbody>
                     @foreach($bills as $bill)
                     <tr>
-                        <td>{{ friendly_date_time($bill->effective_date) }}</td>
+                        <td>{{ friendly_date_time($bill->effective_date, false) }}</td>
                         <td>
                             <a target="_blank" native href="{{route('patients.view.dashboard', $bill->client)}}">
                                 {{$bill->client->displayName()}}

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

@@ -19,14 +19,14 @@
 					{{friendlier_date_time($memo->created_at)}}
 				</a>
 			</td>
-			<td class="px-1">
+			<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 font-underline">Ack.</button>
+						<button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
 					</form>
 				</div>
 			</td>

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

@@ -18,13 +18,13 @@
                         {{friendlier_date_time($msg->created_at)}}
                     </a>
                 </td>
-                <td class="px-1">
+                <td class="px-1 w-75 text-left">
                     {{$msg->body}}
                 </td>
-                <td>
+                <td class="width-70px px-2 text-right">
                     @if($msg->is_reply_needed == 'YES')
                         <div moe relative>
-                            <a start show class="">clear</a>
+                            <a start show class="">Ack.</a>
                             <form url="/api/clientSms/updateIsReplyNeeded" class="mcp-theme-1" right>
                                 <input type="hidden" name="uid" value="{{ $msg->uid }}">
                                 <input type="hidden" name="isReplyNeeded" value="NO">

+ 73 - 31
resources/views/app/mcp/patients-table.blade.php

@@ -1,37 +1,56 @@
-<table class="table table-condensed p-0 m-0">
+<style>
+    td, th {
+        text-align: center !important;
+    }
+</style>
+
+<table class="table table-condensed p-0 m-0 table-sm table-bordered">
 	<thead class="bg-light">
 		<tr>
-			<th class="px-3 border-0">#</th>
-			<th class="px-3 border-0">Name</th>
-			<th class="px-3 border-0">DOB</th>
-			<th class="px-3 border-0">Age</th>
-			<th class="px-3 border-0">Sex</th>
-			<th class="px-3 border-0">BMI</th>
-			<th class="px-3 border-0">Insurance</th>
-			<th class="px-3 border-0">Last Visit</th>
-			<th class="px-3 border-0">Next Appt.</th>
-			<th class="px-3 border-0">Status</th>
-			<th class="px-3 border-0">CCM</th>
-			<th class="px-3 border-0">RPM</th>
-			<th class="px-3 border-0 d-none">Last Weight-In</th>
-			<th class="px-3 border-0 d-none">Last BP</th>
-			<th class="px-3 border-0">Assigned On</th>
+			<th class="px-3 border-0x">#</th>
+			<th class="px-3 border-0x">Name</th>
+			<th class="px-3 border-0x">DOB</th>
+			<th class="px-3 border-0x">Age</th>
+			<th class="px-3 border-0x">Sex</th>
+			<th class="px-3 border-0x">BMI</th>
+			<th class="px-3 border-0x">Insurance</th>
+			<th class="px-3 border-0x">Last Visit</th>
+			<th class="px-3 border-0x">Next Appt.</th>
+			<th class="px-3 border-0x">Status</th>
+
+            <th class="px-3 border-0x">BP</th>
+            <th class="px-3 border-0x"> <i class="fa fa-heartbeat"></i> </th>
+            <th class="px-3 border-0x">Pulse</th>
+            <th class="px-3 border-0x">BP/Pulse Timestamp</th>
+            <th class="px-3 border-0x">Weight</th>
+            <th class="px-3 border-0x">Weight Timestamp</th>
+
+{{--            <th>Scale <i class="fa fa-battery"></i></th>--}}
+            {{--			<th class="px-3 border-0x">RPM</th>--}}
+            {{--			<th class="px-3 border-0x">CCM</th>--}}
+{{--            <th class="px-3 border-0x d-none">Last Weight-In</th>--}}
+{{--            <th class="px-3 border-0x d-none">Last BP</th>--}}
+            <th class="px-3 border-0x">Assigned On</th>
+
+        @if($pro->pro_type == 'ADMIN')
+                <th class="px-3 border-0x">MCP</th>
+            @endif
 		</tr>
 	</thead>
 	<tbody>
 		@foreach($patients as $patient)
 		<tr>
-			<td class="px-3">
+			<td class="px-3 text-nowrap">
 				<a native target="_blank" href="{{route('patients.view.dashboard', $patient)}}">
 					{{$patient->chart_number}}
 				</a>
 			</td>
-			<td>{{$patient->displayName()}}</td>
+			<td class="text-nowrap">{{$patient->displayName()}}</td>
 			<td class="text-nowrap">{{ friendly_date_time($patient->dob, false) }}</td>
-			<td>{{ $patient->age_in_years ?  $patient->age_in_years : '-' }}</td>
-			<td>{{ $patient->sex }}</td>
-			<td>
-				<div class="d-flex flex-column">
+			<td class="text-nowrap">{{ $patient->age_in_years ?  $patient->age_in_years : '-' }}</td>
+			<td class="text-nowrap">{{ $patient->sex }}</td>
+			<td class="text-nowrap">
+				<div class="d-none d-dflex flex-column">
 					@if($patient->usual_bmi_min && $patient->usual_bmi_max)
 						<small class="text-muted">BMI (Usual): <b>{{ $patient->usual_bmi_min }}</b> {{ $patient->usual_bmi_min_category }} to <b>{{ $patient->usual_bmi_max }}</b> {{ $patient->usual_bmi_max_category }}</small>
 					@endif
@@ -40,7 +59,7 @@
 					@endif
 				</div>
 			</td>
-			<td>
+			<td class="text-nowrap">
 				<?php $coverageStatus = $patient->getPrimaryCoverageStatus(); ?>
 				<div class="text-nowrap">
 					@if($coverageStatus === 'YES')
@@ -56,20 +75,43 @@
 					@endif
 				</div>
 			</td>
-			<td>{{$patient->lastMcpAppointment ? friendly_date_time($patient->lastMcpAppointment->raw_date.' '.$patient->lastMcpAppointment->raw_start_time) : '-'}}</td>
-			<td>{{$patient->nextMcpAppointment ? friendly_date_time($patient->nextMcpAppointment->raw_date.' '.$patient->nextMcpAppointment->raw_start_time) : '-'}}</td>
-			<td>{{$patient->nextMcpAppointment ? $patient->nextMcpAppointment->status : '-'}}</td>
-			<td>{{$patient->is_enrolled_in_cm ? 'Yes' : 'No'}}</td>
-			<td>{{$patient->is_enrolled_in_rm ? 'Yes' : 'No'}}</td>
-			<td class="d-none">
+			<td class="text-nowrap">
+                {{ friendly_date($patient->most_recent_completed_mcp_note_date) }}
+{{--                {{$patient->lastMcpAppointment ? friendly_date_time($patient->lastMcpAppointment->raw_date.' '.$patient->lastMcpAppointment->raw_start_time) : '-'}}--}}
+            </td>
+			<td class="text-nowrap">{{$patient->nextMcpAppointment ? friendly_date_time($patient->nextMcpAppointment->raw_date.' '.$patient->nextMcpAppointment->raw_start_time) : '-'}}</td>
+			<td class="text-nowrap">{{$patient->nextMcpAppointment ? $patient->nextMcpAppointment->status : '-'}}</td>
+
+            <td class="text-nowrap">
+                @if($patient->most_recent_cellular_bp_measurement_at)
+                    {{ $patient->most_recent_cellular_bp_sbp_mm_hg }} / {{ $patient->most_recent_cellular_bp_dbp_mm_hg }}
+                @endif
+            </td>
+
+            <td class="text-nowrap"><?= $patient->most_recent_cellular_bp_value_irregular ? '<i class="fa fa-heartbeat"></i>' : '' ?></td>
+
+            <td class="text-nowrap">{{ $patient->most_recent_cellular_bp_value_pulse }}</td>
+
+            <td class="text-nowrap">{{ friendlier_date_time($patient->most_recent_cellular_bp_measurement_at, false) }}</td>
+
+            <td class="text-nowrap">{{ $patient->most_recent_cellular_weight_value ? round($patient->most_recent_cellular_weight_value, 2) : '--' }}</td>
+
+            <td class="text-nowrap">{{ friendlier_date_time($patient->most_recent_cellular_weight_measurement_at, false) }}</td>
+
+{{--			<td class=text-nowrap">{{$patient->is_enrolled_in_cm ? 'Yes' : 'No'}}</td>--}}
+{{--			<td class=text-nowrap">{{$patient->is_enrolled_in_rm ? 'Yes' : 'No'}}</td>--}}
+			<td class="d-none text-nowrap">
 				<?php $m = $patient->lastMeasurementOfType('Wt. (lbs.)'); ?>
 				{{$m && $m->value ? round($m->value, 2) : '-'}}
 			</td>
-			<td class="d-none">
+			<td class="d-none text-nowrap">
 				<?php $m = $patient->lastMeasurementOfType('BP'); ?>
 				{{$m && $m->value ? $m->value : '-'}}
 			</td>
-			<td>{{$patient->getMcpAssignedOn()}}</td>
+			<td class="text-nowrap"">{{$patient->getMcpAssignedOn()}}</td>
+            @if($pro->pro_type == 'ADMIN')
+                <td class="text-nowrap"">{{$patient->mcp->display_name ?? '--'}}</td>
+            @endif
 		</tr>
 		@endforeach
 

+ 2 - 2
resources/views/app/patient/canvas-sections/allergies/summary.php

@@ -29,7 +29,7 @@ if(count($contentData['items'])) {
 ?>
         <div class="mb-2">
             <div class="">
-                <b><?= $item["title"] ?></b>
+                <b class="click-to-copy"><?= $item["title"] ?></b>
             </div>
 
             <?php
@@ -37,7 +37,7 @@ if(count($contentData['items'])) {
             $detailPlain = trim(strip_tags($detailPlain));
             if(!empty($detailPlain)):
             ?>
-                <div class="text-secondary"><?= $detailPlain ?></div>
+                <div class="text-secondary click-to-copy"><?= $detailPlain ?></div>
             <?php endif; ?>
         </div>
 <?php

+ 3 - 3
resources/views/app/patient/canvas-sections/dx/summary.php

@@ -31,7 +31,7 @@ if(count($contentData['items'])) {
 ?>
         <div class="mb-2 <?= @$item["included"] ? '' : 'hide-if-note' ?>">
             <div class="">
-                <b><?= isset($item["title"]) ? $item["title"] :''  ?></b>
+                <b class="click-to-copy"><?= isset($item["title"]) ? $item["title"] :''  ?></b>
                 <?= isset($item["icd"]) ? '/&nbsp;' . $item["icd"] : '' ?>
                 <?= isset($item["coa"]) ? '/&nbsp;' . $item["coa"] : '' ?>
             </div>
@@ -41,7 +41,7 @@ if(count($contentData['items'])) {
             if(!empty($detailPlain)):
             ?>
                 <div class="text-secondary font-weight-bold">HPI</div>
-                <div class="ml-2"><?= $detailPlain ?></div>
+                <div class="ml-2 click-to-copy"><?= $detailPlain ?></div>
             <?php endif; ?>
             <?php
             $planPlain = isset($item["plan"]) ? $item["plan"] : '';
@@ -49,7 +49,7 @@ if(count($contentData['items'])) {
             if(!empty($planPlain)):
             ?>
                 <div class="text-secondary font-weight-bold">Plan</div>
-                <div class="ml-2"><?= $planPlain ?></div>
+                <div class="ml-2 click-to-copy"><?= $planPlain ?></div>
             <?php endif; ?>
         </div>
 <?php

+ 1 - 1
resources/views/app/patient/canvas-sections/pmhx/summary.php

@@ -119,7 +119,7 @@ else {
     if(isset($contentData['comments'])) { ?>
         <div class="mt-2 mb-1">
             <div class="font-weight-bold">Comments:</div>
-            <div><?= $contentData['comments'] ?></div>
+            <div class="click-to-copy"><?= $contentData['comments'] ?></div>
         </div>
     <?php }
 }

+ 1 - 1
resources/views/app/patient/canvas-sections/pshx/summary.php

@@ -93,7 +93,7 @@ else {
     if(isset($contentData['comments'])) { ?>
         <div class="mt-2 mb-1">
             <div class="font-weight-bold">Comments:</div>
-            <div><?= $contentData['comments'] ?></div>
+            <div class="click-to-copy"><?= $contentData['comments'] ?></div>
         </div>
     <?php }
 }

+ 2 - 2
resources/views/app/patient/canvas-sections/rx/summary.php

@@ -27,7 +27,7 @@ if(count($contentData['items'])) {
         <div class="mb-2 <?= @$item["type"] === 'removed' ? 'on-hover-opaque' : '' ?>">
             <div class="">
                 <?php if(isset($item["title"]) && !empty($item["title"])): ?>
-                    <b class="<?= isset($item["type"]) && $item["type"] === 'removed' ? 'text-secondary' : '' ?>">
+                    <b class="click-to-copy <?= isset($item["type"]) && $item["type"] === 'removed' ? 'text-secondary' : '' ?>">
                         <?= $item["title"] ?>
                     </b>
                 <?php endif; ?>
@@ -50,7 +50,7 @@ if(count($contentData['items'])) {
             $detailPlain = trim(strip_tags($detailPlain));
             if(!empty($detailPlain)):
             ?>
-                <div class="text-secondary"><?= $detailPlain ?></div>
+                <div class="text-secondary click-to-copy"><?= $detailPlain ?></div>
             <?php endif; ?>
             <?php if(isset($item["notes"]) && count($item["notes"])): ?>
                 <div class="pl-3">

+ 1 - 1
resources/views/app/patient/canvas-sections/sochx/summary.php

@@ -93,7 +93,7 @@ else {
     if(isset($contentData['comments'])) { ?>
         <div class="mt-2 mb-1">
             <div class="font-weight-bold">Comments:</div>
-            <div><?= $contentData['comments'] ?></div>
+            <div class="click-to-copy"><?= $contentData['comments'] ?></div>
         </div>
     <?php }
 }

+ 31 - 27
resources/views/app/patient/dashboard.blade.php

@@ -27,6 +27,9 @@
         <?php $vitalLabels = ['Ht. (in.)','Wt. (lbs.)','Temp. (F)','Pulse','Resp.','Pulse Ox.','SBP','DBP','Smoking Status', 'BMI']; ?>
         <?php $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_create($patient->created_at))->invert === 1); ?>
 
+        <?php $nonCoreVisitNotes = $patient->nonCoreVisitNotes; ?>
+        <?php $disallowPointEdits = $nonCoreVisitNotes && count($nonCoreVisitNotes); ?>
+
 	    <div class="row client-single-dashboard">
             <div class="col-6">
 
@@ -65,6 +68,9 @@
                 <!-- meds - point -->
                 @include('app.patient.point-based-partials.rx')
 
+                <!-- supplements - point -->
+                @include('app.patient.point-based-partials.supplements')
+
                 {{-- devices --}}
                 <?php
                 $availableDevices = count($devices);
@@ -554,33 +560,6 @@
                                         <td class="px-2 text-nowrap">{{ $memo->category }}</td>
                                         <td class="px-2">
                                             <pre class="m-0 break-spaces">{{ $memo->content }}</pre>
-                                            @if($performer->pro->pro_type == 'ADMIN')
-                                            <div class="d-flex justify-content-end align-items-center">
-                                                <div moe>
-                                                    <a start show><i class="fas fa-archive"></i> Show Changelog</a>
-                                                    <div action="" url>
-                                                        <table class="table table-condensed table-striped table-sm">
-                                                            <thead>
-                                                            <th>Category</th>
-                                                            <th>Summary</th>
-                                                            <th>Created</th>
-                                                            
-                                                            </thead>
-                                                            <tbody>
-                                                            @foreach($memo->updates as $update)
-                                                                <tr>
-                                                                    <td>{{$update->category}}</td>
-                                                                    <td>{{$update->content}}</td>
-                                                                    <td><strong>{{$update->createdBy->proname_first}} {{$update->createdBy->pro->name_last}}</strong><br/>{{ friendly_date_time($update->created_at) }}</td>
-                                                                
-                                                                </tr>
-                                                            @endforeach
-                                                            </tbody>
-                                                        </table>
-                                                    </div>
-                                                </div>
-                                            </div>
-                                            @endif
                                         </td>
                                         <td class="px-2 text-nowrap">
                                             @if($performer->pro->pro_type == 'ADMIN')
@@ -605,6 +584,31 @@
                                             @endif
                                         </td>
                                         <td class="px-2 text-center delete-column">
+                                            @if($performer->pro->pro_type == 'ADMIN')
+                                                <div moe relative bottom class="mr-2">
+                                                    <a start show><i class="fa fa-history"></i></a>
+                                                    <div action="" url right bottom>
+                                                        <table class="table table-condensed table-striped table-sm">
+                                                            <thead>
+                                                            <th>Category</th>
+                                                            <th>Summary</th>
+                                                            <th>Created</th>
+
+                                                            </thead>
+                                                            <tbody>
+                                                            @foreach($memo->updates as $update)
+                                                                <tr>
+                                                                    <td>{{$update->category}}</td>
+                                                                    <td>{{$update->content}}</td>
+                                                                    <td><strong>{{$update->createdBy->proname_first}} {{$update->createdBy->pro->name_last}}</strong><br/>{{ friendly_date_time($update->created_at) }}</td>
+
+                                                                </tr>
+                                                            @endforeach
+                                                            </tbody>
+                                                        </table>
+                                                    </div>
+                                                </div>
+                                            @endif
                                             <div moe wide relative class="mr-2">
                                                 <a class="on-hover-opaque" start show title="Edit">
                                                     <i class="font-size-11 fa fa-edit"></i>

+ 15 - 3
resources/views/app/patient/note/dashboard.blade.php

@@ -2421,6 +2421,18 @@
                                 <span>Rx</span>
                             </div>
                         </div>
+                        <div class="nbt-container border-right border-info d-inline-flex align-self-stretch">
+                            <div native target="_blank"
+                                 class="c-pointer d-inline-flex align-items-center supplements-center-trigger px-2 py-1"
+                                 open-in-stag-popup
+                                 mc-initer="supplements-center-{{$note->id}}"
+                                 title="Supplements Center"
+                                 popup-style="wide overflow-visible"
+                                 href="/supplements-center/{{$patient->uid}}/{{$note->uid}}">
+                                <i class="fa fa-bolt mr-1"></i>
+                                <span>Supp.</span>
+                            </div>
+                        </div>
                         <div class="nbt-container border-right border-info d-inline-flex align-self-stretch">
                             <div native target="_blank"
                                  class="c-pointer d-inline-flex align-items-center problems-center-trigger px-2 py-1"
@@ -2471,7 +2483,7 @@
                         </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="">Lifestyle <i class="fa fa-caret-up"></i></span>
+                                <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>
@@ -2491,7 +2503,7 @@
                                  title="Incoming Reports"
                                  popup-style="wide overflow-visible"
                                  href="/patients/view/{{$patient->uid}}/incoming-reports?noteUid={{$note->uid}}">
-                                <span>Inc. Reports</span>
+                                <span>Inc. Rpts.</span>
                             </div>
                         </div>
                         <div class="nbt-container border-right border-info d-inline-flex align-self-stretch">
@@ -2501,7 +2513,7 @@
                                  title="Documents"
                                  popup-style="wide overflow-visible"
                                  href="/patients/view/{{$patient->uid}}/documents">
-                                <span>Documents</span>
+                                <span>Docs</span>
                             </div>
                         </div>
                         <div class="nbt-container border-right border-info d-inline-flex align-self-stretch">

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

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

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

@@ -23,8 +23,8 @@
             }
             if (!empty($segment->heading)) {
                 echo '<div class="note-content-node note-content-heading">' .
-                    '<div class="py-2 px-3 border-bottom font-size-14 font-weight-bold text-secondary bg-light ' . ($previousHeading ? 'mt-4 border-top' : '') . '">' . $segment->heading . '</div>' .
-                    '<div class="note-content-children ml-4 border-left">'; // <!-- open new node -->
+                    '<div class="py-2 px-3 border-bottom font-size-16 font-weight-bold bg-light text-secondary ' . ($previousHeading ? 'mt-4 border-top' : '') . '">' . $segment->heading . '</div>' .
+                    '<div class="note-content-children ml-5 border-left">'; // <!-- open new node -->
             }
             $previousHeading = $segment->heading;
         }

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

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

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

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

+ 38 - 2
resources/views/app/patient/notes.blade.php

@@ -222,7 +222,43 @@
                         <a href="/patients/view/{{ $patient->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold">Open</a>
                         @if($note->new_or_fu_or_na !== 'NEW')
                         <span class="px-2 text-secondary">|</span>
-                        <a href="#" class="text-primary trigger-clone" data-uid="{{$note->uid}}">Clone</a>
+                        <div moe>
+                            <a start show>Clone</a>
+                            <form url="/api/visit/clone" class="mcp-theme-1">
+                                <input type="hidden" name="visitToCloneUid" value="{{$note->uid}}">
+                                <div class="form-group">
+                                    <label for="" class="control-label">Effective Date</label>
+                                    <input type="date" name="effectiveDate" class="form-control input-sm">
+                                </div>
+                                <div class="form-group">
+                                    <label for="" class="control-label">New/Fu</label>
+                                    <select name="newOrFuOrNa" id="" class="form-control input-sm">
+                                        <option value="">--select--</option>
+                                        <option value="NEW">New</option>
+                                        <option value="FU">Fu</option>
+                                        <option value="NA">Na</option>
+                                    </select>
+                                </div>
+
+                                <div class="form-group">
+                                    <label for="" class="control-label">Method</label>
+                                    <select name="noteContactMethod" id="" class="form-control input-sm">
+                                        <option value="">--select--</option>
+                                        <option value="VIDEO">Video</option>
+                                        <option value="AUDIO">Audio</option>
+                                        <option value="IN_CLINIC">In Clinic</option>
+                                        <option value="HOUSE_CALL">House Call</option>
+                                    </select>
+                                </div>
+                                <div class="form-group">
+                                    <label for="" class="control-label">Title</label>
+                                    <input type="text" name="title" class="form-control input-sm">
+                                </div>
+                                <div class="form-group m-0">
+                                    <button submit class="btn btn-primary btn-sm">submit</button>
+                                </div>
+                            </form>
+                        </div>
                         @endif
                     </div>
                 </td>
@@ -258,7 +294,7 @@
                 $('.trigger-clone')
                     .off('click.clone')
                     .on('click.clone', function() {
-                        $.post('/api/note/clone', {
+                        $.post('/api/visit/clone', {
                             uid: $(this).attr('data-uid')
                         }, function(_data) {
                             if(_data) {

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

@@ -2,12 +2,13 @@
 $allergies = \App\Models\Point::getPointsOfCategory($patient, "ALLERGY");
 ?>
 <div class="pt-2 mt-2">
-    <div class="d-flex align-items-center pb-2">
+    <div class="d-flex align-items-baseline pb-2">
         <h6 class="my-0 font-weight-bold text-secondary">Allergies</h6>
         @if($isOldClient)
             <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
         @endif
         @if($patient->coreNote)
+            @if(!@$disallowPointEdits)
             <a native target="_blank"
                class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
                open-in-stag-popup
@@ -19,6 +20,9 @@ $allergies = \App\Models\Point::getPointsOfCategory($patient, "ALLERGY");
                 <i class="fa fa-bolt mr-1"></i>
                 <span>Manage</span>
             </a>
+            @else
+                <span class="text-secondary text-sm ml-3">Editable from within notes.</span>
+            @endif
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">

+ 4 - 0
resources/views/app/patient/point-based-partials/care-team.blade.php

@@ -8,6 +8,7 @@ $careTeamMembers = \App\Models\Point::getPointsOfCategory($patient, "CARE_TEAM_M
             <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
         @endif
         @if($patient->coreNote)
+            @if(!@$disallowPointEdits)
             <a native target="_blank"
                class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
                open-in-stag-popup
@@ -19,6 +20,9 @@ $careTeamMembers = \App\Models\Point::getPointsOfCategory($patient, "CARE_TEAM_M
                 <i class="fa fa-bolt mr-1"></i>
                 <span>Manage</span>
             </a>
+            @else
+                <span class="text-secondary text-sm ml-3">Editable from within notes.</span>
+            @endif
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">

+ 4 - 0
resources/views/app/patient/point-based-partials/dx.blade.php

@@ -8,6 +8,7 @@ $problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEM");
             <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
         @endif
         @if($patient->coreNote)
+            @if(!@$disallowPointEdits)
             <a native target="_blank"
                class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
                open-in-stag-popup
@@ -19,6 +20,9 @@ $problems = \App\Models\Point::getPointsOfCategory($patient, "PROBLEM");
                 <i class="fa fa-bolt mr-1"></i>
                 <span>Manage</span>
             </a>
+            @else
+                <span class="text-secondary text-sm ml-3">Editable from within notes.</span>
+            @endif
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">

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

@@ -8,6 +8,7 @@ $medications = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
             <div class="px-2 font-weight-bold alert alert-info text-sm my-0 ml-2 py-1">New</div>
         @endif
         @if($patient->coreNote)
+            @if(!@$disallowPointEdits)
             <a native target="_blank"
                class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
                open-in-stag-popup
@@ -19,6 +20,9 @@ $medications = \App\Models\Point::getPointsOfCategory($patient, "MEDICATION");
                 <i class="fa fa-bolt mr-1"></i>
                 <span>Manage</span>
             </a>
+            @else
+                <span class="text-secondary text-sm ml-3">Editable from within notes.</span>
+            @endif
         @endif
     </div>
     <div class="bg-light border p-2 mb-3 point-content">

+ 35 - 0
resources/views/app/patient/point-based-partials/supplements.blade.php

@@ -0,0 +1,35 @@
+<?php
+$supplements = \App\Models\Point::getPointsOfCategory($patient, "SUPPLEMENT");
+?>
+<div class="pt-2 mt-2">
+    <div class="d-flex align-items-center pb-2">
+        <h6 class="my-0 font-weight-bold text-secondary">Current Supplements</h6>
+        @if($patient->coreNote)
+            @if(!@$disallowPointEdits)
+            <a native target="_blank"
+               class="c-pointer d-inline-flex align-items-center ml-3 text-decoration-none"
+               open-in-stag-popup
+               update-parent
+               mc-initer="supplements-center-{{$patient->coreNote->id}}"
+               title="Supplements Center"
+               popup-style="wide overflow-visible"
+               href="/supplements-center/{{$patient->uid}}/{{$patient->coreNote->uid}}">
+                <i class="fa fa-bolt mr-1"></i>
+                <span>Manage</span>
+            </a>
+            @else
+                <span class="text-secondary text-sm ml-3">Editable from within notes.</span>
+            @endif
+        @endif
+    </div>
+    <div class="bg-light border p-2 mb-3 point-content">
+        @foreach($supplements as $supplement)
+            <div class="mb-1">
+                <b><?= !!@($supplement->data->name) ? @($supplement->data->name) : '-' ?></b>
+            </div>
+        @endforeach
+        @if(!count($supplements))
+            <div class="text-secondary">Nothing here yet</div>
+        @endif
+    </div>
+</div>

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

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

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

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

+ 35 - 0
resources/views/app/patient/settings.blade.php

@@ -7,6 +7,41 @@
         <div class="row">
             <div class="col-6">
 
+                <div>
+                    <label class="mb-0">Status:</label>
+                    <b>{{$patient->client_engagement_status_category ? ucwords(strtolower(str_replace('_', ' ', $patient->client_engagement_status_category == 'DUMMY' ? 'Test Chart' : $patient->client_engagement_status_category))) : '-'}}</b>
+                    <div moe class="ml-2 hide-inside-popup">
+                        <a start show><i class="fa fa-edit"></i></a>
+                        <form url="/api/client/updateClientEngagementAssessmentStatus" class="mcp-theme-1" target="#patient-header-content">
+                            <input type="hidden" name="uid" value="{{$patient->uid}}">
+                            <div class="mb-2">
+                                <label class="mb-1 text-secondary text-sm">Status</label>
+                                <select name="category" class="form-control form-control-sm">
+                                    <option value=""> --select--</option>
+                                    <option {{ $patient->client_engagement_status_category === 'ACTIVE' ? 'selected' : '' }} value="ACTIVE">Active</option>
+                                    <option {{ $patient->client_engagement_status_category === 'INACTIVE' ? 'selected' : '' }} value="INACTIVE">Inactive</option>
+                                    <option {{ $patient->client_engagement_status_category === 'ENTRY_ERROR' ? 'selected' : '' }} value="ENTRY_ERROR">Entry Error</option>
+                                    <option {{ $patient->client_engagement_status_category === 'DUMMY' ? 'selected' : '' }} value="DUMMY">Test Chart</option>
+                                    <option {{ $patient->client_engagement_status_category === 'DECEASED' ? 'selected' : '' }} value="DECEASED">Deceased</option>
+                                    <option {{ $patient->client_engagement_status_category === 'DUPLICATE' ? 'selected' : '' }} value="DUPLICATE">Duplicate</option>
+                                    <option {{ $patient->client_engagement_status_category === 'NO_LONGER_INTERESTED' ? 'selected' : '' }} value="NO_LONGER_INTERESTED">No Longer Interested</option>
+                                    <option {{ $patient->client_engagement_status_category === 'BAD_RECORD' ? 'selected' : '' }} value="BAD_RECORD">Bad Record</option>
+                                </select>
+                            </div>
+                            <div class="mb-2">
+                                <label class="mb-1 text-secondary text-sm">Memo</label>
+                                <textarea class="form-control form-control-sm" name="memo"></textarea>
+                            </div>
+                            <div>
+                                <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                                <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+
+                <hr class="m-negator-3 my-3">
+
                 <div class="d-flex align-items-center mb-2">
                     <div class="font-weight-bold">Home Address</div>
                     <span class="text-secondary mx-2">|</span>

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

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

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

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

+ 1 - 1
resources/views/app/patient/wizard-partials/common-fields.blade.php

@@ -120,7 +120,7 @@
 <div {{@$point ? 'if-not-entry-error class="d-none"' : ''}}>
     <div if-active-or-not-active class="d-none">
 
-    @if($patient->core_note_id !== $note->id)
+    @if(1 || $patient->core_note_id !== $note->id) {{-- allow review/plan from core note --}}
         <div class="row mb-2">
             @if(!@$noReview)
                 <div class="col-6 pr-0">

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

@@ -181,7 +181,7 @@ parentSegment.find('#frm-add-{{$label}}')
             parsed = JSON.parse(dataField.val());
         }
 
-        @if($patient->core_note_id !== $note->id)
+        @if(1 || $patient->core_note_id !== $note->id)
         // store plan content
         let planContent = parsed && parsed.planValue ? parsed.planValue : '';
         let reviewContent = parsed && parsed.reviewValue ? parsed.reviewValue : '';
@@ -222,7 +222,7 @@ parentSegment.find('#frm-add-{{$label}}')
 
         let payload = {};
         form.serializeArray().map(x => {payload[x.name] = x.value;});
-        @if($patient->core_note_id !== $note->id)
+        @if(1 || $patient->core_note_id !== $note->id)
         if(!!reviewContent && $.trim($('<div/>').html(reviewContent).text())) {
             payload.childReviewData = JSON.stringify({
                 value: reviewContent
@@ -270,7 +270,7 @@ parentSegment.find('.frm-edit-{{$label}}')
             parsed = JSON.parse(dataField.val());
         }
 
-        @if($patient->core_note_id !== $note->id)
+        @if(1 || $patient->core_note_id !== $note->id)
         let reviewContent = parsed && parsed.reviewValue ? parsed.reviewValue : '';
 
         let compareWith = false;
@@ -332,7 +332,7 @@ parentSegment.find('.frm-edit-{{$label}}')
 
         let payload = {};
         form.serializeArray().map(x => {payload[x.name] = x.value;});
-        @if($patient->core_note_id !== $note->id)
+        @if(1 || $patient->core_note_id !== $note->id)
         if(!!reviewContent && $.trim($('<div/>').html(reviewContent).text())) {
             payload.childReviewData = JSON.stringify({
                 value: reviewContent

+ 4 - 1
resources/views/app/patients.blade.php

@@ -46,7 +46,7 @@
         </div>
 
         <div class="card-body p-0">
-            <table class="table table-condensed p-0 m-0">
+            <table class="table table-sm table-bordered p-0 m-0">
                 <thead class="bg-light">
                 <tr>
                     @if($pro->pro_type === 'ADMIN')
@@ -71,6 +71,9 @@
                     <th class="border-0">Appointments</th>
                     <th class="border-0">Account</th>
                     <th class="border-0">Tags</th>
+
+
+
                 </tr>
                 </thead>
                 <tbody>

+ 81 - 0
resources/views/app/practice-management/rpm-matrix.blade.php

@@ -0,0 +1,81 @@
+@extends ('layouts/template')
+
+@section('content')
+    <style>
+        td, th {
+            text-align: center !important;
+        }
+    </style>
+    <div class="p-3 mcp-theme-1">
+        <div class="card">
+            <div class="card-header p-3 d-flex align-items-center">
+                <strong class="mr-4">
+                    <i class="fas fa-chart-bar"></i>
+                    RPM Matrix
+                </strong>
+            </div>
+
+            <div class="card-body p-0">
+                <table class="table table-bordered table-sm table-condensed p-0 m-0" style="">
+                    <thead class="bg-light">
+                        <tr>
+                            <th>Chart #</th>
+                            <th>Name</th>
+                            <th>DOB</th>
+                            @if($pro->pro_type == 'ADMIN')
+                            <th>MCP</th>
+                            @endif
+                            <th>BP</th>
+                            <th> <i class="fa fa-heartbeat"></i> </th>
+                            <th>Pulse</th>
+                            <th>BP/Pulse Timestamp</th>
+                            <th>BP <i class="fa fa-car-battery"></i></th>
+                            <th>BP <i class="fa fa-broadcast-tower"></i></th>
+                            <th>Weight</th>
+                            <th>Weight Timestamp</th>
+                            <th>Scale <i class="fa fa-battery"></i></th>
+                            <th>Scale <i class="fa fa-broadcast-tower"></i></th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        @foreach($clients as $client)
+                            <tr>
+                                <td>
+                                    <a native target="_blank" href="{{route('patients.view.dashboard', $client)}}">
+                                        {{$client->chart_number}}
+                                    </a>
+                                </td>
+                                <td>
+                                    <a native target="_blank" href="{{route('patients.view.dashboard', $client)}}">
+                                        {{$client->name_last}}, {{$client->name_first}}
+                                    </a>
+                                </td>
+                                <td>{{ $client->dob }}</td>
+                                @if($pro->pro_type == 'ADMIN')
+                                <td>{{ $client->mcp->name_display ?? '--' }}</td>
+                                @endif
+                                <td>
+                                    @if($client->most_recent_cellular_bp_measurement_at)
+                                        {{ $client->most_recent_cellular_bp_sbp_mm_hg }} / {{ $client->most_recent_cellular_bp_dbp_mm_hg }}
+                                    @endif
+                                </td>
+                                <td><?= $client->most_recent_cellular_bp_value_irregular ? '<i class="fa fa-heartbeat"></i>' : '' ?></td>
+                                <td>{{ $client->most_recent_cellular_bp_value_pulse }}</td>
+                                <td>{{ friendlier_date_time($client->most_recent_cellular_bp_measurement_at) }}</td>
+                                <td>{{ $client->most_recent_cellular_bp_battery_voltage }}</td>
+                                <td>{{ $client->most_recent_cellular_bp_signal_strength }}</td>
+                                <td>{{ $client->most_recent_cellular_weight_value ? round($client->most_recent_cellular_weight_value, 2) : '--' }}</td>
+                                <td>{{ friendlier_date_time($client->most_recent_cellular_weight_measurement_at) }}</td>
+                                <td>{{ $client->most_recent_cellular_weight_battery_voltage }}</td>
+                                <td>{{ $client->most_recent_cellular_weight_signal_strength }}</td>
+                            </tr>
+                        @endforeach
+                    </tbody>
+                </table>
+            </div>
+        </div>
+        <div class="mt-2">
+            {{$clients->links()}}
+        </div>
+    </div>
+@endsection

+ 2 - 30
resources/views/layouts/patient.blade.php

@@ -353,7 +353,7 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 										</a>
 									</div>
 								@endif
-								<div class="hbox justify-content-between">
+								<div class="hbox ml-2 mr-auto">
 
 									{{--<div>
 										<div @if($patient->is_microphone_available)style="color:green" @else style="color:gray"  @endif>
@@ -387,34 +387,6 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 											<div>
 												<label>Status:</label>
 												<b>{{$patient->client_engagement_status_category ? ucwords(strtolower(str_replace('_', ' ', $patient->client_engagement_status_category == 'DUMMY' ? 'Test Chart' : $patient->client_engagement_status_category))) : '-'}}</b>
-												<div moe class="ml-2 hide-inside-popup">
-													<a start show><i class="fa fa-edit"></i></a>
-													<form url="/api/client/updateClientEngagementAssessmentStatus" class="mcp-theme-1" target="#patient-header-content">
-														<input type="hidden" name="uid" value="{{$patient->uid}}">
-														<div class="mb-2">
-															<label class="mb-1 text-secondary text-sm">Status</label>
-															<select name="category" class="form-control form-control-sm">
-																<option value=""> --select--</option>
-																<option {{ $patient->client_engagement_status_category === 'ACTIVE' ? 'selected' : '' }} value="ACTIVE">Active</option>
-																<option {{ $patient->client_engagement_status_category === 'INACTIVE' ? 'selected' : '' }} value="INACTIVE">Inactive</option>
-																<option {{ $patient->client_engagement_status_category === 'ENTRY_ERROR' ? 'selected' : '' }} value="ENTRY_ERROR">Entry Error</option>
-																<option {{ $patient->client_engagement_status_category === 'DUMMY' ? 'selected' : '' }} value="DUMMY">Test Chart</option>
-																<option {{ $patient->client_engagement_status_category === 'DECEASED' ? 'selected' : '' }} value="DECEASED">Deceased</option>
-																<option {{ $patient->client_engagement_status_category === 'DUPLICATE' ? 'selected' : '' }} value="DUPLICATE">Duplicate</option>
-																<option {{ $patient->client_engagement_status_category === 'NO_LONGER_INTERESTED' ? 'selected' : '' }} value="NO_LONGER_INTERESTED">No Longer Interested</option>
-																<option {{ $patient->client_engagement_status_category === 'BAD_RECORD' ? 'selected' : '' }} value="BAD_RECORD">Bad Record</option>
-															</select>
-														</div>
-														<div class="mb-2">
-															<label class="mb-1 text-secondary text-sm">Memo</label>
-															<textarea class="form-control form-control-sm" name="memo"></textarea>
-														</div>
-														<div>
-															<button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-															<button cancel class="btn btn-sm btn-default border">Cancel</button>
-														</div>
-													</form>
-												</div>
 											</div>
 										</div>
 										<div class="screen-only">
@@ -768,7 +740,7 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 											@include('app.patient.coverage-status')										
 									</section>
 									@endif
-									<ul class="vbox mt-2 align-self-start patient-header-address">
+									<ul class="vbox mt-2 align-self-start patient-header-address ml-auto">
 										<li class="d-flex align-items-start">
 											<span class="aligned-icon">
 												<i class="fa fa-map-marker-alt" aria-hidden="true"></i>

+ 6 - 0
resources/views/layouts/template.blade.php

@@ -134,8 +134,12 @@
                     </a>
                     <div class="dropdown-menu mcp-theme-1 no-overflow-menu p-0" aria-labelledby="practice-management">
 
+
+
                         @if($pro->pro_type == 'ADMIN')
 
+                            <a class="dropdown-item" href="{{ route('practice-management.rpmMatrix') }}">RPM Matrix</a>
+
                             {{--<a class="dropdown-item" href="{{ route('practice-management.previousBills') }}">Previous Bills</a>--}}
                             <a class="dropdown-item" href="{{ route('practice-management.financialTransactions') }}">Financial Transactions</a>
                             <a class="dropdown-item" href="/practice-management/bills/not-yet-signed">Pending Bills to Sign</a>
@@ -193,6 +197,8 @@
                             <a class="dropdown-item" href="{{ route('practice-management.proCalendar') }}">Calendar</a>
                             <a class="dropdown-item" href="{{ route('practice-management.remoteMonitoringReport') }}">Remote Monitoring Report</a>
 
+                            <a class="dropdown-item" href="{{ route('practice-management.rpmMatrix') }}">RPM Matrix</a>
+
                             <a class="dropdown-item" href="{{ route('mcp.notes') }}">Notes</a>
                             <a class="dropdown-item" href="{{ route('mcp.memos') }}">Memos</a>
                             <a class="dropdown-item" href="{{ route('mcp.appointments') }}">Appointments</a>

+ 6 - 1
routes/web.php

@@ -140,6 +140,9 @@ Route::middleware('pro.auth')->group(function () {
     });
 
     Route::name('practice-management.')->prefix('practice-management')->group(function () {
+
+        Route::get('rpm-matrix', 'PracticeManagementController@rpmMatrix')->name('rpmMatrix');
+
         Route::get('remote-monitoring-report', 'PracticeManagementController@remoteMonitoringReport')->name('remoteMonitoringReport');
         Route::get('rates/{selectedProUid?}', 'PracticeManagementController@rates')->name('rates');
         Route::get('dashboard', 'PracticeManagementController@dashboard')->name('dashboard');
@@ -181,7 +184,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('patients-accounts-invites', 'PracticeManagementController@patientsAccountsInvites')->name('patientsAccountsInvites');
         Route::get('clients-bdt-devices', 'PracticeManagementController@clientsBdtDevices')->name('clientsBdtDevices');
         Route::get('memos', 'PracticeManagementController@memos')->name('memos');
-        
+
         Route::middleware('pro.auth.admin')->group(function () {
 
             // BILLING REPORT
@@ -401,6 +404,8 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('/goals-center/{patient}/{note}', 'NoteController@goalsCenter')->name('goals-center');
     Route::get('/allergies-center/{patient}/{note}', 'NoteController@allergiesCenter')->name('allergies-center');
     Route::get('/careteam-center/{patient}/{note}', 'NoteController@careteamCenter')->name('careteam-center');
+    Route::get('/supplements-center/{patient}/{note}', 'NoteController@supplementsCenter')->name('supplements-center');
+    Route::get('/supplements-reconcile/{patient}/{note}', 'NoteController@supplementsReconcile')->name('supplements-reconcile');
     Route::get('/memos-thread/{patient}', 'PatientController@memosThread')->name('memos-thread');
     Route::get('/messages-thread/{patient}', 'PatientController@messagesThread')->name('messages-thread');
 

+ 121 - 0
spec/core_child_plan_spec.txt

@@ -0,0 +1,121 @@
+
+API SPEC::::::
+
+    addTopLevel
+
+        category
+        data
+        noteUid
+        additionReasonCategory // 'ON_INTAKE', 'DURING_VISIT'
+        additionReasonMemo
+        isRemoved
+        removalReasonCategory // 'ON_INTAKE', 'DURING_VISIT'
+        removalReasonMemo
+        isRemovedDueToEntryError
+        removalEffectiveDate
+
+        childReviewData
+        childPlanData
+
+        coreReviewData
+        corePlanData
+
+    updateTopLevel
+
+        noteUid
+        data
+        additionReasonCategory
+        additionReasonMemo
+        isRemoved
+        removalReasonCategory
+        removalReasonMemo
+        isRemovedDueToEntryError
+        removalEffectiveDate
+
+        childReviewData
+        childPlanData
+
+        coreReviewData
+        corePlanData
+
+--------------------------------------------------
+
+UI SPEC:::::
+
+    Is this medication currently active? Q1
+        Yes
+        No
+
+    @if(Yes)...
+
+        Is this pre-existing, or being prescribed during this visit? QA
+
+            Pre-existing (before this visit)
+            Prescribed during this visit (as part of my plan)
+
+    @if(No)...
+
+        @if(_UPDATE_FORM_)
+            Is this medication being removed due to an entry error? QB
+                Yes... DEATH
+                No.... continue...
+        @endif
+
+        Was this medication removed PRIOR to this visit or DURING this visit? QC
+
+            Removed prior to this visit
+            Removed during this visit (as part of my plan)
+
+--------------------------------
+
+@if((Q1 == 'Yes') || (Q1 == 'No' && QB == 'No'))
+
+    Start Date | Prescribed By 
+        // always, default to today/note.hcp if QA = 'Prescribed during this visit'
+    
+    End Date | Removal By/Memo
+        // if(Q1 == 'No'), default to today/note.hcp if QC = 'Removed during this visit'
+
+SINGLE-LINE RICH TEXT EDITORS:
+
+    Pre-existing directions (before today's visit) // ---> corePlanData
+        // if(Q1 == 'Yes' && QA == 'Pre-existing') || (Q1 == 'No')
+
+    Review // ---> childReviewData
+
+    Changes to directions during this visit (as part of my plan) // ---> childPlanData
+
+---------------------------------
+
+JOHNNY BRAVO (MODEL PATIENT E2E)
+
+    INTAKE:
+
+        Problem -> A, B, C, D
+        Medication
+
+    Visit 1:
+
+        Problem -> A, B
+        Medication
+
+    Visit 2:
+
+        Problem -> C (mark entry error), D
+        Medication
+
+    Visit 3:
+
+        Problem
+        Medication
+
+    Visit 4: // LATER
+
+        Supply Order
+        eRx, etc.
+
+---------------------------------
+
+    Step by step documentation:
+
+---------------------------------