Ver Fonte

Merge branch 'master' into dev-vj

Vijayakrishnan há 3 anos atrás
pai
commit
e4854b4a46

+ 9 - 1
app/Helpers/helpers.php

@@ -138,7 +138,7 @@ if(!function_exists('inchesAfterFeetFromInches')) {
 }
 
 if(!function_exists('genericBills')) {
-    function genericBills(Pro $performerPro, $patient, $entityType, $entityUid) {
+    function genericBills(Pro $performerPro, $patient,$careMonth, $entityType, $entityUid) {
         $genericBills = Bill::where('bill_service_type', 'GENERIC');
         if($performerPro->pro_type !== 'ADMIN') {
             $genericBills = $genericBills->where('generic_pro_id', $performerPro->id);
@@ -146,10 +146,18 @@ if(!function_exists('genericBills')) {
         if($patient) {
             $genericBills = $genericBills->where('client_id', $patient->id);
         }
+
+        if($careMonth){
+            $genericBills = $genericBills->where('care_month_id', $careMonth->id);
+        }
+
         if($entityType && $entityUid) {
+          
             $genericBills = $genericBills
                 ->where('generic_target_entity_type', $entityType)
                 ->where('generic_target_entity_uid', $entityUid);
+            
+            
         }
         return $genericBills->orderBy('created_at', 'DESC')->get();
     }

+ 10 - 4
app/Http/Controllers/AdminController.php

@@ -77,6 +77,11 @@ class AdminController extends Controller
         if ($request->input('next_appointment_category')) {
             if($request->input('next_appointment_category') == 'NONE'){
                 $patients = $patients->whereNull('next_mcp_appointment_id');
+            }else{
+                $self = $this;
+                $patients = $patients->whereHas('nextMcpAppointment', function($pQry) use ($request, $self){
+                    return $self->filterMultiQuery($request, $pQry, 'raw_date', 'next_appointment_category', 'next_appointment_value_1', 'next_appointment_value_2');
+                });
             }
         }
 
@@ -95,12 +100,13 @@ class AdminController extends Controller
             }
         }
 
-        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2');
+        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2', false);
         $this->filterSimpleQuery($request, $patients, 'sex', 'sex');
-        $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2');
+        $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2', false);
         $this->filterMultiQuery($request, $patients, 'most_recent_weight_at', 'last_weighed_in_category', 'last_weighed_in_value_1', 'last_weighed_in_value_2');
         $this->filterMultiQuery($request, $patients, 'most_recent_bp_at', 'last_bp_category', 'last_bp_value_1', 'last_bp_value_2');
         $this->filterMultiQuery($request, $patients, 'created_at', 'created_at', 'created_at_value_1', 'created_at_value_2');
+        $this->filterMultiQuery($request, $patients, 'most_recent_completed_mcp_note_date', 'last_visit_category', 'last_visit_value_1', 'last_visit_value_2');
 
         if($request->input('number_of_measurements')){
             $keyName = $request->input('number_of_measurements');
@@ -261,9 +267,9 @@ class AdminController extends Controller
             }
         }
 
-        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2');
+        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2', false);
         $this->filterSimpleQuery($request, $patients, 'sex', 'sex');
-        $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2');
+        $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2', false);
         $this->filterMultiQuery($request, $patients, 'most_recent_weight_at', 'last_weighed_in_category', 'last_weighed_in_value_1', 'last_weighed_in_value_2');
         $this->filterMultiQuery($request, $patients, 'most_recent_bp_at', 'last_bp_category', 'last_bp_value_1', 'last_bp_value_2');
 

+ 2 - 2
app/Http/Controllers/DnaController.php

@@ -62,9 +62,9 @@ class DnaController extends Controller
             }
         }
 
-        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2');
+        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2', false);
         $this->filterSimpleQuery($request, $patients, 'sex', 'sex');
-        $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2');
+        $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2', false);
         $this->filterMultiQuery($request, $patients, 'most_recent_completed_mcp_note_date', 'last_visit_category', 'last_visit_value_1', 'last_visit_value_2'); 
         $this->filterMultiQuery($request, $patients, 'next_mcp_appointment_date', 'next_appointment_category', 'next_appointment_value_1', 'next_appointment_value_2');
 

+ 14 - 2
app/Http/Controllers/McpController.php

@@ -93,11 +93,12 @@ class McpController extends Controller
             }
         }
 
-        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2');
+        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2', false);
         $this->filterSimpleQuery($request, $patients, 'sex', 'sex');
-        $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2');
+        $this->filterMultiQuery($request, $patients, 'usual_bmi_max', 'bmi_category', 'bmi_value_1', 'bmi_value_2', false);
         $this->filterMultiQuery($request, $patients, 'most_recent_weight_at', 'last_weighed_in_category', 'last_weighed_in_value_1', 'last_weighed_in_value_2');
         $this->filterMultiQuery($request, $patients, 'most_recent_bp_at', 'last_bp_category', 'last_bp_value_1', 'last_bp_value_2');
+        $this->filterMultiQuery($request, $patients, 'most_recent_completed_mcp_note_date', 'last_visit_category', 'last_visit_value_1', 'last_visit_value_2');
 
         switch($request->input('status')) {
             case 'ACTIVE':
@@ -125,6 +126,17 @@ class McpController extends Controller
             });
         }
 
+        if ($request->input('next_appointment_category')) {
+            if($request->input('next_appointment_category') == 'NONE'){
+                $patients = $patients->whereNull('next_mcp_appointment_id');
+            }else{
+                $self = $this;
+                $patients = $patients->whereHas('nextMcpAppointment', function($pQry) use ($request, $self){
+                    return $self->filterMultiQuery($request, $pQry, 'raw_date', 'next_appointment_category', 'next_appointment_value_1', 'next_appointment_value_2');
+                });
+            }
+        }
+
 
         if ($request->input('chart_number')) {
             $patients = $patients->where('chart_number', 'ILIKE' , '%'.$request->input('chart_number').'%');

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

@@ -3804,7 +3804,7 @@ ORDER BY c.name_last, c.name_first
         ]
         */
 
-        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2');
+        $this->filterMultiQuery($request, $patients, 'age_in_years', 'age_category', 'age_value_1', 'age_value_2', false);
         $this->filterSimpleQuery($request, $patients, 'sex', 'sex');
         $this->filterMultiQuery($request, $patients, 'usual_bmi', 'bmi_category', 'bmi_value_1', 'bmi_value_2');
         $this->filterMultiQuery($request, $patients, 'most_recent_weight_at', 'last_weighed_in_category', 'last_weighed_in_value_1', 'last_weighed_in_value_2');

+ 7 - 0
app/Models/Client.php

@@ -108,6 +108,13 @@ class Client extends Model
         return $this->hasOne(Pro::class, 'id', 'default_na_pro_id');
     }
 
+    public function stickyNoteUpdatedBySession()
+    {
+        return $this->hasOne(AppSession::class, 'id', 'sticky_note_updated_by_session_id');
+    }
+
+    
+
     public function creator()
     {
         return $this->hasOne(Pro::class, 'id', 'created_by_pro_id');

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

@@ -471,7 +471,7 @@
                                         Notifications
                                     </strong>
                                 </div>
-                                <div class="card-body px-3 py-2">
+                                <div class="card-body p-0">
                                     @include('app.mcp.dashboard.notifications')
                                 </div>
                             </div>

+ 1 - 1
resources/views/app/dna/my-bills.blade.php

@@ -155,7 +155,7 @@
                                         <p>Update Cancellation Memo</p>
                                         <div class="mb-2">
                                             <textarea class="text form-control form-control-sm" name="cancellationMemo"
-                                                      placeholder="">{{$bill->cancellation_memo ? $bill->cancellation_memo : ($pro->pro_type === 'ADMIN' ? 'Please contact billing.' : '')}}</textarea>
+                                                    placeholder="">{{$bill->cancellation_memo ? $bill->cancellation_memo : ($pro->pro_type === 'ADMIN' ? 'Please contact billing.' : '')}}</textarea>
                                         </div>
                                         <div>
                                             <button class="btn btn-success btn-sm" submit>Submit</button>

+ 1 - 1
resources/views/app/generic-bills/inline-for-cm.blade.php

@@ -11,7 +11,7 @@ use App\Models\Client;
 /** @var $entityType */
 /** @var $entityUid */
 
-$genericBills = genericBills($pro, @$patient, @$entityType, @$entityUid);
+$genericBills = genericBills($pro, @$patient,null, @$entityType, @$entityUid);
 ?>
 
 @if(!count($genericBills))

+ 1 - 1
resources/views/app/generic-bills/inline.blade.php

@@ -11,7 +11,7 @@ use App\Models\Client;
 /** @var $entityType */
 /** @var $entityUid */
 
-$genericBills = genericBills($pro, @$patient, @$entityType, @$entityUid);
+$genericBills = genericBills($pro, @$patient, @$careMonth, @$entityType, @$entityUid);
 ?>
 
 @if(!count($genericBills))

+ 11 - 5
resources/views/app/mcp/dashboard/notifications.blade.php

@@ -9,12 +9,16 @@
 
 ?>
 @if(!count($apptsPending['status']) && !count($apptsPending['decision'])/* && !count($apptsPending['time'])*/)
-    No appointment changes
+    <div class="px-2">
+        No appointment changes
+    </div>
 @endif
 @if(count($apptsPending['status']))
-    <b class="text-secondary my-2 d-block">Appointment Status Changes</b>
+    <div class="px-2">
+        <b class="text-secondary my-2 d-block">Appointment Status Changes</b>
+    </div>
     @foreach($apptsPending['status'] as $appt)
-        <div class="d-flex mb-1 border-bottom border-light" discardable-container>
+        <div class="d-flex mb-1 border-bottom px-2 pb-1" discardable-container>
             <div class="flex-grow-1 d-inline-flex align-items-baseline">
                 <div>
                     <a class="d-block" href="/patients/view/{{$appt->client->uid}}"><b>{{$appt->client->displayName()}}</b></a>
@@ -45,9 +49,11 @@
     @endforeach
 @endif
 @if(count($apptsPending['decision']))
-    <b class="text-secondary my-2 d-block">Appointment Confirmation Changes</b>
+    <div class="px-2">
+        <b class="text-secondary my-2 d-block">Appointment Confirmation Changes</b>
+    </div>
     @foreach($apptsPending['decision'] as $appt)
-        <div class="d-flex mb-1 border-bottom border-light" discardable-container>
+        <div class="d-flex mb-1 {{ $loop->last ? '':'border-bottom' }} px-2 pb-1" discardable-container>
             <div class="flex-grow-1 d-inline-flex align-items-baseline">
                 <div>
                     <a class="d-block" href="/patients/view/{{$appt->client->uid}}"><b>{{$appt->client->displayName()}}</b></a>

+ 4 - 4
resources/views/app/mcp/patients_filters.blade.php

@@ -76,10 +76,10 @@
 			</select>
 			<div v-show="filters.last_visit_category" class="mt-2">
 				<div>
-					<input  name="last_visit_value_1" v-model="filters.last_visit_value_1" type="number" class="form-control input-sm" :placeholder="(filters.last_visit_category === 'BETWEEN' || filters.last_visit_category === 'NOT_BETWEEN') ? 'From' : 'Last Visit'" />
+					<input  name="last_visit_value_1" v-model="filters.last_visit_value_1" type="date" class="form-control input-sm" :placeholder="(filters.last_visit_category === 'BETWEEN' || filters.last_visit_category === 'NOT_BETWEEN') ? 'From' : 'Last Visit'" />
 				</div>
 				<div v-show="filters.last_visit_category === 'BETWEEN' || filters.last_visit_category === 'NOT_BETWEEN'" class="mt-2">
-					<input name="last_visit_value_2" v-model="filters.last_visit_value_2" type="number" class="form-control input-sm" placeholder="To" />
+					<input name="last_visit_value_2" v-model="filters.last_visit_value_2" type="date" class="form-control input-sm" placeholder="To" />
 				</div>
 			</div>
 		</div>
@@ -99,10 +99,10 @@
 			</select>
 			<div v-show="filters.next_appointment_category" class="mt-2">
 				<div>
-					<input  name="next_appointment_value_1" v-model="filters.next_appointment_value_1" type="number" class="form-control input-sm" :placeholder="(filters.next_appointment_category === 'BETWEEN' || filters.next_appointment_category === 'NOT_BETWEEN') ? 'From' : 'Next Appt.'" />
+					<input  name="next_appointment_value_1" v-model="filters.next_appointment_value_1" type="date" class="form-control input-sm" :placeholder="(filters.next_appointment_category === 'BETWEEN' || filters.next_appointment_category === 'NOT_BETWEEN') ? 'From' : 'Next Appt.'" />
 				</div>
 				<div v-show="filters.next_appointment_category === 'BETWEEN' || filters.next_appointment_category === 'NOT_BETWEEN'" class="mt-2">
-					<input name="next_appointment_value_2" v-model="filters.next_appointment_value_2" type="number" class="form-control input-sm" placeholder="To" />
+					<input name="next_appointment_value_2" v-model="filters.next_appointment_value_2" type="date" class="form-control input-sm" placeholder="To" />
 				</div>
 			</div>
 		</div>

+ 20 - 2
resources/views/app/patient/care-month/dashboard.blade.php

@@ -283,6 +283,8 @@
                                     </b>
                                 </div>
 
+
+
                                 <div class="mt-2">
                                     <?php
                                     $minsBilled = 0;
@@ -320,6 +322,22 @@
                                     @include('app.practice-management.care_month_add_entry_form')
                                 </div>
 
+                                @if($performer->pro->pro_type == 'ADMIN')
+                                    <div>
+                                        <div class="my-1 font-weight-bold text-secondary">Has Anyone Interacted With Client About RM: {{$careMonth->has_anyone_interacted_with_client_about_rm? 'Yes': 'No'}}</div> 
+                                        <div class="my-1 font-weight-bold text-secondary">Has Mcp Interacted With Client About RM: {{$careMonth->has_mcp_interacted_with_client_about_rm? 'Yes': 'No'}}</div>	
+                                        <div class="my-1 font-weight-bold text-secondary">Has Admin Interacted With Client About RM: {{$careMonth->has_admin_interacted_with_client_about_rm? 'Yes': 'No'}}</div>
+                                        <div class="my-1 font-weight-bold text-secondary">Has Rmm Interacted With Client About RM: {{$careMonth->has_rmm_interacted_with_client_about_rm? 'Yes': 'No'}}</div>
+                                         
+                                        <div class="my-1 font-weight-bold text-secondary">Most Recent Mcp Note Date: {{$careMonth->most_recent_mcp_note_date}}</div>
+                                        <div class="my-1 font-weight-bold text-secondary">Days Between Most Recent Mcp Note Date And End Of Care Month: {{$careMonth->days_between_most_recent_mcp_note_date_and_end_of_care_month}}</div>
+                                        <div class="my-1 font-weight-bold text-secondary">Rm Total Time In Seconds: {{$careMonth->rm_total_time_in_seconds}}</div>
+                                        <div class="my-1 font-weight-bold text-secondary">Rm Total Time In Seconds By Mcp: {{$careMonth->rm_total_time_in_seconds_by_mcp}}</div>
+                                        <div class="my-1 font-weight-bold text-secondary">Rm Total Time In Seconds By Rmm Pro: {{$careMonth->rm_total_time_in_seconds_by_rmm_pro}}</div>
+                                        <div class="my-1 font-weight-bold text-secondary">Rm Total Time In Seconds By Rme Pro: {{$careMonth->rm_total_time_in_seconds_by_rme_pro}}</div>
+                                    </div>
+                                @endif
+
                                 <div class="mt-2 d-flex align-items-baseline">
                                     <span class="font-weight-bold text-secondary mr-1">Billing:</span>
                                     <div>
@@ -744,7 +762,7 @@
                 <hr class="m-negator my-0">
 
                 <div class="screen-only m-neg-4 mb-3">
-                    @include('app.generic-bills.inline-for-cm', ['patient' => $patient, 'careMonth' => $careMonth, 'class' => 'p-3 border-bottom', 'label' => 'MCP', 'entityType' => 'CareMonth', 'entityUid' => $careMonth->uid])
+                    @include('app.generic-bills.inline-for-cm', ['patient' => $patient, 'careMonth' => $careMonth, 'class' => 'p-3 border-bottom', 'label' => 'MCP'])
                 </div>
 
             @endif
@@ -1177,7 +1195,7 @@
 
         {{-- generic bills --}}{{--
         <div class="row">
-            @include('app.generic-bills.inline', ['patient' => $patient, 'class' => 'col-12', 'entityType' => 'CareMonth', 'entityUid' => $careMonth->uid])
+            @include('app.generic-bills.inline', ['patient' => $patient, 'class' => 'col-12', 'entityType' => 'CareMonth', 'entityUid' => $careMonth->id])
         </div>--}}
 
     </div>

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

@@ -1304,7 +1304,7 @@ use App\Models\Handout;
                     @endif
                 </div>
 
-                @if(!$note->is_non_medical)
+                @if(!$note->is_non_medical || true)
                     @if($pro->pro_type === 'ADMIN')
                     <div class="p-3 border-bottom screen-only" data-non-segment-section="Bills & Claims Summary">
                         <div>

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

@@ -47,7 +47,7 @@
 
     <hr>
     <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="Handouts" href="#">Handouts</a></div>
-    @if(!$note->is_non_medical)
+    @if(!$note->is_non_medical || true)
     <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="Prescriptions" href="#">ERx &amp; Orders</a></div>
     @endif
     <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="Incoming Reports" href="#">Incoming Reports</a></div>
@@ -55,7 +55,7 @@
     <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="Supply Orders Summary" href="#">Supply Orders Summary</a></div>
     <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="Vitals Settings" href="#">Vitals Settings</a></div>
     <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="ICDs" href="#">ICDs</a></div>
-    @if(!$note->is_non_medical)
+    @if(!$note->is_non_medical || true)
         @if($pro->pro_type === 'ADMIN')
             <div class="note-tree-node"><a native="" target="_top" data-non-segment-target="Bills & Claims Summary" href="#">Bills & Claims Summary</a></div>
         @endif

+ 160 - 19
resources/views/app/practice-management/processing-bill-matrix.blade.php

@@ -31,7 +31,7 @@
                         <option {{!request()->input('t') || request()->input('t') === 'hcp' ? 'selected' : ''}} value="hcp">
                             HCP Bills
                         </option>
-                        <option {{request()->input('t') === 'na' ? 'selected' : ''}} value="na">NA Bills</option>
+                        <option {{request()->input('t') === 'na' ? 'selected' : ''}} value="na">Generic Bills</option>
                     </select>
                 </div>
                 <div class="ml-4 d-inline-flex align-items-center">
@@ -78,14 +78,18 @@
                             <th class="border-bottom-0 border-top-0">Effective Date</th>
                             <th class="border-bottom-0 border-top-0">Bal Post Date</th>
                             @if(!request()->input('t') || request()->input('t') === 'hcp')
-                            <th class="border-bottom-0 border-top-0">HCP Pro</th>
+                            <th class="border-bottom-0 border-top-0">Pro</th>
                             @elseif(request()->input('t') === 'na')
-                            <th class="border-bottom-0 border-top-0">NA Pro</th>
+                            <th class="border-bottom-0 border-top-0">Pro</th>
                             @endif
                             <th class="border-bottom-0 border-top-0">Client</th>
+                            <th class="border-bottom-0 border-top-0">Insurance</th>
+                            <th class="border-bottom-0 border-top-0">State</th>
+                            <th class="border-bottom-0 border-top-0">Company Pro</th>
                             <th class="border-bottom-0 border-top-0">Code</th>
                             <th class="border-bottom-0 border-top-0">Units</th>
                             <th class="border-bottom-0 border-top-0">Verified?</th>
+                            <th class="border-bottom-0 border-top-0">Cancelled?</th>
                             @if(!request()->input('t') || request()->input('t') === 'hcp')
                             <th class="border-bottom-0 border-top-0">HCP Expected Amount</th>
                             @elseif(request()->input('t') === 'na')
@@ -109,9 +113,12 @@
                                     Note
                                 </a>
                                 @elseif($row->careMonth)
-                                <a href="/patients/view/{{$row->client->uid}}/care-months/view/{{$row->careMonth->uid}}">
-                                    Care Month
-                                </a>
+                                    <div>
+                                        <a href="/patients/view/{{$row->client->uid}}/care-months/view/{{$row->careMonth->uid}}">
+                                            Care Month
+                                        </a>
+                                    </div>
+                                    
                                 @elseif($row->client)
                                 <a href="/patients/view/{{ $row->client->uid }}">
                                     Chart
@@ -133,23 +140,15 @@
                                     @endif
                                 @endif
                             </td>
+                           
                             <td>{{friendly_date($row->effective_date)}}</td>
                             <td>{{friendly_date($row->balance_post_date)}}</td>
                             <td>
+
                                 @if(!request()->input('t') || request()->input('t') === 'hcp')
-                                {{$row->hcp->name_last}}, {{$row->hcp->name_first}}
-                                <div class="mt-1 text-sm text-secondary">
-                                    <i class="fa fa-hospital mr-1"></i>
-                                    {{$row->hcpCompanyPro ? $row->hcpCompanyPro->company->name:''}}
-                                </div>
+                                    {{$row->hcp->name_last}}, {{$row->hcp->name_first}}
                                 @elseif(request()->input('t') === 'na')
-                                {{$row->genericPro->name_last}}, {{$row->genericPro->name_first}}
-                                <div class="mt-1 text-sm text-secondary">
-                                    <i class="fa fa-hospital mr-1"></i>
-                                    @if($row->genericCompanyPro && $row->genericCompanyPro->company)
-                                        {{$row->genericCompanyPro->company->name}}
-                                    @endif
-                                </div>
+                                    {{$row->genericPro->name_last}}, {{$row->genericPro->name_first}}
                                 @endif
 
                             </td>
@@ -158,13 +157,155 @@
                                 {{$row->client->name_last}}, {{$row->client->name_first}}
                                 @endif
                             </td>
+                            <td>
+                            @if($row->client)
+                                @include('app.patient.coverage_column_renderer', ['patient'=>$row->client])
+                            @endif
+                            </td>
+                            <td>
+                                @if($row->client)
+                                {{$row->client->mailing_address_state}}
+                                @endif
+                            </td>
+                            <td>
+                                    
+                                    @if(!request()->input('t') || request()->input('t') === 'hcp')
+                                        <div class="mt-1 text-secondary">
+                                            @if($row->hcpCompanyPro)
+                                                {{$row->hcpCompanyPro ? $row->hcpCompanyPro->company->name : '-'}}
+                                            @else 
+                                                <i>[company pro is not set]</i>
+                                            @endif
+                                            <div moe class="ml-1">
+                                                <a class="text-primary" href="" show start><i class="fa fa-edit"></i></a>
+                                                <form url="/api/bill/swapHcpCompanyPro">
+                                                    <input type="hidden" name="uid" value="{{$row->uid}}">
+                                                    <div class="mb-2">
+                                                        <select name="hcpCompanyProUid" class="form-control form-control-sm">
+                                                            <option value="">-- select --</option>
+                                                            @foreach($row->hcp->companyPros as $companyPro)
+                                                                <option value="{{$companyPro->uid}}">{{$companyPro->company->name}}</option>
+                                                            @endforeach
+                                                        </select>
+                                                    </div>
+                                                    <div class="mb-0">
+                                                        <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                    </div>
+                                                </form>
+                                            </div>
+                                        </div>
+                                    @elseif(request()->input('t') === 'na')
+                                        
+                                        <div class="mt-1 text-secondary">
+                                            @if($row->genericCompanyPro && $row->genericCompanyPro->company)
+                                                {{$row->genericCompanyPro->company->name}}
+                                            @else 
+                                                <i>[company pro is not set]</i>
+                                            @endif
+                                            <div moe class="">
+                                                <a class="text-primary" href="" show start><i class="fa fa-edit"></i></a>
+                                                <form url="/api/bill/swapGenericCompanyPro">
+                                                    <input type="hidden" name="uid" value="{{$row->uid}}">
+                                                    <div class="mb-2">
+                                                        <select name="genericCompanyProUid" class="form-control form-control-sm">
+                                                            <option value="">-- select --</option>
+                                                            @foreach($row->genericPro->companyPros as $companyPro)
+                                                                <option value="{{$companyPro->uid}}">{{$companyPro->pro->displayName() . ' / ' . $companyPro->company->name}}</option>
+                                                            @endforeach
+                                                        </select>
+                                                    </div>
+                                                    <div class="mb-0">
+                                                        <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                    </div>
+                                                </form>
+                                            </div>
+                                        </div>
+                                        
+                                    @endif
+                                        
+                                </td>
                             <td>{{$row->code}}
                                 @if($row->generic_target_entity_type && $row->generic_target_entity_uid)
                                 <div class="mt-1 text-sm text-secondary">{{$row->generic_target_entity_type}}</div>
                                 @endif
                             </td>
                             <td>{{str_contains($row->code, 'Treatment Services') || str_contains($row->code, 'Administrative Services') ? ceil((float) $row->number_of_units * 60) . ' mins' : $row->number_of_units}}</td>
-                            <td>{!! $row->is_verified ? 'Yes<br>' . friendly_date($row->marked_verified_at, true) : 'No' !!} </td>
+                            <td>
+                                {!! $row->is_verified ? '<i class="fa fa-check text-success"></i> ' . friendly_date($row->marked_verified_at, true) : 'No' !!} 
+                                @if(!$row->is_cancelled)
+                                    @if(!$row->is_verified)
+                                        <div class="d-block mt-1" moe>
+                                            <a href="" show start>Mark Verified</a>
+                                            <form url="/api/bill/markAsVerified">
+                                                <input type="hidden" name="uid" value="{{$row->uid}}">
+                                                <p>Mark As Verified?</p>
+                                                <div class="mb-0">
+                                                    <button class="btn btn-success btn-sm" submit>Submit</button>
+                                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                </div>
+                                            </form>
+                                        </div>
+                                    @else
+                                        <div class="d-block mt-1" moe>
+                                            <a class="" href="" show start>Undo</a>
+                                            <form url="/api/bill/undoMarkAsVerified">
+                                                <input type="hidden" name="uid" value="{{$row->uid}}">
+                                                <p>Undo Mark As Verified?</p>
+                                                <div class="mb-0">
+                                                    <button class="btn btn-success btn-sm" submit>Submit</button>
+                                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                </div>
+                                            </form>
+                                        </div>
+                                    @endif
+                                @endif
+                            </td>
+
+                            <td>
+                                @if($row->is_cancelled)
+                                    <div class="text-warning-mellow font-weight-bold">Cancelled</div>
+                                    @if($row->cancellation_memo)
+                                        <div class="text-dark text-sm font-italic my-1">{{$row->cancellation_memo}}</div>
+                                    @endif
+                                    @if($row->is_cancelled_by_administrator)
+                                        <div class="text-secondary text-sm text-nowrap">(by Administrator)</div>
+                                    @endif
+                                    <div moe class="mt-1">
+                                        <a class="text-nowrap" href="" show start>Update Memo</a>
+                                        <form url="/api/bill/updateCancellationMemo">
+                                            <input type="hidden" name="uid" value="{{$row->uid}}">
+                                            <p>Update Cancellation Memo</p>
+                                            <div class="mb-2">
+                                                <textarea class="text form-control form-control-sm" name="cancellationMemo"
+                                                        placeholder="">{{$row->cancellation_memo ? $row->cancellation_memo : ($pro->pro_type === 'ADMIN' ? 'Please contact billing.' : '')}}</textarea>
+                                            </div>
+                                            <div>
+                                                <button class="btn btn-success btn-sm" submit>Submit</button>
+                                                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                @else
+                                    <div class="d-block" moe relative="">
+                                        <a class="text-danger" href="" show start>Cancel</a>
+                                        <form url="/api/bill/markCancelled" right="">
+                                            <input type="hidden" name="uid" value="{{$row->uid}}">
+                                            <p class="mb-2">Cancel this bill?</p>
+                                            <div class="mb-2">
+                                                <label class="mb-1 text-secondary">Cancellation Memo</label>
+                                                <textarea type="text" name="memo" placeholder="Memo" class="form-control form-control-sm">@if($pro->pro_type === 'ADMIN')Please contact billing.@endif</textarea>
+                                            </div>
+                                            <div class="mb-0">
+                                                <button class="btn btn-danger btn-sm" submit>Yes</button>
+                                                <button class="btn btn-default border btn-sm" cancel>No</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                @endif
+                            </td>
+                            
                             @if(!request()->input('t') || request()->input('t') === 'hcp')
                             <td>${{$row->hcp_expected_payment_amount}}</td>
                             @elseif(request()->input('t') === 'na')

+ 6 - 0
resources/views/layouts/patient-header.blade.php

@@ -489,8 +489,14 @@ $addressParts .= implode(", ", $addressPart2);
           </div>
         </div>
         @if($patient->sticky_note)
+        <?php
+        $patientRecentStickyNote = App\Models\ClientStickyNote::where('client_id', $patient->id)->orderBy('created_at', 'DESC')->limit(1)->first();
+        ?>
         <div class="">
           <span class="d-block text-secondary">{{$patient->sticky_note ?? '-' }}</span>
+          <div>
+            <small class="text-muted">By: {{ $patient->stickyNoteUpdatedBySession? $patient->stickyNoteUpdatedBySession->pro->displayName() : '-'  }} • At: {{ friendlier_date($patient->sticky_note_updated_at) }}</small>
+          </div>
         </div>
         @endif
       </div>