فهرست منبع

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

= 3 سال پیش
والد
کامیت
f61d250846
30فایلهای تغییر یافته به همراه572 افزوده شده و 309 حذف شده
  1. 6 0
      app/Http/Controllers/AdminController.php
  2. 13 1
      app/Http/Controllers/HomeController.php
  3. 1 1
      app/Http/Controllers/PracticeManagementController.php
  4. 6 0
      app/Http/Controllers/StatTreeLineController.php
  5. 3 0
      app/Models/ClientProChange.php
  6. 1 1
      config/app.php
  7. 7 1
      public/css/style.css
  8. 9 1
      resources/views/app/admin/patients_filters.blade.php
  9. 13 0
      resources/views/app/dashboard-mcp.blade.php
  10. 45 0
      resources/views/app/mcp/dashboard/flagged-measurements-to-be-stamped.blade.php
  11. 1 5
      resources/views/app/mcp/dashboard/measurements-pending-stamping.blade.php
  12. 4 152
      resources/views/app/patient/care-month/_matrix-v2.blade.php
  13. 8 6
      resources/views/app/patient/care-month/_vitals_graph_unified.blade.php
  14. 9 4
      resources/views/app/patient/care-month/dashboard.blade.php
  15. 3 3
      resources/views/app/patient/care-months.blade.php
  16. 10 2
      resources/views/app/patient/client-pro-changes.blade.php
  17. 1 9
      resources/views/app/patient/measurements.blade.php
  18. 1 1
      resources/views/app/patient/note/dashboard.blade.php
  19. 3 0
      resources/views/app/patient/note/dashboard_script.blade.php
  20. 78 0
      resources/views/app/patient/note/sign-confirmation.blade.php
  21. 61 0
      resources/views/app/patient/partials/measurement-value.blade.php
  22. 17 0
      resources/views/app/patient/partials/put-mcp-form.blade.php
  23. 137 1
      resources/views/app/patient/segment-templates/omega_objective_system/edit.blade.php
  24. 1 17
      resources/views/app/patient/settings.blade.php
  25. 88 50
      resources/views/app/practice-management/care_month_add_entry_form.blade.php
  26. 0 8
      resources/views/app/practice-management/rpm-matrix-for-admin-table.blade.php
  27. 20 1
      resources/views/app/stat-tree/stat-tree-lines/view-data-inline.blade.php
  28. 24 5
      resources/views/app/stat-tree/stat-tree-lines/view-data.blade.php
  29. 1 20
      resources/views/layouts/patient-header.blade.php
  30. 1 20
      resources/views/layouts/patient-old.blade.php

+ 6 - 0
app/Http/Controllers/AdminController.php

@@ -222,6 +222,12 @@ class AdminController extends Controller
             }
         }
 
+        $fVal = $request->input('imei');
+        if($fVal) {
+            $patients = $patients->whereRaw("((SELECT count(cbd.id) FROM client_bdt_device cbd 
+            WHERE cbd.client_id = client.id AND cbd.device_id IN (SELECT bd.id FROM bdt_device bd WHERE bd.imei LIKE '%$fVal%' AND bd.is_active IS TRUE)) > 0)");
+        }
+
         if($request->input('number_of_measurements')){
             $keyName = $request->input('number_of_measurements');
             $measurementCountQuery = '(SELECT COUNT(*) FROM measurement WHERE measurement.client_id = client.id AND is_active IS TRUE AND is_cellular IS TRUE AND is_cellular_zero IS NOT TRUE)';

+ 13 - 1
app/Http/Controllers/HomeController.php

@@ -564,12 +564,24 @@ WHERE cl.shadow_pro_id IS NULL
             ->whereNotNull('client_bdt_measurement_id')
             ->paginate(15);
 
+        $flaggedMeasurementsPendingStamping = Measurement::whereIn('care_month_id', $careMonthsWithMeasurementsPendingStamping)
+            ->orderBy('created_at', 'DESC')
+            ->whereNotNull('ts')
+            ->whereNotIn('label', ['SBP', 'DBP'])
+            ->where('is_cellular_zero', '<>', true)
+            ->where('is_active', true)
+            ->where('has_been_stamped_by_mcp', false)
+            ->whereRaw("(color = 'RED' OR color = 'YELLOW')")
+            ->whereNotNull('client_bdt_measurement_id')
+            ->paginate(15);
+
         return view('app/dashboard-mcp', compact('keyNumbers', 'reimbursement', 'milliseconds',
             'businessNumbers',
             'incomingReports', 'tickets', 'supplyOrders',
             'numERx', 'numLabs', 'numImaging', 'numSupplyOrders',
             'newMCPAssociations', 'newNAAssociations',
-            'measurementsPendingStamping', 'careMonthsWithMeasurementsPendingStamping',
+            'measurementsPendingStamping', 'flaggedMeasurementsPendingStamping',
+            'careMonthsWithMeasurementsPendingStamping',
             'mcpClientMemos', 'mcpClientMemosCount', 'naClientMemos', 'incomingSmsMessagesPendingReply'));
     }
 

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

@@ -4740,7 +4740,7 @@ ORDER BY c.name_last, c.name_first
             LEFT JOIN payer lmcpc_payer on lmcpc.commercial_payer_id = lmcpc_payer.id
             ";
         $where = "WHERE
-            c.client_engagement_status_category <> 'DUMMY' AND
+            (c.client_engagement_status_category IS NULL OR client_engagement_status_category <> 'DUMMY') AND
             c.name_first NOT ILIKE '%test%' AND 
             c.name_last NOT ILIKE '%test%' AND
             c.created_at::DATE >= '2022-01-01'::DATE

+ 6 - 0
app/Http/Controllers/StatTreeLineController.php

@@ -228,6 +228,12 @@ class StatTreeLineController extends Controller
                 $value = null;
                 foreach ($lineClause->lineClauseArgs as $lineClauseArg) {
                     if($lineClauseArg->clause_arg_id === $clauseArg->id) {
+
+                        // if there is a query-line override, give that priority
+                        if($request->input('st_' . $clauseArg->arg_text)) {
+                            $lineClauseArg->value = $request->input('st_' . $clauseArg->arg_text);
+                        }
+
                         $value = $lineClauseArg->value;
                     }
                 }

+ 3 - 0
app/Models/ClientProChange.php

@@ -23,4 +23,7 @@ class ClientProChange extends Model
     public function newPro(){
         return $this->hasOne(Pro::class, 'id', 'new_pro_id');
     }
+    public function creator(){
+        return $this->hasOne(Pro::class, 'id', 'created_by_pro_id');
+    }
 }

+ 1 - 1
config/app.php

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

+ 7 - 1
public/css/style.css

@@ -3730,4 +3730,10 @@ table.v-top th {
     background: #BBB;
     border-color: #BBB !important;
     padding: 0 !important;
-}
+}
+.mcp-theme-1 .yellow-measurement {
+    color: yellow !important;
+}
+.mcp-theme-1 .red-measurement {
+    color: red !important;
+}

+ 9 - 1
resources/views/app/admin/patients_filters.blade.php

@@ -409,6 +409,13 @@
 		</div>
 	</div>
 
+	<div class="sm-section">
+		<div class="">
+			<label>IMEI:</label>
+			<input name="imei" class="form-control input-sm" v-model="filters.imei">
+		</div>
+	</div>
+
 	@if($performer->pro->pro_type == 'ADMIN')
 	<div class="sm-section">
 		<div class="">
@@ -533,7 +540,8 @@ $allFilterKeys = [
 	'has_bp_device',
 	'has_weight_scale',
 	'has_pulse_ox',
-	'has_temp_fun'
+	'has_temp_fun',
+	'imei'
 ];
 for ($i=0; $i < count($allFilterKeys); $i++) {
 	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {

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

@@ -418,6 +418,19 @@
 
                             </div>
 
+                            @if($flaggedMeasurementsPendingStamping && count($flaggedMeasurementsPendingStamping))
+                                <div class="card mb-4">
+                                    <div class="card-header pl-2">
+                                        <strong>
+                                            Flagged Measurements To be Stamped
+                                        </strong>
+                                    </div>
+                                    <div class="card-body p-0">
+                                        @include('app.mcp.dashboard.flagged-measurements-to-be-stamped')
+                                    </div>
+                                </div>
+                            @endif
+
                             <div class="card mb-4">
                                 <div class="card-header pl-2">
                                     <strong>

+ 45 - 0
resources/views/app/mcp/dashboard/flagged-measurements-to-be-stamped.blade.php

@@ -0,0 +1,45 @@
+<div id="dashboard-measurements-pending-stamping">
+@if($flaggedMeasurementsPendingStamping && count($flaggedMeasurementsPendingStamping))
+    <table class="table table-sm table-striped mb-0">
+        <thead>
+        <tr>
+            <th class="border-bottom-0 border-top-0 text-secondary">Patient</th>
+            <th class="border-bottom-0 border-top-0 text-secondary">Type</th>
+            <th class="border-bottom-0 border-top-0 text-secondary">Value</th>
+            <th class="border-bottom-0 border-top-0 text-secondary">Timestamp</th>
+        </tr>
+        </thead>
+        <tbody>
+        @foreach($flaggedMeasurementsPendingStamping as $row)
+            <tr>
+                <td class="pl-2">
+                    <a href="{{ route('patients.view.dashboard', $row->client) }}">
+                        {{$row->client->displayName()}}
+                    </a>
+                </td>
+                <td class="text-nowrap">
+                    {{$row->label}}
+                </td>
+                <td>
+                    @include('app.patient.partials.measurement-value', ['measurement' => $row])
+                </td>
+                <td class="text-secondary">
+                    <a href="/mc/patients/view/{{$row->client->uid}}/care-months/view/{{$row->careMonth->uid}}"
+                       native target="_blank"
+                       title="Care Month: {{date('M Y', strtotime($row->careMonth->start_date))}}">
+                        {{ friendly_date_time_short_with_tz_from_timestamp_divide1000($row->ts, 'EASTERN') }} EST
+                    </a>
+                </td>
+            </tr>
+        @endforeach
+        </tbody>
+    </table>
+    <div class="m-2">
+        {{ $flaggedMeasurementsPendingStamping->onEachSide(0)->withQueryString()->links() }}
+    </div>
+@else
+    <div class="p-3">
+        No flagged measurement pending stamping
+    </div>
+@endif
+</div>

+ 1 - 5
resources/views/app/mcp/dashboard/measurements-pending-stamping.blade.php

@@ -21,11 +21,7 @@
                     {{$row->label}}
                 </td>
                 <td>
-                    @if($row->label === 'BP')
-                        {{ $row->sbp_mm_hg }}/{{ $row->dbp_mm_hg }}
-                    @elseif($row->label === 'Wt. (lbs.)')
-                        {{ round(floatval($row->numeric_value), 2) }}
-                    @endif
+                    @include('app.patient.partials.measurement-value', ['measurement' => $row])
                 </td>
                 <td class="text-secondary">
                     <a href="/mc/patients/view/{{$row->client->uid}}/care-months/view/{{$row->careMonth->uid}}"

+ 4 - 152
resources/views/app/patient/care-month/_matrix-v2.blade.php

@@ -40,84 +40,8 @@ foreach ($days as $k => $day) {
     @if($careMonth->is_client_enrolled_in_rm)
         <div class="d-flex align-items-center">
             <h6 class="my-0 text-secondary font-weight-bold text-dark lh-24px">Time Entries</h6>
-            @if(!$activeRMBill)
-                <span class="mx-2 text-secondary">|</span>
-                <div moe large>
-                    <a start show class="py-0 mb-3">Add</a>
-                    <form url="/api/careMonthEntry/createForRm">
-                        <input type="hidden" name="careMonthUid" value="{{ $careMonth->uid }}">
-                        <div class="mb-2">
-                            <div class="row">
-                                <div class="col-4 pr-0">
-                                    <select class="form-control form-control-sm w-100" name="proUid" provider-search data-pro-uid="{{ @$pro->uid }}"
-                                            required>
-                                        <option value="">-- Select Pro --</option>
-                                        @foreach($pros as $iPro)
-                                            <option {{ $iPro->uid === $pro->uid ? 'selected' : '' }}
-                                                    value="{{ $iPro->uid }}">{{ $iPro->displayName() }}</option>
-                                        @endforeach
-                                    </select>
-                                </div>
-                                <div class="col-4 pr-0">
-                                    <?php
-                                    $sD = strtotime($careMonth->start_date);
-                                    $y = date('Y', $sD);
-                                    $m = date('m', $sD);
-                                    $d = date('t', $sD);
-                                    $yCurrent = date('Y');
-                                    $mCurrent = date('m');
-                                    $isToday = false;
-                                    if($y === $yCurrent && $m === $mCurrent) {
-                                        $d = date('d');
-                                        $isToday = true;
-                                    }
-                                    ?>
-                                    <input autofocus type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}"
-                                           value="{{date('Y-m-d')}}"
-                                           class="form-control form-control-sm w-100" name="effectiveDate"
-                                           placeholder="Effective Date" required>
-                                </div>
-                                <div class="col-4">
-                                    <select name="timeInSeconds" class="form-control form-control-sm w-100 cm-time-value" required>
-                                        <option value="">-- Minutes --</option>
-                                        <option value="60">1 minute</option>
-                                        <option value="300">5 minutes</option>
-                                        <option value="600">10 minutes</option>
-                                        <option value="1200">20 minutes</option>
-                                    </select>
-                                </div>
-                            </div>
-                        </div>
-                        <div class="mb-2 border border-info p-2 mt-2 bg-light">
-                            <span><i class="fa fa-phone rotateh text-dark mr-1"></i>This time entry involved interactive communication (audio, video, or in-person) with the patient and/or caretaker.</span>
-                            <div class="d-flex border-top mt-2">
-                                <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
-                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" required>
-                                    <span>Yes</span>
-                                </label>
-                                <label class="mt-2 mb-0 d-inline-flex align-items-center">
-                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" required>
-                                    <span>No</span>
-                                </label>
-                            </div>
-                        </div>
-                        <div class="mb-2">
-                            <div class="row">
-                                <div class="col-12">
-                                    <div cm-rte data-content="Reviewed/managed patient measurements" data-name="contentText"></div>
-                                </div>
-                            </div>
-                        </div>
-                        <div class="d-flex align-items-center">
-                            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                        </div>
-                    </form>
-                </div>
-            @else
-                <span class="mx-2 text-secondary">|</span>
-                <span class="text-secondary">Can't modify since a bill exists</span>
-            @endif
+            <span class="mx-2 text-secondary">|</span>
+            @include('app.practice-management.care_month_add_entry_form', ['right' => false])
         </div>
         <table class="table table-striped table-sm table-bordered mt-2 mb-0 table-hover">
             <thead>
@@ -150,81 +74,9 @@ foreach ($days as $k => $day) {
                             <div class="text-secondary in-table-markup">{!! $entry->content_text !!}</div>
                             <!--                                        <div class="text-secondary text-sm">{{$entry->content_detail}}</div>-->
                         </td>
-                        <td class="px-2 text-right">
+                        <td class="px-2">
                             @if(!$activeRMBill)
-                                <div moe large class="mr-2">
-                                    <a start show class="py-0 mb-3">Edit</a>
-                                    <form url="/api/careMonthEntry/updateSimpleForRm" right>
-                                        <input type="hidden" name="uid" value="{{ $entry->uid }}">
-                                        <div class="mb-2">
-                                            <div class="row">
-                                                <div class="col-4 pr-0">
-                                                    <select class="form-control form-control-sm w-100" name="proUid" provider-search data-pro-uid="{{ @$entry->pro->uid }}"
-                                                            required>
-                                                        <option value="">-- Select Pro --</option>
-                                                        @foreach($pros as $iPro)
-                                                            <option {{ $iPro->uid === $pro->uid ? 'selected' : '' }}
-                                                                    value="{{ $iPro->uid }}">{{ $iPro->displayName() }}</option>
-                                                        @endforeach
-                                                    </select>
-                                                </div>
-                                                <div class="col-4 pr-0">
-                                                    <?php
-                                                    $sD = strtotime($careMonth->start_date);
-                                                    $y = date('Y', $sD);
-                                                    $m = date('m', $sD);
-                                                    $d = date('t', $sD);
-                                                    $yCurrent = date('Y');
-                                                    $mCurrent = date('m');
-                                                    $isToday = false;
-                                                    if($y === $yCurrent && $m === $mCurrent) {
-                                                        $d = date('d');
-                                                        $isToday = true;
-                                                    }
-                                                    ?>
-                                                    <input autofocus type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}"
-                                                           value="{{$entry->effective_date}}"
-                                                           class="form-control form-control-sm w-100" name="effectiveDate"
-                                                           placeholder="Effective Date" required>
-                                                </div>
-                                                <div class="col-4">
-                                                    <select name="timeInSeconds" class="form-control form-control-sm w-100 cm-time-value" required>
-                                                        <option value="">-- Minutes --</option>
-                                                        <option value="60" {{$entry->time_in_seconds === 60 ? 'selected' : ''}}>1:00</option>
-                                                        <option value="75" {{$entry->time_in_seconds === 75 ? 'selected' : ''}}>1:15</option>
-                                                        <option value="300" {{$entry->time_in_seconds === 300 ? 'selected' : ''}}>5:00</option>
-                                                        <option value="600" {{$entry->time_in_seconds === 600 ? 'selected' : ''}}>10:00</option>
-                                                        <option value="1200" {{$entry->time_in_seconds === 1200 ? 'selected' : ''}}>20:00</option>
-                                                    </select>
-                                                </div>
-                                            </div>
-                                        </div>
-                                        <div class="mb-2 border border-info p-2 mt-2 bg-light text-left">
-                                            <span><i class="fa fa-phone rotateh text-dark mr-1"></i>This time entry involved interactive communication (audio, video, or in-person) with the patient and/or caretaker.</span>
-                                            <div class="d-flex border-top mt-2">
-                                                <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
-                                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" {{$entry->did_pro_interact_with_client_about_rm ? 'checked' : ''}} required>
-                                                    <span>Yes</span>
-                                                </label>
-                                                <label class="mt-2 mb-0 d-inline-flex align-items-center">
-                                                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" {{$entry->did_pro_interact_with_client_about_rm ? '' : 'checked' }} required>
-                                                    <span>No</span>
-                                                </label>
-                                            </div>
-                                        </div>
-                                        <div class="mb-2">
-                                            <div class="row">
-                                                <div class="col-12">
-                                                    <div cm-rte data-name="contentText">{!! $entry->content_text !!}</div>
-                                                </div>
-                                            </div>
-                                        </div>
-                                        <div class="d-flex align-items-center">
-                                            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                        </div>
-                                    </form>
-                                </div>
+                                @include('app.practice-management.care_month_add_entry_form', ['right' => true, 'entry' => $entry])
                                 <div moe relative>
                                     <a start show class="text-danger">Delete</a>
                                     <form url="/api/careMonthEntry/remove" right class="text-left">

+ 8 - 6
resources/views/app/patient/care-month/_vitals_graph_unified.blade.php

@@ -3,8 +3,8 @@
     <script src="/c3/d3.v5.min.js" charset="utf-8"></script>
     <script src="/c3/c3.min.js"></script>
 
-    <div id="vitalsGraphComponentUnified" class="stag-chart mb-4 pt-3">
-        <div id="unified-chart">Unified Graph</div>
+    <div id="vitalsGraphComponentUnified_{{$careMonth->id}}{{@$suffix ?: ''}}" class="stag-chart mb-4 pt-3">
+        <div id="unified-chart_{{$careMonth->id}}{{@$suffix ?: ''}}"></div>
     </div>
 
     <?php
@@ -91,9 +91,11 @@
                 unifiedChart();
             }
             function unifiedChart() {
-
-                window.vgBPChart = c3.generate({
-                    bindto: '#unified-chart',
+                $('#vitalsGraphComponentUnified_{{$careMonth->id}}{{@$suffix ?: ''}}')
+                    .empty()
+                    .append('<div id="unified-chart_{{$careMonth->id}}{{@$suffix ?: ''}}"></div>');
+                window['vgUnifiedChart_{{$careMonth->id}}{{@$suffix ?: ''}}'] = c3.generate({
+                    bindto: '#unified-chart_{{$careMonth->id}}{{@$suffix ?: ''}}',
                     data: {
                         xs: {
                             'Systolic BP' : 'x1',
@@ -148,6 +150,6 @@
                     ]
                 });
             }
-            addMCInitializer('vitalsGraphUnified', init, '#vitalsGraphComponentUnified');
+            addMCInitializer('vitalsGraphUnified_{{$careMonth->id}}{{@$suffix ?: ''}}', init, '#vitalsGraphComponentUnified_{{$careMonth->id}}{{@$suffix ?: ''}}');
         }).call(window);
     </script>

+ 9 - 4
resources/views/app/patient/care-month/dashboard.blade.php

@@ -209,12 +209,12 @@
                                         <?php
                                         $careMonthLastDay = date_add(date_create($careMonth->start_date), date_interval_create_from_date_string("1 month"));
                                         $careMonthLastDay = date_sub($careMonthLastDay, date_interval_create_from_date_string("1 day"));
-                                        $daysDiff = date_diff($careMonthLastDay, date_create($patient->most_recent_completed_mcp_note_date))->days;
+                                        $daysDiff = date_diff($careMonthLastDay, date_create($careMonth->most_recent_mcp_note_date))->days;
                                         ?>
                                     @endif
                                     <span class="font-weight-bold text-secondary">Last Visit:</span>
                                     <b class="{{$daysDiff === -1 ? 'text-secondary' : ($daysDiff <= 90 ? 'text-success' : 'text-warning-mellow')}}">
-                                        {{friendly_date($patient->most_recent_completed_mcp_note_date)}}
+                                        {{friendly_date($careMonth->most_recent_mcp_note_date)}}
                                         @if($daysDiff !== -1)
                                             @if($daysDiff > 90)
                                                 <i class="fa fa-exclamation-triangle"></i>
@@ -318,8 +318,8 @@
                                         @endif
                                         <span class="ml-1 text-secondary text-sm font-weight-normal">(20 needed)</span>
                                     </b>
-                                  
-                                    @include('app.practice-management.care_month_add_entry_form')
+                                    <span class="mx-2 text-secondary">|</span>
+                                    @include('app.practice-management.care_month_add_entry_form', ['right' => true])
                                 </div>
 
                                 @if($performer->pro->pro_type == 'ADMIN')
@@ -1360,6 +1360,11 @@
                     $('#caremonth-measurements-calendar-{{$calendarID}}').parent().addClass('d-none');
                 }, 10);
 
+                // if in popup, invoke vitals graph initer
+                if($('#care-month-container-{{$patient->uid}}').closest('.stag-popup').length) {
+                    runMCInitializer('vitalsGraphUnified_{{$careMonth->id}}');
+                }
+
             }
 
             addMCInitializer('care-month-dashboard-{{$patient->uid}}', init, '#care-month-container-{{$patient->uid}}');

+ 3 - 3
resources/views/app/patient/care-months.blade.php

@@ -137,9 +137,9 @@
                             -
                         @endif
                     </td>
-                    <td>{{$careMonth->mcp ? $careMonth->mcp->name_display : '-'}}</td>
-                    <td>{{$careMonth->rmmPro ? $careMonth->rmmPro->name_display : '-'}}</td>
-                    <td>{{$careMonth->rmePro ? $careMonth->rmePro->name_display : '-'}}</td>
+                    <td>{{$careMonth->mcp ? $careMonth->mcp->displayName() : '-'}}</td>
+                    <td>{{$careMonth->rmmPro ? $careMonth->rmmPro->displayName() : '-'}}</td>
+                    <td>{{$careMonth->rmePro ? $careMonth->rmePro->displayName() : '-'}}</td>
                     <td>
                         <a native target="_blank"
                            open-in-stag-popup

+ 10 - 2
resources/views/app/patient/client-pro-changes.blade.php

@@ -13,7 +13,11 @@
                     <th class="border-0 text-secondary width-200px">Old Pro</th>
                     <th class="border-0 text-secondary width-200px">New Pro</th>
                     <th class="border-0 text-secondary width-200px">Change Memo</th>
-                    <th></th>
+                    <th class="border-0 text-secondary">
+                        @if($pro->pro_type === 'ADMIN')
+                            Created By
+                        @endif
+                    </th>
                 </tr>
                 </thead>
                 <tbody>
@@ -24,7 +28,11 @@
                         <td>{{$change->previousPro ? $change->previousPro->displayName() : '-'}}</td>
                         <td>{{$change->newPro ? $change->newPro->displayName() : '-'}}</td>
                         <td>{{$change->custom_memo}}</td>
-                        <td></td>
+                        <td>
+                            @if($pro->pro_type === 'ADMIN' && $change->creator)
+                                {{$change->creator->displayName()}}
+                            @endif
+                        </td>
                     </tr>
                 @endforeach
                 </tbody>

+ 1 - 9
resources/views/app/patient/measurements.blade.php

@@ -94,15 +94,7 @@
                             </td>
                             <td>{{ $measurement->label }}</td>
                             <td>
-                                @if($measurement->is_cellular_zero)
-                                    <i class="font-size-11 fa fa-rss"></i>
-                                @elseif($measurement->label === 'BP')
-                                    {{ $measurement->sbp_mm_hg }}/{{ $measurement->dbp_mm_hg }} mmHg  <span class="font-weight-normal d-inline-block pl-2">Pulse:</span> {{ $measurement->value_pulse }} {{ $measurement->value_irregular === 0?'Irregular':'' }} {{ $measurement->value_irregular === 1?'Regular':'' }}
-                                @elseif($measurement->label === 'Wt. (lbs.)')
-                                    {{ round($measurement->numeric_value) }} lbs
-                                @else
-                                    {{ $measurement->value }}
-                                @endif
+                                @include('app.patient.partials.measurement-value', ['measurement' => $measurement])
                             </td>
                             <td>{{$measurement->source}}</td>
                             <td class="px-2 text-nowrap">

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

@@ -653,7 +653,7 @@ use App\Models\Handout;
                                            open-in-stag-popup
                                            update-parent
                                            mc-initer="note-sign-confirmation-{{$note->id}}"
-                                           popup-style="stag-popup-md"
+                                           popup-style="stag-popup-md overflow-visible"
                                            title="Confirm and Sign"
                                            class="screen-only"
                                            href="{{route('patients.view.notes.view.sign-confirmation', compact('patient', 'note'))}}">

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

@@ -337,6 +337,9 @@
                             visitTreeLink.closest('.note-tree-node').addClass('active');
                         }
 
+                        // to force graph redraw
+                        window.dispatchEvent(new Event('resize'));
+
                         return false;
                     });
 

+ 78 - 0
resources/views/app/patient/note/sign-confirmation.blade.php

@@ -92,6 +92,40 @@
         </div>
     </div>
 
+
+    {{-- rpm time entry --}}
+    <?php
+    // resolve care month from the effective date of this note
+    $cmStartDate = date('Y-m-01', strtotime($note->effective_dateest));
+    $careMonth = \App\Models\CareMonth::where('client_id', $note->client->id)->where('start_date', $cmStartDate)->first();
+    ?>
+    @if($careMonth && $careMonth->is_client_enrolled_in_rm)
+        <div class="p-3 mt-3 border bg-aliceblue">
+            <p class="mb-2">Did you review the patient's remote measurements and/or had communication regarding RPM during this visit? If yes, please add a time entry to cover the same (if you have not already done it).</p>
+            <div class="d-flex align-items-center">
+                <h6 class="my-0 text-secondary font-weight-bold text-dark lh-24px"><span class="text-secondary">RPM time billed:</span> {{time_in_hrminsec($careMonth->rm_total_time_in_seconds_by_mcp)}}</h6>
+                <?php
+                $rmBills = $careMonth->getBillsOfType('RM');
+                $activeRMBill = false;
+                foreach ($rmBills as $rmBill) {
+                    if(!$rmBill->is_cancelled && $careMonth->rm_bill_id === $rmBill->id) {
+                        $activeRMBill = $rmBill;
+                        break;
+                    }
+                }
+                ?>
+                <span class="mx-2 text-secondary">|</span>
+                @include('app.practice-management.care_month_add_entry_form', [
+                    'right' => false,
+                    'defaultDate' => $note->effective_dateest,
+                    'defaultSeconds' => 120,
+                    'defaultInteracted' => true,
+                    'defaultComment' => 'I have discussed remote monitoring data to date and encouraged patient to regularly measure and follow the care plan.'
+                    ])
+            </div>
+        </div>
+    @endif
+
     {{-- fu appt --}}
     <div class="px-3 pt-3 mt-3 border bg-aliceblue">
         @include('app/patient/note/follow-up-appointment', ['noMinHeight' => true])
@@ -164,6 +198,50 @@
                 });
 
             runMCInitializer('icd-autocomplete');
+
+            @if($careMonth && $careMonth->is_client_enrolled_in_rm)
+            initMoes();
+            initProSuggest();
+            $('#note-sign-confirmation-{{$note->id}}').find('[cm-rte]').each(function() {
+
+                $(this).wrap(
+                    $('<div class="border-left border-right rte-holder"/>')
+                        .attr('data-shortcuts', '')
+                );
+
+                // give a unique id to this editor instance
+                var editorID = Math.ceil(Math.random() * 99999), fieldName = $(this).attr('data-name');
+
+                var el = this;
+                var existingContent = $(el).attr('data-content') ? $(el).attr('data-content') : $(el).html();
+                var quill = new Quill(el, {
+                    theme: 'snow',
+                    modules: stagQuillConfig
+                });
+
+                var toolbar = $(quill.container).prev('.ql-toolbar');
+
+                // add button for new shortcut
+                var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
+                    'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
+                toolbar.append(newSCButton);
+
+                quill.root.innerHTML = existingContent;
+
+                $('<input type="hidden" name="' + fieldName + '">').val(existingContent).insertAfter(el);
+
+                quill.on('text-change', function(delta, oldDelta, source) {
+                    $(el).next('[name="' + fieldName + '"]').val(quill.root.innerHTML);
+                });
+
+                $(quill.container)
+                    .find('.ql-editor[contenteditable]')
+                    .attr('data-field', fieldName)
+                    .attr('data-editor-id', editorID)
+                    .attr('with-shortcuts', 1);
+
+            });
+            @endif
         }
 
         addMCInitializer('note-sign-confirmation-{{$note->id}}', init, '#note-sign-confirmation-{{$note->id}}')

+ 61 - 0
resources/views/app/patient/partials/measurement-value.blade.php

@@ -0,0 +1,61 @@
+<div class="d-flex flex-nowrap align-items-baseline">
+    @if($measurement->is_cellular_zero)
+        <i class="font-size-11 fa fa-rss"></i>
+    @elseif($measurement->label === 'BP')
+        {{ $measurement->sbp_mm_hg }}/{{ $measurement->dbp_mm_hg }} mmHg  <span class="font-weight-normal d-inline-block pl-2">Pulse:</span> {{ $measurement->value_pulse }} {{ $measurement->value_irregular === 0?'Irregular':'' }} {{ $measurement->value_irregular === 1?'Regular':'' }}
+    @elseif($measurement->label === 'Wt. (lbs.)')
+        {{ round($measurement->numeric_value) }} lbs
+    @else
+        {{ $measurement->value }}
+    @endif
+    @if($measurement->color === 'YELLOW' || $measurement->color === 'RED')
+        @if($measurement->color === 'YELLOW')
+            <i class="fa fa-circle text-warning-mellow ml-2"></i>
+        @else
+            <i class="fa fa-circle text-danger ml-2"></i>
+        @endif
+        @if($measurement->careMonth && (
+            ($measurement->careMonth->mcp && $pro->id === $measurement->careMonth->mcp->id) ||
+            ($measurement->careMonth->rmm && $pro->id === $measurement->careMonth->rmm->id)
+        ))
+            @if(!$measurement->has_been_stamped_by_mcp)
+                <div moe class="ml-2">
+                    <a href="#" start show>Stamp</a>
+                    <form url="/api/measurement/stamp" right class="width-300px">
+                        <input type="hidden" name="uid" value="{{$measurement->uid}}">
+                        <p class="mb-1">Stamp this measurement?</p>
+                        <div class="mt-2 bg-light border p-2">
+                            <div class="mb-1 text-secondary">{{ $measurement->label }}</div>
+                            <div class="font-weight-bold mb-1">
+                                @if($measurement->label === 'BP')
+                                    {{ round($measurement->sbp_mm_hg, 2) }}/{{ round($measurement->dbp_mm_hg, 2) }} mmHg
+                                    <span class="font-weight-normal d-inline-block pl-2">Pulse:</span>
+                                    {{ $measurement->value_pulse }} {{ $measurement->value_irregular === 0?'Irregular':'' }} {{ $measurement->value_irregular === 1?'Regular':'' }}
+                                @elseif($measurement->label === 'Wt. (lbs.)')
+                                    {{ round($measurement->numeric_value, 2) }} lbs
+                                @else
+                                    {{ $measurement->value }}
+                                @endif
+                            </div>
+                            <div class="text-sm">
+                                <?php $timestampInSec = floor($measurement->ts / 1000); ?>
+                                {{ friendly_date_time_short_with_tz_from_timestamp($timestampInSec, 'EASTERN') }} EST
+                            </div>
+                        </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 class="form-group m-0">
+                            <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
+                            <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
+                        </div>
+                    </form>
+                </div>
+            @else
+                <i class="fa fa-check text-secondary ml-2 text-sm"></i>
+                <span class="text-secondary text-sm ml-1">Stamped</span>
+            @endif
+        @endif
+    @endif
+</div>

+ 17 - 0
resources/views/app/patient/partials/put-mcp-form.blade.php

@@ -0,0 +1,17 @@
+<form url="/api/client/putMcp" class="mcp-theme-1">
+    <input type="hidden" name="uid" value="{{$patient->uid}}">
+    <div class="mb-2">
+        <label class="text-secondary text-sm">MCP Pro</label>
+        <select name="mcpProUid" provider-search data-pro-uid="{{ @$patient->mcp->uid }}" class="form-control form-control-sm">
+            <option value=""> --select--</option>
+        </select>
+    </div>
+    <label class="mb-2 d-flex align-items-center">
+        <input type="checkbox" name="shouldUpdateMcpOnCurrentCareMonth">
+        <span class="ml-1 text-nowrap">Also set as the current care month's MCP?</span>
+    </label>
+    <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>

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

@@ -41,7 +41,7 @@ if (!!@$point->data) {
             $cmStartDate = date('Y-m-01', strtotime($note->effective_dateest));
             $careMonth = \App\Models\CareMonth::where('client_id', $note->client->id)->where('start_date', $cmStartDate)->first();
             ?>
-            @if($careMonth)
+            @if($careMonth && $careMonth->is_client_enrolled_in_rm)
                 <a href="/patients/view/{{ $note->client->uid }}/care-months/view/{{$careMonth->uid}}"
                    class="text-nowrap ml-3"
                    native target="_blank"
@@ -63,6 +63,12 @@ if (!!@$point->data) {
             <span>Remote monitoring data not available.</span>
         </label>
 
+        @if($careMonth && $careMonth->is_client_enrolled_in_rm)
+            <div class="w-75">
+                @include('app.patient.care-month._vitals_graph_unified', ['suffix' => $segment->uid])
+            </div>
+        @endif
+
         <div class="pt-2">
             <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <div class="d-inline-flex align-self-stretch align-items-center">
@@ -76,6 +82,87 @@ if (!!@$point->data) {
     </form>
 </div>
 
+@if($careMonth && $careMonth->is_client_enrolled_in_rm)
+    <div class="p-2">
+        <div class="d-flex align-items-center">
+            <h6 class="my-0 text-secondary font-weight-bold text-dark lh-24px"><span class="text-secondary">RPM time billed:</span> {{time_in_hrminsec($careMonth->rm_total_time_in_seconds_by_mcp)}}</h6>
+            <?php
+            $rmBills = $careMonth->getBillsOfType('RM');
+            $activeRMBill = false;
+            foreach ($rmBills as $rmBill) {
+                if(!$rmBill->is_cancelled && $careMonth->rm_bill_id === $rmBill->id) {
+                    $activeRMBill = $rmBill;
+                    break;
+                }
+            }
+            ?>
+            <span class="mx-2 text-secondary">|</span>
+            @include('app.practice-management.care_month_add_entry_form', [
+                'right' => false,
+                'hook' => 'updateRMSegment',
+                'defaultDate' => $note->effective_dateest,
+                'defaultSeconds' => 120,
+                'defaultInteracted' => true,
+                'defaultComment' => 'I have discussed remote monitoring data to date and encouraged patient to regularly measure and follow the care plan.'
+                ])
+        </div>
+{{--        <table class="table table-striped table-sm table-bordered mt-2 mb-0 table-hover">--}}
+{{--            <thead>--}}
+{{--            <tr>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0">Effective Date</th>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0">Time</th>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0">Created</th>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0">Communicated</th>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0 w-50">Comments</th>--}}
+{{--                <th class="px-2 text-secondary border-bottom-0 delete-column">&nbsp;</th>--}}
+{{--            </tr>--}}
+{{--            </thead>--}}
+{{--            <tbody>--}}
+{{--            @foreach($careMonth->entries as $entry)--}}
+{{--                @if(!$entry->is_removed && $entry->cm_or_rm === "RM")--}}
+{{--                    <tr>--}}
+{{--                        <td class="px-2">--}}
+{{--                            <div class="font-weight-bold">{{friendly_date_time($entry->effective_date, false)}}</div>--}}
+{{--                        </td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            {{time_in_hrminsec($entry->time_in_seconds)}}--}}
+{{--                        </td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            {{friendly_date_time($entry->created_at)}}--}}
+{{--                        </td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            {{$entry->did_pro_interact_with_client_about_rm ? 'Yes' : 'No'}}--}}
+{{--                        </td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            <div class="text-secondary in-table-markup">{!! $entry->content_text !!}</div>--}}
+{{--                            <!--                                        <div class="text-secondary text-sm">{{$entry->content_detail}}</div>-->--}}
+{{--                        </td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            @if(!$activeRMBill)--}}
+{{--                                @include('app.practice-management.care_month_add_entry_form', ['right' => true, 'entry' => $entry])--}}
+{{--                                <div moe relative>--}}
+{{--                                    <a start show class="text-danger">Delete</a>--}}
+{{--                                    <form url="/api/careMonthEntry/remove" right class="text-left">--}}
+{{--                                        <input type="hidden" name="uid" value="{{ $entry->uid }}">--}}
+{{--                                        <p class="small">Are you sure you want to delete this RM entry?</p>--}}
+{{--                                        <div class="d-flex align-items-center">--}}
+{{--                                            <button class="btn btn-sm btn-danger mr-2" submit>Delete</button>--}}
+{{--                                            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>--}}
+{{--                                        </div>--}}
+{{--                                    </form>--}}
+{{--                                </div>--}}
+{{--                            @else--}}
+{{--                                <span class="text-sm text-secondary">Can't modify since a bill exists</span>--}}
+{{--                            @endif--}}
+{{--                        </td>--}}
+{{--                    </tr>--}}
+{{--                @endif--}}
+{{--            @endforeach--}}
+{{--            </tbody>--}}
+{{--        </table>--}}
+    </div>
+@endif
+
 <script>
     (function() {
         window.segmentInitializers.<?= !!@$segment ? $segment->segmentTemplate->internal_name : $segmentInternalName ?> = function () {
@@ -109,6 +196,55 @@ if (!!@$point->data) {
                         parentSegment.find('[if-reviewed-rpm]').removeClass('d-flex').addClass('d-none');
                     }
                 });
+
+            @if($careMonth && $careMonth->is_client_enrolled_in_rm)
+            runMCInitializer('vitalsGraphUnified_{{$careMonth->id}}{{$segment->uid}}');
+            addMCHook('updateRMSegment', function() {
+                refreshSegment('<?= $segment->segmentTemplate->internal_name ?>');
+                return false;
+            });
+            initMoes();
+            initProSuggest();
+            parentSegment.find('[cm-rte]').each(function() {
+
+                $(this).wrap(
+                    $('<div class="border-left border-right rte-holder"/>')
+                        .attr('data-shortcuts', '')
+                );
+
+                // give a unique id to this editor instance
+                var editorID = Math.ceil(Math.random() * 99999), fieldName = $(this).attr('data-name');
+
+                var el = this;
+                var existingContent = $(el).attr('data-content') ? $(el).attr('data-content') : $(el).html();
+                var quill = new Quill(el, {
+                    theme: 'snow',
+                    modules: stagQuillConfig
+                });
+
+                var toolbar = $(quill.container).prev('.ql-toolbar');
+
+                // add button for new shortcut
+                var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
+                    'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
+                toolbar.append(newSCButton);
+
+                quill.root.innerHTML = existingContent;
+
+                $('<input type="hidden" name="' + fieldName + '">').val(existingContent).insertAfter(el);
+
+                quill.on('text-change', function(delta, oldDelta, source) {
+                    $(el).next('[name="' + fieldName + '"]').val(quill.root.innerHTML);
+                });
+
+                $(quill.container)
+                    .find('.ql-editor[contenteditable]')
+                    .attr('data-field', fieldName)
+                    .attr('data-editor-id', editorID)
+                    .attr('with-shortcuts', 1);
+
+            });
+            @endif
         };
     }).call(window);
 </script>

+ 1 - 17
resources/views/app/patient/settings.blade.php

@@ -981,23 +981,7 @@
                 @if($pro->pro_type == 'ADMIN' || $pro->id == $patient->default_na_pro_id)
                     <div moe class="ml-2">
                         <a start show><i class="fa fa-edit"></i></a>
-                        <form url="/api/client/putMcp" class="mcp-theme-1">
-                            <input type="hidden" name="uid" value="{{$patient->uid}}">
-                            <div class="mb-2">
-                                <label class="text-secondary text-sm">MCP Pro</label>
-                                <select name="mcpProUid" class="form-control form-control-sm" provider-search data-pro-uid="{{ @$patient->mcp->uid }}" >
-                                    <option value=""> --select--</option>
-                                    @foreach($pros as $iPro)
-                                        <option
-                                            value="{{$iPro->uid}}" {{ $patient->mcp && $iPro->uid === $patient->mcp->uid ? 'selected' : '' }}>{{$iPro->displayName()}}</option>
-                                    @endforeach
-                                </select>
-                            </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>
+                        @include('app.patient.partials.put-mcp-form')
                     </div>
                 @endif
 

+ 88 - 50
resources/views/app/practice-management/care_month_add_entry_form.blade.php

@@ -1,54 +1,92 @@
-<div moe large class="ml-2">
-    <a start show class="py-0 mb-3 text-sm">Add Entry</a>
-    <form url="/api/careMonthEntry/createForRm" right>
-        <input type="hidden" name="careMonthUid" value="{{$careMonth->uid }}">
-        <input type="hidden" name="proUid" value="{{ $performer->pro->uid }}">
-        <div class="mb-2">
-            <div class="row">
-                <div class="col-6 pr-0">
-                    <?php
-                    $sD = strtotime($careMonth->start_date);
-                    $y = date('Y', $sD);
-                    $m0 = date('m', $sD);
-                    $d = date('t', $sD);
-                    $defaultED = $sD >= strtotime(date('Y-m-d')) ? date('Y-m-d') : $careMonth->start_date;
-                    ?>
-                    <label class="text-sm text-secondary mb-1">Effective Date</label>
-                    <input autofocus type="date" min="{{ date($y . '-' . $m0 . '-01') }}" max="{{ date($y . '-' . $m0 . '-' . $d) }}"
-                            value="{{$defaultED}}"
-                            class="form-control form-control-sm w-100" name="effectiveDate"
-                            placeholder="Effective Date" required>
+@if(!$activeRMBill || @$entry)
+    <div moe large class="mr-2" id="cm-entry-form{{@$entry ? '-' . $entry->uid : ''}}">
+        <a start show class="py-0 mb-3">{{@$entry ? 'Edit' : 'Add'}}</a>
+        <form url="/api/careMonthEntry/{{@$entry ? 'updateSimpleForRm' : 'createForRm'}}" {{@$right ? 'right' : ''}} {{@$hook ? 'hook=' . $hook : ''}}>
+            @if(@$entry)
+                <input type="hidden" name="uid" value="{{ $entry->uid }}">
+            @else
+                <input type="hidden" name="careMonthUid" value="{{ $careMonth->uid }}">
+            @endif
+            <div class="mb-2">
+                <div class="row">
+                    <div class="col-4 pr-0">
+                        <label class="mb-1 text-sm text-secondary text-left">Pro</label>
+                        <select class="form-control form-control-sm w-100" name="proUid" provider-search data-pro-uid="{{ @$entry ? $entry->pro->uid : ($pro ? $pro->uid : '') }}"
+                                required>
+                            <option value="">-- Select Pro --</option>
+                        </select>
+                    </div>
+                    <div class="col-4 pr-0">
+                        <?php
+                        $sD = strtotime($careMonth->start_date);
+                        $y = date('Y', $sD);
+                        $m = date('m', $sD);
+                        $d = date('t', $sD);
+                        $yCurrent = date('Y');
+                        $mCurrent = date('m');
+                        $isToday = false;
+                        if($y === $yCurrent && $m === $mCurrent) {
+                            $d = date('d');
+                            $isToday = true;
+                        }
+                        ?>
+                        <label class="mb-1 text-sm text-secondary text-left">Date</label>
+                        <input autofocus type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}"
+                               value="{{@$entry ? $entry->effective_date : (@$defaultDate ?: $careMonth->end_date)}}"
+                               class="form-control form-control-sm w-100" name="effectiveDate"
+                               placeholder="Effective Date" required>
+                    </div>
+                    <div class="col-4">
+                        <label class="mb-1 text-sm text-secondary text-left">Minutes</label>
+                        <input type="hidden" name="timeInSeconds" value="{{@$entry ? $entry->time_in_seconds : (@$defaultSeconds ?: '')}}">
+                        <input type="number" min="1" max="20" name="timeInMinutes" class="form-control form-control-sm w-100 cm-time-value"
+                               value="{{@$entry ? round($entry->time_in_seconds / 60, 0) : (@$defaultSeconds ? $defaultSeconds/60 : '')}}"
+                               required>
+                    </div>
                 </div>
-                <div class="col-6">
-                    <label class="text-sm text-secondary mb-1">Seconds</label>
-                    <input type="number" class="form-control form-control-sm w-100 cm-time-value" name="timeInSeconds"
-                            value="1200" placeholder="Time (secs.)" required>
+            </div>
+            <div class="mb-2 border border-info p-2 mt-2 bg-light text-left">
+                <span><i class="fa fa-phone rotateh text-dark mr-1"></i>This time entry involved interactive communication (audio, video, or in-person) with the patient and/or caretaker.</span>
+                <div class="d-flex border-top mt-2">
+                    <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
+                        <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" {{((@$entry && $entry->did_pro_interact_with_client_about_rm) || @$defaultInteracted) ? 'checked' : ''}} required>
+                        <span>Yes</span>
+                    </label>
+                    <label class="mt-2 mb-0 d-inline-flex align-items-center">
+                        <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" {{((@$entry && $entry->did_pro_interact_with_client_about_rm) || @$defaultInteracted) ? '' : 'checked' }} required>
+                        <span>No</span>
+                    </label>
+                </div>
+            </div>
+            <div class="mb-2">
+                <div class="row">
+                    <div class="col-12">
+                        <div cm-rte data-name="contentText">{!! @$entry ? $entry->content_text : (@$defaultComment ?: 'Reviewed/managed patient measurements') !!}</div>
+                    </div>
                 </div>
             </div>
-        </div>
-
-        <div class="mb-2 border border-info p-2 mt-2 bg-light">
-            <span>I have had interactive communication with <b>{{$careMonth->client->displayName()}}</b>.</span>
-            <div class="d-flex border-top mt-2">
-                <label class="mt-2 mb-0 d-inline-flex align-items-center mr-3">
-                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="true" required>
-                    <span>Yes</span>
-                </label>
-                <label class="mt-2 mb-0 d-inline-flex align-items-center">
-                    <input type="radio" class="mr-2" name="didProInteractWithClientAboutRm" value="false" required>
-                    <span>No</span>
-                </label>
+            <div class="d-flex align-items-center">
+                <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
             </div>
-        </div>
-       
-        <div class="mb-2">
-            <label class="text-sm text-secondary mb-1">Memo</label>
-            <textarea class="form-control form-control-sm w-100" name="contentText"
-                        required>Interacted with the patient</textarea>
-        </div>
-        <div class="d-flex align-items-center">
-            <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-            <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-        </div>
-    </form>
-</div>
+        </form>
+    </div>
+@else
+    <span class="mx-2 text-secondary">|</span>
+    <span class="text-secondary">Can't modify since a bill exists</span>
+@endif
+<script>
+    (function() {
+        function init() {
+            $(document)
+                .off('input change paste keyup', '[name="timeInMinutes"]')
+                .on('input change paste keyup', '[name="timeInMinutes"]', function() {
+                    let form = $(this).closest('form'), val = '' + $(this).val();
+                    if(!isNaN(val)) {
+                        form.find('[name="timeInSeconds"]').val(+val * 60);
+                    }
+                });
+        }
+        addMCInitializer('cm-entry-form{{@$entry ? '-' . $entry->uid : ''}}', init, '#cm-entry-form{{@$entry ? '-' . $entry->uid : ''}}');
+    }).call(window);
+</script>

+ 0 - 8
resources/views/app/practice-management/rpm-matrix-for-admin-table.blade.php

@@ -11,14 +11,6 @@
     <div class="flex-grow-1 px-0 overflow-auto h-100 rpm-matrix-right-column">
         <?php $trIndex = 0; ?>
         @foreach ($patients as $iPatient)
-            <script>
-                addMCHook(
-                    'refresh-rpm-row-{{$trIndex}}',
-                    function () {
-                        refreshRpmRow({{$trIndex}});
-                    }
-                );
-            </script>
             <?php $trIndex++; ?>
         @endforeach
         <table class="table table-sm table-striped table-hover p-0 m-0 min-width-1100px" id="table-rm-matrix">

+ 20 - 1
resources/views/app/stat-tree/stat-tree-lines/view-data-inline.blade.php

@@ -11,6 +11,9 @@
                 Report columns not configured for this report!
             </div>
         @else
+            <?php
+            $userClauseArgs = [];
+            ?>
             <div class="mb-2 d-flex flex-wrap">
                 @foreach($line->lineClauses as $lineClause)
                     <div class="border rounded px-2 py-1 mr-2 bg-light clause-label-part">{{$lineClause->clause_label}}
@@ -20,6 +23,9 @@
                             foreach($lineClause->lineClauseArgs as $lineClauseArg) {
                                 $argLabel = $lineClauseArg->clauseArg->arg_text . ': ' . $lineClauseArg->value;
                                 $argsLabel[] = $argLabel;
+                                if($lineClauseArg->access_level === 'USER') {
+                                    $userClauseArgs[] = $lineClauseArg->clauseArg->arg_text;
+                                }
                             }
                             ?>
                             [{{implode(', ', $argsLabel)}}]
@@ -29,8 +35,21 @@
             </div>
 
             <!-- filters -->
-            <a href="#" class="toggle-filters" onclick="$('#view-data-filters-form').toggle(); return false;">Toggle Filter</a>
+            <a href="#" class="toggle-filters d-block mb-2" onclick="$('#view-data-filters-form').toggle(); return false;">Toggle Filter</a>
             <form action="" id="view-data-filters-form" onsubmit="return false;">
+
+                @if(count($userClauseArgs))
+                    <div class="px-2 pt-2 border bg-light">
+                        <div class="font-weight-bold text-secondary mb-2">Override Arguments</div>
+                        @foreach($userClauseArgs as $userClauseArg)
+                            <div class="d-flex align-items-baseline mb-2">
+                                <label class="m-0 width-70px">{{$userClauseArg}}</label>
+                                <input type="text" class="form-control form-control-sm min-width-unset flex-grow-1" name="st_{{$userClauseArg}}" value="{{request()->input('st_' . $userClauseArg)}}">
+                            </div>
+                        @endforeach
+                    </div>
+                @endif
+
                 <input type="hidden" name="sort_by" value="{{request()->input('sort_by')}}">
                 <input type="hidden" name="sort_dir" value="{{request()->input('sort_dir')}}">
                 <table class="table table-sm table-striped table-bordered mb-0 mt-2 bg-aliceblue">

+ 24 - 5
resources/views/app/stat-tree/stat-tree-lines/view-data.blade.php

@@ -11,6 +11,9 @@
                 Report columns not configured for this report!
             </div>
         @else
+            <?php
+            $userClauseArgs = [];
+            ?>
             <div class="mb-2 d-flex flex-wrap">
                 @foreach($line->lineClauses as $lineClause)
                     <div class="border rounded px-2 py-1 mr-2 bg-light clause-label-part">{{$lineClause->clause_label}}
@@ -20,6 +23,9 @@
                             foreach($lineClause->lineClauseArgs as $lineClauseArg) {
                                 $argLabel = $lineClauseArg->clauseArg->arg_text . ': ' . $lineClauseArg->value;
                                 $argsLabel[] = $argLabel;
+                                if($lineClauseArg->access_level === 'USER') {
+                                    $userClauseArgs[] = $lineClauseArg->clauseArg->arg_text;
+                                }
                             }
                             ?>
                             [{{implode(', ', $argsLabel)}}]
@@ -29,8 +35,21 @@
             </div>
 
             <!-- filters -->
-            <a href="#" class="toggle-filters" onclick="$('#view-data-filters-form').toggle(); return false;">Toggle Filter</a>
-            <form action="" id="view-data-filters-form">
+            <a href="#" class="toggle-filters d-block mb-2" onclick="$('#view-data-filters-form').toggle(); return false;">Toggle Filter</a>
+            <form action="" id="view-data-filters-form" onsubmit="return false;">
+
+                @if(count($userClauseArgs))
+                    <div class="px-2 pt-2 border bg-light">
+                        <div class="font-weight-bold text-secondary mb-2">Override Arguments</div>
+                        @foreach($userClauseArgs as $userClauseArg)
+                            <div class="d-flex align-items-baseline mb-2">
+                                <label class="m-0 width-70px">{{$userClauseArg}}</label>
+                                <input type="text" class="form-control form-control-sm min-width-unset flex-grow-1" name="st_{{$userClauseArg}}" value="{{request()->input('st_' . $userClauseArg)}}">
+                            </div>
+                        @endforeach
+                    </div>
+                @endif
+
                 <input type="hidden" name="sort_by" value="{{request()->input('sort_by')}}">
                 <input type="hidden" name="sort_dir" value="{{request()->input('sort_dir')}}">
                 <table class="table table-sm table-striped table-bordered mb-0 mt-2 bg-aliceblue">
@@ -38,9 +57,9 @@
                         <?php $lastColumnRendered = false; ?>
                         @foreach($columns as $column)
                             <tr>
-                                <th class="border-bottom-0 width-150px font-weight-normal text-nowrap {{request()->input($column['as'] . '_op') ? 'font-weight-bold text-info' : ''}}">{{$column['label']}}</th>
+                                <th class="border-bottom-0 width-150px font-weight-normal align-middle text-nowrap {{request()->input($column['as'] . '_op') ? 'font-weight-bold text-info' : ''}}">{{$column['label']}}</th>
 
-                                <th class="border-bottom-0 width-150px p-0">
+                                <th class="border-bottom-0 width-150px p-0 align-middle">
                                     <select class="form-control form-control-sm min-width-unset border-0 rounded-0 shadow-none" name="{{$column['as']}}_op">
                                         <option value="">-- select --</option>
                                         <?php
@@ -84,7 +103,7 @@
                                     </select>
                                 </th>
 
-                                <th class="border-bottom-0 p-0">
+                                <th class="border-bottom-0 p-0 align-middle">
                                     <div class="d-flex align-items-center">
                                     <?php
                                     switch($column['type']) {

+ 1 - 20
resources/views/layouts/patient-header.blade.php

@@ -278,26 +278,7 @@ $addressParts .= implode(", ", $addressPart2);
                         @if($patient->has_mcp_done_onboarding_visit !== 'YES' && $pro->pro_type == 'ADMIN')
                             <div moe class="ml-2 hide-inside-popup">
                                 <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
-                                <form url="/api/client/putMcp" class="mcp-theme-1">
-                                    <input type="hidden" name="uid" value="{{$patient->uid}}">
-                                    <div class="mb-2">
-                                        <label class="text-secondary text-sm">MCP Pro</label>
-                                        <select name="mcpProUid" provider-search data-pro-uid="{{ @$patient->mcp->uid }}" class="form-control form-control-sm">
-                                            <option value=""> --select--</option>
-                                            @foreach($pros as $iPro)
-                                                <option value="{{$iPro->uid}}" {{ $patient->mcp && $iPro->uid === $patient->mcp->uid ? 'selected' : '' }}>{{$iPro->displayName()}}</option>
-                                            @endforeach
-                                        </select>
-                                    </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>
+                                @include('app.patient.partials.put-mcp-form')
                             </div>
                             @if($patient->mcp)
                                 <div moe class="ml-2 hide-inside-popup">

+ 1 - 20
resources/views/layouts/patient-old.blade.php

@@ -565,26 +565,7 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 											@if($patient->has_mcp_done_onboarding_visit !== 'YES' && $pro->pro_type == 'ADMIN')
 											<div moe class="ml-2 hide-inside-popup">
 												<a start show><i class="fa fa-edit"></i></a>
-												<form url="/api/client/putMcp" class="mcp-theme-1">
-													<input type="hidden" name="uid" value="{{$patient->uid}}">
-													<div class="mb-2">
-														<label class="text-secondary text-sm">MCP Pro</label>
-														<select name="mcpProUid" provider-search data-pro-uid="{{ @$patient->mcp->uid }}" class="form-control form-control-sm">
-															<option value=""> --select--</option>
-															@foreach($pros as $iPro)
-															<option value="{{$iPro->uid}}" {{ $patient->mcp && $iPro->uid === $patient->mcp->uid ? 'selected' : '' }}>{{$iPro->displayName()}}</option>
-															@endforeach
-														</select>
-													</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>
+												@include('app.patient.partials.put-mcp-form')
 											</div>
 											@if($patient->mcp)
 											<div moe class="ml-2 hide-inside-popup">