Browse Source

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

= 3 years ago
parent
commit
1726131e32
26 changed files with 999 additions and 229 deletions
  1. 1 1
      app/Http/Controllers/AdminController.php
  2. 1 1
      app/Http/Controllers/DnaController.php
  3. 1 0
      app/Http/Controllers/HomeController.php
  4. 1 1
      app/Http/Controllers/McpController.php
  5. 6 10
      resources/views/app/admin/patients-table-extended.blade.php
  6. 4 11
      resources/views/app/admin/patients.blade.php
  7. 18 18
      resources/views/app/admin/patients_filters.blade.php
  8. 1 1
      resources/views/app/dna/DnaController.php
  9. 1 1
      resources/views/app/generic-bills/add-bill-form/_default-fields.blade.php
  10. 4 0
      resources/views/app/new-patient.blade.php
  11. 15 15
      resources/views/app/patient/care-month/_matrix.blade.php
  12. 352 159
      resources/views/app/patient/care-month/dashboard.blade.php
  13. 2 2
      resources/views/app/patient/care-month/rm-reasons.blade.php
  14. 8 4
      resources/views/app/patient/prescriptions/list.blade.php
  15. 1 1
      resources/views/app/patient/vitals-graph.blade.php
  16. 77 0
      resources/views/app/rm-bills/add-bill-form/Note.blade.php
  17. 4 0
      resources/views/app/rm-bills/add-bill-form/_default-actions.blade.php
  18. 68 0
      resources/views/app/rm-bills/add-bill-form/_default-fields.blade.php
  19. 79 0
      resources/views/app/rm-bills/add-bill-form/_default-script.blade.php
  20. 37 0
      resources/views/app/rm-bills/add-bill-form/default.blade.php
  21. 71 0
      resources/views/app/rm-bills/context.blade.php
  22. 8 0
      resources/views/app/rm-bills/create_generic-bill.blade.php
  23. 224 0
      resources/views/app/rm-bills/inline.blade.php
  24. 8 0
      resources/views/app/rm-bills/modal.blade.php
  25. 2 2
      resources/views/layouts/patient.blade.php
  26. 5 2
      resources/views/layouts/template.blade.php

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

@@ -38,7 +38,7 @@ class AdminController extends Controller
     public function patients(Request $request)
     {
         $filters = $request->all();
-        $patients = Client::whereNull('shadow_pro_id');
+        $patients = Client::whereNull('shadow_pro_id')->where('client_engagement_status_category', '!=', 'NO_LONGER_INTERESTED');
 
         // filters
         /*

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

@@ -39,7 +39,7 @@ class DnaController extends Controller
     public function patients(Request $request)
     {
         $filters = $request->all();
-        $patients = Client::whereNull('shadow_pro_id')->where('default_na_pro_id', $this->performer->pro->id);
+        $patients = Client::whereNull('shadow_pro_id')->where('default_na_pro_id', $this->performer->pro->id)->where('client_engagement_status_category', '!=', 'NO_LONGER_INTERESTED');
 
         if ($request->input('name')) {
             $name = trim($request->input('name'));

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

@@ -1707,6 +1707,7 @@ WHERE measurement.label NOT IN ('SBP', 'DBP')
         }
 
         $clientQuery= Client::whereNull('shadow_pro_id')
+            ->where('client_engagement_status_category', '!=', 'NO_LONGER_INTERESTED')
             ->where(function ($q) use ($term, $phoneNumberTerm) {
                 $q->where('name_first', 'ILIKE', '%' . $term . '%')
                     ->orWhere('name_last', 'ILIKE', '%' . $term . '%')

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

@@ -39,7 +39,7 @@ class McpController extends Controller
     public function patients(Request $request)
     {
         $filters = $request->all();
-        $patients = Client::whereNull('shadow_pro_id');
+        $patients = Client::whereNull('shadow_pro_id')->where('client_engagement_status_category', '!=', 'NO_LONGER_INTERESTED');
         
         //TODO: implement in admin controller 
         if($this->performer->pro->pro_type != 'ADMIN'){

+ 6 - 10
resources/views/app/admin/patients-table-extended.blade.php

@@ -1,5 +1,5 @@
-<div class="table-responsive" style="height: calc(100vh - 190px)" id="admin-patients-list-extended">
-    <table class="table p-0 m-0 table-sm table-striped border-top border-bottom text-nowrap">
+<div class="table-responsive border-top" style="height: calc(100vh - 280px)" id="admin-patients-list-extended">
+    <table class="table p-0 m-0 table-sm table-striped border-bottom text-nowrap">
         <thead class="bg-light">
         <tr>
             <th class="border-0 width-90px">#</th>
@@ -118,8 +118,6 @@
                                             @foreach ($bills as $bill)
                                                 <div class="border border-info bg-aliceblue p-1 mb-1">
                                                     <div class="d-flex align-items-baseline">
-                                                        <span class="text-nowrap">{{friendlier_date_time($bill->effective_date, false)}}</span>
-                                                        <span class="mx-2 text-sm">/</span>
                                                         <span>{{$bill->code}}</span>
                                                         <span class="mx-2 text-sm">/</span>
                                                         <span>
@@ -144,30 +142,28 @@
                                                                 @endif
                                                             @endif
                                                         </span>
-                                                        <span class="mx-2 text-sm">/</span>
-                                                        <span>{{ $bill->hcp->displayName() }}</span>
-                                                    </div>
-                                                    <div class="d-flex align-items-baseline">
                                                         @if($bill->is_signed_by_hcp)
+                                                            <span class="mx-2 text-sm">/</span>
                                                             <span class="d-block text-nowrap">
                                                                 <i class="fa fa-check"></i>
                                                                 Signed
                                                             </span>
-                                                            <span class="mx-2 text-sm">/</span>
                                                         @endif
                                                         @if($bill->is_verified)
+                                                            <span class="mx-2 text-sm">/</span>
                                                             <span class="d-block text-nowrap">
                                                                 <i class="fa fa-check"></i>
                                                                 Verified
                                                             </span>
-                                                            <span class="mx-2 text-sm">/</span>
                                                         @endif
                                                         @if(!$bill->has_hcp_been_paid)
+                                                            <span class="mx-2 text-sm">/</span>
                                                             <div class="text-nowrap mt-1 screen-only">
                                                                 <span class="">Expected: </span>
                                                                 <span class="font-weight-bold">${{ $bill->hcp_expected_payment_amount }}</span>
                                                             </div>
                                                         @else
+                                                            <span class="mx-2 text-sm">/</span>
                                                             <div class="text-nowrap mt-1 screen-only">
                                                                 <span class="">Paid: </span>
                                                                 <span class="font-weight-bold">${{ $bill->hcp_payment_amount }}</span>

+ 4 - 11
resources/views/app/admin/patients.blade.php

@@ -10,17 +10,10 @@
                     Patients
                 </strong>
             </div>
-
-                @if(!request()->input('extended'))
-                    <div class="p-3">
-                        @include('app.admin.patients_filters')
-                    </div>
-                @endif
-                @if(!request()->input('extended'))
-                    @include('app.admin.patients-table')
-                @else
-                    @include('app.admin.patients-table-extended')
-                @endif
+                <div class="p-3">
+                    @include('app.admin.patients_filters')
+                </div>
+                @include('app.admin.patients-table-extended')
             </div>
         </div>
     </div>

+ 18 - 18
resources/views/app/admin/patients_filters.blade.php

@@ -15,7 +15,7 @@
 		width: 165px;
 	}
 	.filter-container >div:not(:last-child) {
-		margin-right: 15px;
+		margin-right: 10px;
 	}
 	.sm-section {
 		width: 125px !important;
@@ -23,14 +23,14 @@
 </style>
 <form id="admin-patients-filters" method="GET" action="{{ route('admin.patients') }}" class="filter-container" v-cloak>
 	<div class="sm-section">
-		<div class="form-group">
+		<div class="">
 			<label>Name:</label>
 			<input name="name" class="form-control input-sm" v-model="filters.name">
 		</div>
 	</div>
 	<!-- AGE	 -->
 	<div class="sm-section">
-		<div class="form-group">
+		<div class="">
 			<label>Age:</label>
 			<select name="age_category" class="form-control input-sm" v-model="filters.age_category">
 				<option value="">All</option>
@@ -52,7 +52,7 @@
 	</div>
 	<!-- SEX -->
 	<div class="sm-section">
-		<div class="form-group">
+		<div class="">
 			<label>Sex:</label>
 			<select name="sex" class="form-control input-sm" v-model="filters.sex">
 				<option value="">All</option>
@@ -63,7 +63,7 @@
 	</div>
 	<!-- BMI -->
 	<div class="sm-section">
-		<div class="form-group">
+		<div class="">
 			<label>BMI:</label>
 			<select name="bmi_category" class="form-control input-sm" v-model="filters.bmi_category">
 				<option value="">All</option>
@@ -86,7 +86,7 @@
 
 	<!-- LAST VISIT -->
 	<div class="sm-section">
-		<div class="form-group">
+		<div class="">
 			<label>Last Visit:</label>
 			<select name="last_visit_category" class="form-control input-sm" v-model="filters.last_visit_category">
 				<option value="">All</option>
@@ -108,9 +108,9 @@
 	</div>
 
 	<!-- NEXT APPOINTMENT -->
-	<div>
-		<div class="form-group">
-			<label>Next Appointment:</label>
+	<div class="sm-section">
+		<div class="">
+			<label>Next Appt.:</label>
 			<select name="next_appointment_category" class="form-control input-sm" v-model="filters.next_appointment_category">
 				<option value="">All</option>
 				<option value="EXACTLY">Exactly</option>
@@ -132,7 +132,7 @@
 
 	<!-- STATUS -->
 	<div class="sm-section">
-		<div class="form-group">
+		<div class="">
 			<label>Status:</label>
 			<select name="status" class="form-control input-sm" v-model="filters.status">
 				<option value="">All</option>
@@ -145,7 +145,7 @@
 
 	@if($performer->pro->pro_type == 'ADMIN')
 	<div class="sm-section">
-		<div class="form-group">
+		<div class="">
 			<label>Initiative:</label>
 			<input type="text" name="initiative" class="form-control input-sm" v-model="filters.initiative">
 		</div>
@@ -154,11 +154,11 @@
 
 	@if($performer->pro->pro_type == 'ADMIN')
 	<div class="sm-section">
-		<div class="form-group">
+		<div class="">
 			<div class="checkbox mt-4 pt-2">
-				<label>
+				<label class="text-nowrap font-weight-normal mr-2">
 					<input type="checkbox" name="include_test_records"  v-model="filters.include_test_records">
-					Include Test Records
+					Incl. Test Records
 				</label>
 			</div>
 		</div>
@@ -167,7 +167,7 @@
 
 	<!-- LAST WEIGHED-IN -->
 	<!-- <div class="col-md-2 d-none">
-		<div class="form-group">
+		<div class="">
 			<label>Last Weighed-In:</label>
 			<select name="last_weighed_in_category" class="form-control input-sm" v-model="filters.last_weighed_in_category">
 				<option value="">All</option>
@@ -190,7 +190,7 @@
 
 	<!-- LAST BP -->
 	<!-- <div class="col-md-2 d-none">
-		<div class="form-group">
+		<div class="">
 			<label>Last BP:</label>
 			<select name="last_bp_category" class="form-control input-sm" v-model="filters.last_bp_category">
 				<option value="">All</option>
@@ -212,11 +212,11 @@
 	</div> -->
 
 	<div>
-		<div class="form-group">
+		<div class="">
 			<label>&nbsp;</label>
 			<div class=" d-flex">
 				<button type="button" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
-				<a href="#" v-on:click.prevent="fastLoad('{{route('admin.patients')}}')" class="btn btn-link btn-sm text-danger">Clear Filters</a>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('admin.patients')}}')" class="btn btn-link btn-sm text-danger">Clear</a>
 			</div>
 		</div>
 	</div>

+ 1 - 1
resources/views/app/dna/DnaController.php

@@ -36,7 +36,7 @@ class DnaController extends Controller
     public function patients(Request $request)
     {
         $filters = $request->all();
-        $patients = Client::whereNull('shadow_pro_id')->where('default_na_pro_id', $this->performer->pro->id);
+        $patients = Client::whereNull('shadow_pro_id')->where('default_na_pro_id', $this->performer->pro->id)->where('client_engagement_status_category', '!=', 'NO_LONGER_INTERESTED');
 
         if ($request->input('name')) {
             $name = trim($request->input('name'));

+ 1 - 1
resources/views/app/generic-bills/add-bill-form/_default-fields.blade.php

@@ -41,7 +41,7 @@
 <div class="mb-2">
     <?php
     if(!@$maxMinutes) {
-        $maxMinutes = 240;
+        $maxMinutes = 20;
     }
     ?>
     <label for="" class="text-secondary text-sm">Minutes</label>

+ 4 - 0
resources/views/app/new-patient.blade.php

@@ -9,6 +9,10 @@ $medicaidStates = Config::get('constants.medicaid_states');
 <style media="screen">
 	.form-control {
 		border-radius: 0;
+		color: rgb(0, 54, 175);
+	}
+	.form-control:focus {
+		color: rgb(0, 54, 175);	
 	}
 </style>
 

+ 15 - 15
resources/views/app/patient/care-month/_matrix.blade.php

@@ -216,22 +216,22 @@ foreach ($days as $k => $day) {
                                     $autoCheckEntry = ($dayTotalMinutes < 2 && $patient->is_enrolled_in_rm);
                                     ?>
                                     <div class="p-2 border border-info bg-light mb-2">
+                                        <div class="mb-2">
+                                            <label class="mb-1 text-secondary text-sm">Memo</label>
+                                            <textarea class="form-control form-control-sm" name="entryMemo">measurements within range</textarea>
+                                        </div>
                                         <div class="">
                                             <label class="mb-0 d-flex align-items-center">
                                                 <input type="checkbox" class="shouldAddEntry mr-2 my-0" {{$autoCheckEntry ? 'checked' : ''}}>
                                                 <span>Add Time Entry</span>
                                             </label>
                                         </div>
-                                        <div class="mb-2">
-                                            <label class="mb-1 text-secondary text-sm">Memo</label>
-                                            <textarea class="form-control form-control-sm" name="entryMemo">measurements within range</textarea>
-                                        </div>
                                         <div class="if-adding-time-entry pt-2 d-none">
                                             <div class="mb-2">
                                                 <label class="mb-1 text-secondary text-sm">Minutes</label>
                                                 <input type="number" min="1" max="15"
                                                        class="form-control form-control-sm w-100" name="entryNumberOfMinutes"
-                                                       value="2" placeholder="Time (mins.)">
+                                                       value="1" placeholder="Time (mins.)">
                                             </div>
                                             <div class="mb-2">
                                                 <label class="mb-1 text-secondary text-sm">Date</label>
@@ -239,12 +239,12 @@ foreach ($days as $k => $day) {
                                                        name="entryDate"
                                                        value="{{date('Y-m-d', strtotime($k))}}">
                                             </div>
-                                            <div class="">
+                                            <!--<div class="">
                                                 <label class="mb-0 d-flex align-items-baseline">
                                                     <input type="checkbox" class="hasAnyoneInteractedWithClientAboutRmOutsideNote mr-2 mt-1">
                                                     <span>Has anyone interacted with client about rm outside note?</span>
                                                 </label>
-                                            </div>
+                                            </div>-->
                                         </div>
                                     </div>
                                     <div class="form-group m-0">
@@ -278,22 +278,22 @@ foreach ($days as $k => $day) {
                                     $autoCheckEntry = ($dayTotalMinutes < 2 && $patient->is_enrolled_in_rm);
                                     ?>
                                     <div class="p-2 border border-info bg-light mb-2">
+                                        <div class="mb-2">
+                                            <label class="mb-1 text-secondary text-sm">Memo</label>
+                                            <textarea class="form-control form-control-sm" name="entryMemo"></textarea>
+                                        </div>
                                         <div class="">
                                             <label class="mb-0 d-flex align-items-center">
                                                 <input type="checkbox" class="shouldAddEntry mr-2 my-0" {{$autoCheckEntry ? 'checked' : ''}}>
                                                 <span>Add Time Entry</span>
                                             </label>
                                         </div>
-                                        <div class="mb-2">
-                                            <label class="mb-1 text-secondary text-sm">Memo</label>
-                                            <textarea class="form-control form-control-sm" name="entryMemo"></textarea>
-                                        </div>
                                         <div class="if-adding-time-entry pt-2 d-none">
                                             <div class="mb-2">
                                                 <label class="mb-1 text-secondary text-sm">Minutes</label>
                                                 <input type="number" min="1" max="15"
                                                        class="form-control form-control-sm w-100" name="entryNumberOfMinutes"
-                                                       value="2" placeholder="Time (mins.)">
+                                                       value="1" placeholder="Time (mins.)">
                                             </div>
                                             <div class="mb-2">
                                                 <label class="mb-1 text-secondary text-sm">Date</label>
@@ -301,12 +301,12 @@ foreach ($days as $k => $day) {
                                                        name="entryDate"
                                                        value="{{date('Y-m-d', strtotime($k))}}">
                                             </div>
-                                            <div class="">
+                                            <!--<div class="">
                                                 <label class="mb-0 d-flex align-items-baseline">
                                                     <input type="checkbox" class="hasAnyoneInteractedWithClientAboutRmOutsideNote mr-2 mt-1">
                                                     <span>Has anyone interacted with client about rm outside note?</span>
                                                 </label>
-                                            </div>
+                                            </div>-->
                                         </div>
                                     </div>
                                     <div class="form-group m-0">
@@ -366,7 +366,7 @@ foreach ($days as $k => $day) {
                                         </div>
                                         <div class="col-4">
                                             <input type="number" min="0" max="15" class="form-control form-control-sm w-100 cm-time-value" name="timeInMinutes"
-                                                   value="2" placeholder="Time (mins.)" required>
+                                                   value="1" placeholder="Time (mins.)" required>
                                         </div>
                                     </div>
                                 </div>

+ 352 - 159
resources/views/app/patient/care-month/dashboard.blade.php

@@ -289,171 +289,366 @@
         <div class="row mb-3">
             <div class="col-12">
                 <div class="mt-0">
-                    <div class="d-flex align-items-center mb-2">
-                        <h6 class="my-0 font-weight-bold text-dark">Measurements</h6>
-                        <span class="mx-2 text-secondary">|</span>
-                        <div moe>
-                            <a start show class="py-0 font-weight-normal">Add</a>
-                            <form url="/api/measurement/create">
-                                <input type="hidden" name="clientUid" value="{{ $patient->uid }}">
-                                <div class="mb-2">
-                                    <input required autofocus type="text" class="form-control form-control-sm" name="label" value="" placeholder="Type">
-                                </div>
-                                <div class="mb-2">
-                                    <input required type="text" class="form-control form-control-sm" name="value" value="" placeholder="Value">
-                                </div>
-                                <div class="mb-2">
-                                    <input required type="date" class="form-control form-control-sm" name="effectiveDate" max="{{ date('Y-m-d') }}" value="{{ date('Y-m-d') }}">
-                                </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 class="mb-2">
+                        <h6 class="mb-3 font-weight-bold text-dark">Measurements</h6>
+                        <div class="row mb-3">
+                            <div class="col-9">
+                                <div class="d-flex align-items-baseline mb-3" tab-links>
+                                    <a class="tab-link-active" href="#" tab-link="measurements-calendar">Calendar</a>
+                                    <a class="" href="#" tab-link="measurements-graph">Graph</a>
                                 </div>
-                            </form>
-                        </div>
-                        @if(0 && $pro->pro_type === 'ADMIN')
-                            <span class="mx-2 text-secondary">|</span>
-                            <div moe>
-                                <a start show class="py-0 font-weight-normal text-secondary">+ BP BDT Measurement</a>
-                                <form url="/api/bdtMeasurement/create">
-                                    <div class="mb-2">
-                                        <input autofocus type="text" class="form-control form-control-sm" name="imei" value="987987987983" placeholder="imei">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="ts" value="1600727786754" placeholder="ts">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="batteryVoltage" value="6308" placeholder="batteryVoltage">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="signalStrength" value="85" placeholder="signalStrength">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueTare" value="" placeholder="valueTare">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueWeight" value="" placeholder="valueWeight">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueSystolic" value="20700" placeholder="valueSystolic">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueDiastolic" value="9700" placeholder="valueDiastolic">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valuePulse" value="64" placeholder="valuePulse">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueUnit" value="" placeholder="valueUnit">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueIrregular" value="0" placeholder="valueIrregular">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="rssi" value="71" placeholder="rssi">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="deviceId" value="86011204403081" placeholder="deviceId">
+
+                                <div class="cm-tab" tab-key="measurements-calendar">
+                                    <div id="caremonth-measurements-calendar-{{$calendarID}}" class="caremonth-measurements-calendar">
+
                                     </div>
-                                    <input type="hidden" name="secret" value="LTZS20QAFE">
-                                    <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 class="d-none cm-tab border pr-4" tab-key="measurements-graph">
+                                    <link href="/c3/c3.min.css" rel="stylesheet">
+                                    <script src="/c3/d3.v5.min.js" charset="utf-8"></script>
+                                    <script src="/c3/c3.min.js"></script>
+
+                                    <div id="vitalsGraphComponent" class="stag-chart mb-4 pt-3">
+                                        <h4 class="font-weight-bold mb-1 text-secondary font-size-14 text-center">Blood Pressure</h4>
+                                        <div id="bp-chart" class="mb-4">BP Graph</div>
+                                        <hr class="my-3">
+                                        <h4 class="font-weight-bold mb-1 text-secondary font-size-14 text-center">Weight</h4>
+                                        <div id="weight-chart">Weight Graph</div>
                                     </div>
-                                </form>
+
+                                    <?php
+                                    $dates = [];
+                                    $startDate = $careMonth->start_date;
+                                    $nextMonthFirstDay = date_format(date_add(date_create($startDate), date_interval_create_from_date_string("1 month")), 'Y-m-d');
+
+                                    $nextDay = $startDate;
+                                    while ($nextDay !== $nextMonthFirstDay) {
+                                        $dates[] = $nextDay;
+                                        $nextDay = date_format(date_add(date_create($nextDay), date_interval_create_from_date_string('1 day')), 'Y-m-d');
+                                    }
+
+                                    /** @var \App\Models\Client $patient */
+
+                                    // BP
+                                    $bpMeasurements = $patient->getNonZeroBpMeasurements->toArray();
+                                    $weightMeasurements = $patient->getNonZeroWeightMeasurements->toArray();
+
+                                    $bpData = [];
+                                    $weightData = [];
+
+                                    for ($i=0; $i<count($dates); $i++) {
+
+                                        $date = $dates[$i];
+
+                                        // bp
+                                        $bp = array_filter($bpMeasurements, function($_measurement) use ($date) {
+                                            return $_measurement['effective_date'] === $date;
+                                        });
+                                        if(count($bp)) {
+                                            $bp = array_values($bp);
+                                            $bp = $bp[count($bp) - 1];
+                                        }
+                                        else {
+                                            $bp = null;
+                                        }
+
+
+                                        if ($bp) {
+                                            $bpData[] = [
+                                                "date" => $date,
+                                                "sbp" => $bp["sbp_mm_hg"],
+                                                "dbp" => $bp["dbp_mm_hg"]
+                                            ];
+                                        }
+
+                                        // weight
+                                        $weight = array_filter($weightMeasurements, function($_measurement) use ($date) {
+                                            return $_measurement['effective_date'] === $date;
+                                        });
+                                        if(count($weight)) {
+                                            $weight = array_values($weight);
+                                            $weight = $weight[count($weight) - 1];
+                                            $weightData[] = [
+                                                "date" => $date,
+                                                "weight" => $weight["numeric_value"]
+                                            ];
+                                        }
+
+                                    }
+
+                                    $bpDates = [];
+                                    $sbpValues = [];
+                                    $dbpValues = [];
+                                    for ($i = 0; $i < count($bpData); $i++) {
+                                        $bpDates[] = $bpData[$i]['date'];
+                                        $sbpValues[] = $bpData[$i]['sbp'];
+                                        $dbpValues[] = $bpData[$i]['dbp'];
+                                    }
+
+                                    $weightDates = [];
+                                    $weightValues = [];
+                                    for ($i = 0; $i < count($weightData); $i++) {
+                                        $weightDates[] = $weightData[$i]['date'];
+                                        $weightValues[] = $weightData[$i]['weight'];
+                                    }
+
+                                    ?>
+
+                                    <script>
+                                        (function() {
+                                            function init() {
+                                                bpChart();
+                                                weightChart();
+                                            }
+                                            function bpChart() {
+                                                window.vgBPChart = c3.generate({
+                                                    bindto: '#bp-chart',
+                                                    data: {
+                                                        x: 'x',
+                                                        // xFormat: '%Y%m%d', // 'xFormat' can be used as custom format of 'x'
+                                                        columns: [
+                                                            ['x', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $bpDates)) ?>],
+                                                            ['Systolic BP', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $sbpValues)) ?>],
+                                                            ['Diastolic BP', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $dbpValues)) ?>]
+                                                        ]
+                                                    },
+                                                    axis: {
+                                                        x: {
+                                                            type: 'timeseries',
+                                                            tick: {
+                                                                format: '%Y-%m-%d',
+                                                                multiline: true,
+                                                                fit: true,
+                                                                rotate: -45
+                                                            },
+                                                        },
+                                                        y: {
+                                                            show: true,
+                                                            label: {
+                                                                text: 'Blood Pressure (mmHg)',
+                                                                position: 'outer-middle'
+                                                            },
+                                                            min: 60,
+                                                            max: 220
+                                                        },
+                                                    },
+                                                    regions: [
+                                                        {axis: 'y', start: 100, end: 130, class: 'safe-region', label: 'Safe Systolic BP: 100 to 130 mmHg'},
+                                                        {axis: 'y', start: 60, end: 90, class: 'safe-region', label: 'Safe Diastolic BP: 60 to 90 mmHg'}
+                                                    ]
+                                                });
+                                            }
+                                            function weightChart() {
+                                                window.vgWtChart = c3.generate({
+                                                    bindto: '#weight-chart',
+                                                    data: {
+                                                        x: 'x',
+                                                        columns: [
+                                                            ['x', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $weightDates)) ?>],
+                                                            ['Weight', <?= implode(", ", array_map(function($_x) { return "'" . $_x . "'"; }, $weightValues)) ?>]
+                                                        ]
+                                                    },
+                                                    axis: {
+                                                        x: {
+                                                            type: 'timeseries',
+                                                            tick: {
+                                                                format: '%Y-%m-%d',
+                                                                multiline: true,
+                                                                fit: true,
+                                                                rotate: -45
+                                                            },
+                                                        },
+                                                        y: {
+                                                            show: true,
+                                                            label: {
+                                                                text: 'Weight (lbs)',
+                                                                position: 'outer-middle'
+                                                            },
+                                                            min: 70,
+                                                            max: 250
+                                                        },
+                                                    },
+                                                    regions: [
+                                                        // {axis: 'y', start: 100, end: 140, class: 'safe-region', label: 'Safe Weight: 100 to 140 lbs'},
+                                                    ]
+                                                });
+                                            }
+                                            addMCInitializer('vitalsGraph', init, '#vitalsGraphComponent');
+                                        }).call(window);
+                                    </script>
+                                </div>
                             </div>
-                            <span class="mx-2 text-secondary">|</span>
-                            <div moe>
-                                <a start show class="py-0 font-weight-normal text-secondary">+ Weight BDT Measurement</a>
-                                <form url="/api/bdtMeasurement/create">
-                                    <div class="mb-2">
-                                        <input autofocus type="text" class="form-control form-control-sm" name="imei" value="987987987984" placeholder="imei">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="ts" value="1600727786754" placeholder="ts">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="batteryVoltage" value="6308" placeholder="batteryVoltage">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="signalStrength" value="85" placeholder="signalStrength">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueTare" value="0" placeholder="valueTare">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueWeight" value="61400" placeholder="valueWeight">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueSystolic" value="" placeholder="valueSystolic">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueDiastolic" value="" placeholder="valueDiastolic">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valuePulse" value="" placeholder="valuePulse">
-                                    </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueUnit" value="1" placeholder="valueUnit">
+                            <div class="col-3 px-0">
+
+                                <div class="mt-2">
+                                    <?php $daysDiff = -1; ?>
+                                    @if($patient->most_recent_completed_mcp_note_date)
+                                        <?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;
+                                        ?>
+                                    @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)}}
+                                        @if($daysDiff !== -1)
+                                            @if($daysDiff > 90)
+                                                <i class="fa fa-exclamation-triangle"></i>
+                                                <span class="ml-1 text-secondary text-sm font-weight-normal">({{$daysDiff}} days ago)</span>
+                                            @else
+                                                <i class="fa fa-check"></i>
+                                            @endif
+                                        @endif
+                                    </b>
+                                </div>
+
+                                <div class="mt-2">
+                                    <span class="font-weight-bold text-secondary">Days with meas.:</span>
+                                    <b class="{{$careMonth->number_of_days_with_remote_measurements >= 16 ? 'text-success' : 'text-warning-mellow'}}">
+                                        {{$careMonth->number_of_days_with_remote_measurements}}
+                                        @if($careMonth->number_of_days_with_remote_measurements >= 16)
+                                            <i class="fa fa-check"></i>
+                                        @else
+                                            <i class="fa fa-exclamation-triangle"></i>
+                                        @endif
+                                        <span class="ml-1 text-secondary text-sm font-weight-normal">(16 needed)</span>
+                                    </b>
+                                    @if($careMonth->number_of_days_with_remote_measurements < 16)
+                                        <div moe relative class="ml-2">
+                                            <a href="#" start show class="text-sm">SMS Patient</a>
+                                            <form url="/api/clientSms/createOutgoing" right="" class="mcp-theme-1" noreload="" style="display: none;">
+                                                <input type="hidden" name="uid" value="{{ $patient->uid }}">
+                                                <div class="mb-2">
+                                                    <label for="" class="text-sm text-secondary mb-1">Cell Number</label>
+                                                    <input type="text" class="form-control form-control-sm" name="cellNumber" value="{{$patient->cell_number}}">
+                                                </div>
+                                                <div class="mb-2">
+                                                    <label for="" class="text-sm text-secondary mb-1">Message</label>
+                                                    <textarea rows="5" class="form-control form-control-sm" name="message">Please use your weight-scale and BP meter more often to stay safe during this pandemic! Leadership Health.</textarea>
+                                                </div>
+                                                <div class="d-flex align-items-center">
+                                                    <button class="btn btn-sm btn-primary mr-2" submit="">Send</button>
+                                                    <button class="btn btn-sm btn-default mr-2 border" cancel="">Cancel</button>
+                                                </div>
+                                            </form>
+                                        </div>
+                                    @endif
+                                </div>
+                                @if($careMonth->number_of_days_with_remote_measurements < 16)
+                                    <div class="alert alert-warning p-2 mt-1">
+                                        Need <b>{{16 - $careMonth->number_of_days_with_remote_measurements}} more days</b> with measurements before RM becomes billable.
                                     </div>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="valueIrregular" value="" placeholder="valueIrregular">
+                                @endif
+
+                                <div class="mt-2">
+                                    <?php $spoken = $careMonth->has_anyone_interacted_with_client_about_rm_outside_note; ?>
+                                    <span class="font-weight-bold text-secondary">MCP spoke to patient:</span>
+                                    <b class="{{$spoken ? 'text-success' : 'text-warning-mellow'}}">
+                                        {{$spoken ? 'Yes' : 'No'}}
+                                        @if(!$spoken)
+                                            <i class="fa fa-exclamation-triangle"></i>
+                                        @else
+                                            <i class="fa fa-check"></i>
+                                        @endif
+                                    </b>
+                                    @if($careMonth->mcp && $pro->id === $careMonth->mcp->id)
+                                        <div moe relative class="ml-2">
+                                            <a href="#" start show class="text-sm">Toggle</a>
+                                            <form url="/api/careMonth/setHasAnyoneInteractedWithClientAboutRmOutsideNoteTo{{$spoken ? 'False' : 'True'}}" right>
+                                                <input type="hidden" name="uid" value="{{$careMonth->uid}}">
+                                                <p>Set to {{$spoken ? 'No' : 'Yes'}}?</p>
+                                                <div class="d-flex align-items-center">
+                                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
+                                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                                </div>
+                                            </form>
+                                        </div>
+                                    @endif
+                                </div>
+
+                                <div class="mt-2">
+                                    <?php
+                                    $minsBilled = 0;
+                                    if($careMonth->mcp && $pro->id === $careMonth->mcp->id) {
+                                        $minsBilled = $careMonth->rm_total_time_in_seconds_by_mcp;
+                                    }
+                                    elseif($careMonth->rmm && $pro->id === $careMonth->rmm->id) {
+                                        $minsBilled = $careMonth->rm_total_time_in_seconds_by_rmm_pro;
+                                    }
+                                    elseif($careMonth->rme && $pro->id === $careMonth->rme->id) {
+                                        $minsBilled = $careMonth->rm_total_time_in_seconds_by_rme_pro;
+                                    }
+                                    $minsBilled = floor($minsBilled / 60);
+                                    ?>
+                                    <span class="font-weight-bold text-secondary">Mins. I have billed:</span>
+                                    <b class="{{$minsBilled >= 20 ? 'text-success' : 'text-warning-mellow'}}">
+                                        {{$minsBilled}}
+                                        @if($minsBilled < 20)
+                                            <i class="fa fa-exclamation-triangle"></i>
+                                        @else
+                                            <i class="fa fa-check"></i>
+                                        @endif
+                                        <span class="ml-1 text-secondary text-sm font-weight-normal">(20 needed)</span>
+                                    </b>
+                                    <div moe relative class="ml-2">
+                                        <a href="#" start show class="text-sm">+ Entry</a>
+                                        <form url="/api/careMonthEntry/createForRm" right>
+                                            <input type="hidden" name="careMonthUid" value="{{$careMonth->uid}}">
+                                            <input type="hidden" name="proUid" value="{{$pro->uid}}">
+                                            <div class="mb-2">
+                                                <label class="mb-1 text-secondary">Effective Date *</label>
+                                                <input type="date" value="{{date('Y-m-d')}}"
+                                                       class="form-control form-control-sm" name="effectiveDate"
+                                                       required>
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="mb-1 text-secondary">Time (mins) *</label>
+                                                <input autofocus type="number"
+                                                       class="form-control form-control-sm" name="timeInMinutes"
+                                                       required>
+                                            </div>
+                                            <div class="mb-2">
+                                                <label class="mb-1 text-secondary">Memo</label>
+                                                <textarea class="form-control form-control-sm" name="contentText"
+                                                          placeholder="" rows="2"></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>
-                                    <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="rssi" value="78" placeholder="rssi">
+                                </div>
+
+                                @if(($daysDiff !== -1 && $daysDiff <= 90) &&
+                                    $careMonth->number_of_days_with_remote_measurements >= 16 &&
+                                    $careMonth->has_anyone_interacted_with_client_about_rm_outside_note &&
+                                    $minsBilled >= 20)
+                                    <div class="mt-2 border border-info p-2">
+                                        @include('app.rm-bills.inline', ['patient' => $patient, 'entityType' => 'CareMonth', 'entityUid' => $careMonth->uid, 'label' => 'RM'])
                                     </div>
+                                @endif
+
+                                <div class="mt-2">
+                                    {{-- rm reasons --}}
                                     <div class="mb-2">
-                                        <input type="text" class="form-control form-control-sm" name="deviceId" value="86528404866623" placeholder="deviceId">
-                                    </div>
-                                    <input type="hidden" name="secret" value="LTZS20QAFE">
-                                    <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>
+                                        @include('app/patient/care-month/rm-reasons')
                                     </div>
-                                </form>
-                            </div>
-                        @endif
-                    </div>
-                    <div class="row mb-3 d-none">
-                        <div class="col-9">
-                            <div id="caremonth-measurements-calendar-{{$calendarID}}" class="caremonth-measurements-calendar">
-
-                            </div>
-                        </div>
-                        <div class="col-3">
-                            <span class="font-size-14">
-                                Days with measurements: <b class="font-size-14 {{$careMonth->number_of_days_with_remote_measurements >= 16 ? 'text-success' : 'text-warning-mellow'}}">
-                                    {{$careMonth->number_of_days_with_remote_measurements}}
-                                    @if($careMonth->number_of_days_with_remote_measurements >= 16)
-                                        <i class="fa fa-check font-size-13"></i>
-                                    @else
-                                        <i class="fa fa-exclamation-triangle font-size-13"></i>
-                                    @endif
-                                    <span class="ml-1 text-secondary text-sm font-weight-normal">(16 needed)</span>
-                                </b>
-                            </span>
-                            @if($careMonth->number_of_days_with_remote_measurements < 16)
-                                <div class="alert alert-warning p-2 mt-3">
-                                    Need <b>{{16 - $careMonth->number_of_days_with_remote_measurements}} more days</b> with measurements before RM becomes billable.
                                 </div>
-                            @endif
 
-                            <div>
-                                {{-- rm reasons --}}
                                 <div class="mb-2">
-                                    @include('app/patient/care-month/rm-reasons')
-                                </div>
-                            </div>
-
-                            <div class="mb-2">
-                                @if($careMonth->rmBill && $careMonth->rmBill->code != 'RMB')
-                                    @if(true && 'TODO Check if MCP and echo as needed for rme/rmm')
+                                    @if($careMonth->rmBill && $careMonth->rmBill->code != 'RMB')
+                                        @if(true && 'TODO Check if MCP and echo as needed for rme/rmm')
 
+                                        @endif
+                                        @if($performer->pro->id == $careMonth->mcp_pro_id)
+                                            Reimbursement: {{ $careMonth->rmBill->hcp_payment_amount }}
+                                        @endif
                                     @endif
-                                    @if($performer->pro->id == $careMonth->mcp_pro_id)
-                                        Reimbursement: {{ $careMonth->rmBill->hcp_payment_amount }}
-                                    @endif
-                                @endif
+                                </div>
                             </div>
                         </div>
                     </div>
@@ -571,9 +766,9 @@
                                 }
                                 $measurement->title = '';
                                 if ($measurement->label === 'BP') {
-                                    $measurement->title .= 'BP ' . $measurement->sbp_mm_hg . '/' . $measurement->dbp_mm_hg . ' mmHg';
+                                    $measurement->title .= 'BP ' . $measurement->sbp_mm_hg . '/' . $measurement->dbp_mm_hg . '';
                                 } elseif ($measurement->label === 'Wt. (lbs.)') {
-                                    $measurement->title .= 'Weight ' . round(floatval($measurement->numeric_value), 2) . ' lbs';
+                                    $measurement->title .= 'Wt ' . round(floatval($measurement->numeric_value), 2) . '';
                                 } else {
                                     $measurement->title .= $measurement->value;
                                 }
@@ -1472,8 +1667,8 @@
 
 
 
-            {{-- bills --}}
-            @if($pro->pro_type === 'ADMIN' || ($careMonth->mcp && $pro->id === $careMonth->mcp->id && false))
+            {{-- bills --}} {{-- only admins --}}
+            @if($pro->pro_type === 'ADMIN')
                 @if($careMonth->bills->count())
                     <div class="">
                         <div class="d-flex align-items-center mb-2">
@@ -1906,12 +2101,10 @@
                         @include('app/patient/care-month/_create-bill')
                     </div>
                 @endif
+                <hr class="m-negator mt-4 mb-3">
             @endif
 
-
-            <hr class="m-negator mt-4 mb-3">
-
-            {{-- claims --}}
+            {{-- claims --}} {{-- only admins --}}
             @if($pro->pro_type === 'ADMIN')
                 @if($careMonth->claims->count())
                     <div class="">

+ 2 - 2
resources/views/app/patient/care-month/rm-reasons.blade.php

@@ -11,8 +11,8 @@
                     <div class="border-bottom pb-1 mb-1 d-flex align-items-start">
                         <b class="width-90px">{{$reason->code}}</b>
                         <span class="width-200px">{{$reason->description}}</span>
-                        <div moe>
-                            <a start show>Edit</a>
+                        <div moe class="ml-3">
+                            <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
                             <form url="/api/careMonthCmRmReason/updateBasic" class="mcp-theme-1">
                                 <input type="hidden" name="uid" value="{{$reason->uid}}">
                                 <div class="mb-2">

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

@@ -741,6 +741,7 @@ GROUP BY erx_category");
                             };
                             $.post('/api/erx/create', payload, _data => {
                                 if(!hasResponseError(_data)) {
+                                    localStorage.autoOpenNewestPrescription = 1;
                                     fastReload();
                                 }
                             }, 'json');
@@ -1565,11 +1566,14 @@ GROUP BY erx_category");
 
                     // auto select latest prescription (if no current is set)
                     Vue.nextTick(() => {
-                        if(!this.currentPrescription) {
-                            for(let x in this.prescriptions) {
-                                this.currentPrescription = this.prescriptions[x];
-                                break;
+                        if(+localStorage.autoOpenNewestPrescription) {
+                            if(!this.currentPrescription) {
+                                for(let x in this.prescriptions) {
+                                    this.currentPrescription = this.prescriptions[x];
+                                    break;
+                                }
                             }
+                            localStorage.autoOpenNewestPrescription = 0;
                         }
                     });
 

+ 1 - 1
resources/views/app/patient/vitals-graph.blade.php

@@ -10,7 +10,7 @@
         <?php
         $months = [];
         $monthNames = [];
-        for ($i=6; $i>=0; $i--) {
+        for ($i=24; $i>=0; $i--) {
             $m = date_sub(date_create(), date_interval_create_from_date_string($i . " month" . ($i === 1 ? '' : 's')));
             $monthNames[] = date_format($m, "M, Y");
             $months[] = date_format($m, "Y-m-01");

+ 77 - 0
resources/views/app/rm-bills/add-bill-form/Note.blade.php

@@ -0,0 +1,77 @@
+<?php $genericPro = @$note && $note->allyPro ? $note->allyPro : $pro; ?>
+<?php $genericRates = $genericPro->genericRates(); ?>
+<?php $genericCompanyPro = $genericPro->defaultCompanyPro; ?>
+
+{{-- if no defaultCompanyPro on this pro, STOP --}}
+@if(!$genericPro->defaultCompanyPro)
+    <form url="/api/bill/createForGeneric">
+        <div class="border rounded bg-aliceblue p-2 text-nowrap">
+            <div class="mb-2 font-weight-bold">
+                <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+                Cannot create bill!
+            </div>
+            Default company pro is not set.
+        </div>
+    </form>
+@else
+    {{-- if no generic rates for this pro, STOP --}}
+    @if(!$genericRates || !count($genericRates))
+        <form url="/api/bill/createForGeneric">
+            <div class="border rounded bg-aliceblue p-2 text-nowrap">
+                <div class="mb-2 font-weight-bold">
+                    <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+                    Cannot create bill!
+                </div>
+                No admin. rates found for pro.
+            </div>
+        </form>
+    @else
+
+<form url="/api/bill/createForGeneric">
+    @if(hasActiveGenericBill($genericPro, @$patient, @$entityType, @$entityUid))
+        <div class="border rounded bg-aliceblue p-2 width-200px d-flex align-items-baseline">
+            <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+            <span>An uncancelled NA bill already exists for this note!</span>
+        </div>
+    @elseif($note && !$note->hasTreatmentServicesBillByHCP())
+        <div class="border rounded bg-aliceblue p-2 width-200px d-flex align-items-baseline">
+            <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+            <span>Pending HCP Signing of Treatment Services</span>
+        </div>
+    @else
+        @include('app.generic-bills.add-bill-form._default-fields')
+        <div class="mb-2 border px-2 pt-2 generic-bill-actions">
+            <p class="text-sm mb-1 text-secondary font-weight-bold">Please indicate the activities time was spent on:</p>
+            <input type="text" name="genericDescription" value="" class="zero-height-field m-0 p-0 border-0" required>
+            <label class="d-flex align-items-baseline">
+                <input type="checkbox" class="mr-2 my-0 generic-bill-action"
+                       data-action="Note reviewed."
+                       onchange="return updateGenericBillAction(this)">
+                <span>Note reviewed.</span>
+            </label>
+            <label class="d-flex align-items-baseline">
+                <input type="checkbox" class="mr-2 my-0 generic-bill-action"
+                       data-action="Care coordinated."
+                       onchange="return updateGenericBillAction(this)">
+                <span>Care coordinated.</span>
+            </label>
+            <label class="d-flex align-items-baseline">
+                <input type="checkbox" class="mr-2 my-0 generic-bill-action"
+                       data-action="Admin. support for follow-up."
+                       onchange="return updateGenericBillAction(this)">
+                <span>Admin. support for follow-up.</span>
+            </label>
+            <label class="d-flex align-items-baseline">
+                <input type="checkbox" class="mr-2 my-0 generic-bill-action"
+                       data-action="Provided Patient w/ Visit-Related Education."
+                       onchange="return updateGenericBillAction(this)">
+                <span>Provided Patient w/ Visit-Related Education.</span>
+            </label>
+        </div>
+        @include('app.generic-bills.add-bill-form._default-actions')
+    @endif
+</form>
+@include('app.generic-bills.add-bill-form._default-script')
+
+    @endif
+@endif

+ 4 - 0
resources/views/app/rm-bills/add-bill-form/_default-actions.blade.php

@@ -0,0 +1,4 @@
+<div class="">
+    <button class="btn btn-primary btn-sm" submit>Submit</button>
+    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+</div>

+ 68 - 0
resources/views/app/rm-bills/add-bill-form/_default-fields.blade.php

@@ -0,0 +1,68 @@
+@if($pro && $pro->pro_type === 'ADMIN')
+    <div class="mb-2 min-width-300px">
+        <label for="" class="text-secondary text-sm">Company Pro</label>
+        <div class="p-2 border bg-light rounded">{{$genericCompanyPro->pro->displayName()}} / {{$genericCompanyPro->company->name}}</div>
+    </div>
+@endif
+<input type="hidden" name="genericCompanyProUid" value="{{$genericCompanyPro->uid}}">
+@if(@$note)
+    <input type="hidden" name="optionalNoteUid" value="{{$note->uid}}">
+@endif
+@if(@$patient)
+    <input type="hidden" name="optionalClientUid" value="{{$patient->uid}}">
+@endif
+@if(@$entityType)
+    <input type="hidden" name="genericTargetEntityType" value="{{$entityType}}">
+@endif
+@if(@$entityUid)
+    <input type="hidden" name="genericTargetEntityUid" value="{{$entityUid}}">
+@endif
+@if(count($genericRates) === 1)
+    <input type="hidden" name="code"
+           data-entity-type="{{$entityType}}"
+           data-amount="{{ $genericRates[0]->amount }}"
+           value="{{$genericRates[0]->code}}">
+    <p class="mb-2">Service: <br><b>{{ $genericRates[0]->code }} (${{ $genericRates[0]->amount }}/hr)</b></p>
+@else
+    <div class="mb-2">
+        <label for="" class="text-secondary text-sm">Service</label>
+        <select autofocus class="form-control" name="code"
+                data-entity-type="{{$entityType}}"
+                onchange="switchGenericRate(this)">
+            <option value="">-- Select Code --</option>
+            @foreach($genericPro->genericRates() as $genericRate)
+                <option data-amount="{{ $genericRate->amount }}" value="{{ $genericRate->code }}">
+                    {{ $genericRate->code }} (${{ $genericRate->amount }})
+                </option>
+            @endforeach
+        </select>
+    </div>
+@endif
+<div class="mb-2">
+    <?php
+    if(!@$maxMinutes) {
+        $maxMinutes = 240;
+    }
+    ?>
+    <label for="" class="text-secondary text-sm">Minutes</label>
+    <div class="mb-2">
+        <select name="numberOfUnits" class="form-control form-control-sm"
+                onchange="calculateGenericBillAmount(this)">
+            <option value=""> -- select -- </option>
+            <?php for ($i = 5; $i <= $maxMinutes; $i+=5) { ?>
+            <option value="{{ $i/60 }}">{{ $i }} minutes</option>
+            <?php } ?>
+        </select>
+    </div>
+    <div class="mb-2" calculated-generic-amount></div>
+</div>
+@if($entityType !== 'Note')
+    <div class="mb-2">
+        <label for="" class="text-secondary text-sm">Description</label>
+        <input type="text" name="genericDescription" class="form-control form-control-sm" value="">
+    </div>
+@endif
+<div class="mb-2">
+    <label for="" class="text-secondary text-sm">Effective Date</label>
+    <input type="date" name="effectiveDate" class="form-control form-control-sm" value="{{date('Y-m-d')}}" required>
+</div>

+ 79 - 0
resources/views/app/rm-bills/add-bill-form/_default-script.blade.php

@@ -0,0 +1,79 @@
+<script>
+    (function() {
+        function init() {
+            let selectedGenericRate = 0;
+            window.switchGenericRate = function (_trigger) {
+                selectedGenericRate = 0;
+                if ($(_trigger).find('option:selected').first().length) {
+                    selectedGenericRate = +($(_trigger).find('option:selected').first().attr('data-amount'));
+                }
+                $(_trigger).closest('form').find('[name="numberOfUnits"]').val('');
+
+                @if($genericRates && count($genericRates) && count($genericRates) === 1)
+                    selectedGenericRate = {{ $genericRates[0]->amount }};
+                @endif
+
+                // max num units to limit at $15
+                if ($(_trigger).attr('data-entity-type') === 'Note') {
+                    let maxNABillableAmount = 30,
+                        amountPer5Minutes = selectedGenericRate / 12,
+                        maxNumberOf5Minutes = Math.ceil(maxNABillableAmount / amountPer5Minutes),
+                        maxHours = (maxNumberOf5Minutes * 5) / 60,
+                        unitsSelect = $(_trigger).closest('form').find('[name="numberOfUnits"]');
+
+                    // CRITERIA TO BILL UP TO 60 MINS. is note.hcp_pro_id == client.mcp_pro_id AND note.wasCmSetupPerformed IS TRUE
+                    $('.cm-setup-alert').remove();
+                    @if(@$note && @$patient && $note->hcp_pro_id === $patient->mcp_pro_id && $note->was_cm_setup_performed)
+                    maxHours = 1;
+                    @endif
+                    @if(@$note && @$patient && $note->hcp_pro_id === $patient->mcp_pro_id && !$note->was_cm_setup_performed)
+                    $('<div/>')
+                        .addClass('alert alert-warning my-2 cm-setup-alert border border-warning p-2')
+                        .html('<div class="mb-2">CCM setup may have been performed, but has not been marked as such in the note.</div>' +
+                            'Please ask the HCP if they need to do that, and then you can bill up to 60 mins. because patient needs education re: CM')
+                        .insertAfter(unitsSelect);
+                    @endif
+
+                    unitsSelect.find('option').each(function () {
+                        if (this.value) {
+                            if (+this.value > maxHours) {
+                                $(this).hide();
+                            }
+                            else {
+                                $(this).show();
+                            }
+                        }
+                        else {
+                            $(this).show();
+                        }
+                    });
+                }
+
+                calculateGenericBillAmount($(_trigger).closest('form').find('[name="numberOfUnits"]'));
+            };
+            window.calculateGenericBillAmount = function (_trigger) {
+                _trigger = $(_trigger);
+                let amountTarget = _trigger.closest('form').find('[calculated-generic-amount]');
+                if (!_trigger.find('option:selected').length) {
+                    amountTarget.text('');
+                    return;
+                }
+                let hours = +_trigger.find('option:selected').attr('value'),
+                    reimbursable = hours * selectedGenericRate;
+                if (isNaN(reimbursable)) reimbursable = 0;
+                amountTarget.html('<b>Reimbursable:</b> $' + reimbursable.toFixed(2));
+            };
+            window.updateGenericBillAction = function (_trigger) {
+                let actions = [];
+                $(_trigger).closest('.generic-bill-actions').find('.generic-bill-action:checked').each(function () {
+                    actions.push($(this).attr('data-action'));
+                });
+                $(_trigger).closest('.generic-bill-actions').find('[name="genericDescription"]').val(actions.join("<br>"));
+            };
+            @if($genericRates && count($genericRates) && count($genericRates) === 1)
+            switchGenericRate($('[name="code"][data-entity-type]'));
+            @endif
+        }
+        addMCInitializer('init-generic-add-bill', init);
+    }).call(window);
+</script>

+ 37 - 0
resources/views/app/rm-bills/add-bill-form/default.blade.php

@@ -0,0 +1,37 @@
+<?php $genericPro = @$note && $note->allyPro ? $note->allyPro : $pro; ?>
+<?php $genericRates = $genericPro->genericRates(); ?>
+<?php $genericCompanyPro = $genericPro->defaultCompanyPro; ?>
+
+{{-- if no defaultCompanyPro on this pro, STOP --}}
+@if(!$genericCompanyPro)
+    <form url="/api/bill/createForGeneric">
+        <div class="border rounded bg-aliceblue p-2 text-nowrap">
+            <div class="mb-2 font-weight-bold">
+                <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+                Cannot create bill!
+            </div>
+            Default company pro is not set.
+        </div>
+    </form>
+@else
+    {{-- if no generic rates for this pro, STOP --}}
+    @if(!$genericRates || !count($genericRates))
+        <form url="/api/bill/createForGeneric">
+            <div class="border rounded bg-aliceblue p-2 text-nowrap">
+                <div class="mb-2 font-weight-bold">
+                    <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
+                    Cannot create bill!
+                </div>
+                No admin. rates found for pro.
+            </div>
+        </form>
+    @else
+        <form url="/api/bill/createForGeneric" right>
+            <p class="mb-2 font-weight-bold">Create RM Bill</p>
+            @include('app.generic-bills.add-bill-form._default-fields')
+            @include('app.generic-bills.add-bill-form._default-actions')
+        </form>
+        @include('app.generic-bills.add-bill-form._default-script')
+    @endif
+@endif
+

+ 71 - 0
resources/views/app/rm-bills/context.blade.php

@@ -0,0 +1,71 @@
+<?php
+switch ($bill->generic_target_entity_type) {
+    case 'Ticket':
+        $ticket = \App\Models\Ticket::where('uid', $bill->generic_target_entity_uid)->first();
+        ?>
+        <div class="mb-1">Ticket > {{strtoupper($ticket->category)}}
+            <a class="ml-2"
+               native target="_blank"
+               open-in-stag-popup
+               mc-initer="patient-tickets"
+               popup-style="tall"
+               title="Ticket Details"
+               href="/patients/view/{{$ticket->patient->uid}}/tickets/{{$ticket->category}}/{{$ticket->uid}}">
+                View
+            </a>
+        </div>
+        <div class="pl-3 text-sm">
+            <div class="text-secondary mb-1">Patient: <a href="{{route('patients.view.dashboard', ['patient' => $ticket->patient])}}">{{$ticket->patient->displayName()}}</a></div>
+            <div class="text-secondary mb-1">Created: {{friendlier_date_time($ticket->created_at)}}</div>
+        </div>
+        <?php
+        break;
+    case 'Appointment':
+        $appointment = \App\Models\Appointment::where('uid', $bill->generic_target_entity_uid)->first();
+        ?>
+        <div class="mb-1">Appointment
+            <a class="ml-2"
+               native target="_blank"
+               href="/patients/view/{{$appointment->client->uid}}/calendar/{{$appointment->uid}}">
+                View
+            </a>
+        </div>
+        <div class="pl-3 text-sm">
+            <div class="text-secondary mb-1">Patient: <a href="{{route('patients.view.dashboard', ['patient' => $appointment->client])}}">{{$appointment->client->displayName()}}</a></div>
+            <div class="text-secondary mb-1">Pro: {{$appointment->pro->displayName()}}</div>
+            <div class="text-secondary mb-1">Date: <b>{{friendlier_date_time($appointment->raw_start_time)}}</b></div>
+            <div class="text-secondary mb-1">Created: {{friendlier_date_time($appointment->created_at)}}</div>
+        </div>
+        <?php
+        break;
+    case 'ClientBDTDevice':
+        $device = \App\Models\ClientBDTDevice::where('uid', $bill->generic_target_entity_uid)->first();
+        ?>
+        <div class="mb-1">Device > {{strtoupper($device->device->category)}}</div>
+        <div class="pl-3 text-sm">
+            <div class="text-secondary mb-1">Patient: <a href="{{route('patients.view.dashboard', ['patient' => $device->client])}}">{{$device->client->displayName()}}</a></div>
+            <div class="text-secondary mb-1">Created: {{friendlier_date_time($device->created_at)}}</div>
+        </div>
+        <?php
+        break;
+    case 'Note':
+        $note = \App\Models\Note::where('uid', $bill->generic_target_entity_uid)->first();
+        ?>
+        <div class="mb-1">Note
+            <a class="ml-2"
+               native target="_blank"
+               href="/patients/view/{{$note->client->uid}}/notes/view/{{$note->uid}}">
+                View
+            </a>
+        </div>
+        <div class="pl-3 text-sm">
+            <div class="text-secondary mb-1">Patient: <a href="{{route('patients.view.dashboard', ['patient' => $note->client])}}">{{$note->client->displayName()}}</a></div>
+            <div class="text-secondary mb-1">Eff. Date: {{friendlier_date_time($note->effective_dateest, false)}}</div>
+            <div class="text-secondary mb-1">Created: {{friendlier_date_time($note->created_at)}}</div>
+        </div>
+        <?php
+        break;
+    default:
+        echo $bill->generic_target_entity_type ? $bill->generic_target_entity_type : '-';
+}
+?>

+ 8 - 0
resources/views/app/rm-bills/create_generic-bill.blade.php

@@ -0,0 +1,8 @@
+<div moe wide relative class="">
+    <a class="" href="" show start>Create {{@$label ? $label : 'Admin.'}} Bill</a>
+    @if (!!@$entityType && file_exists(resource_path('views/app/rm-bills/add-bill-form/' . $entityType . '.blade.php')))
+        @include('app.rm-bills.add-bill-form.' . $entityType)
+    @else
+        @include('app.rm-bills.add-bill-form.default')
+    @endif
+</div>

+ 224 - 0
resources/views/app/rm-bills/inline.blade.php

@@ -0,0 +1,224 @@
+<?php
+
+use App\Models\Note;
+use App\Models\Pro;
+use App\Models\Client;
+
+/** @var Note $note */
+/** @var Pro $genericPro */
+/** @var Pro $pro */
+/** @var Client $patient */
+/** @var $entityType */
+/** @var $entityUid */
+
+$genericBills = genericBills($pro, @$patient, @$entityType, @$entityUid);
+?>
+
+@if(!count($genericBills))
+    <div class="{{@$class ? $class : ''}} d-flex align-items-center">
+        <p class="font-weight-bold mb-0">No {{@$label ? $label : 'Admin.'}} Bills</p>
+        <span class="mx-2 text-secondary">|</span>
+        @include('app.rm-bills.create_generic-bill')
+    </div>
+@else
+    <div class="{{@$class ? $class : ''}}">
+        <div class="d-flex align-items-center mb-2">
+            <p class="font-weight-bold m-0">{{@$label ? $label : 'Admin.'}} Bills</p>
+            @if(!@$noCreate)
+                <span class="mx-2 text-secondary">|</span>
+                @include('app.rm-bills.create_generic-bill')
+            @endif
+        </div>
+            <table class="table table-sm table-striped mb-0 table-bordered">
+                <thead class="bg-light">
+                <tr class="text-secondary">
+                    @if(@$adminView)
+                        <th class="border-bottom-0">Context</th>
+                    @endif
+                    <th class="border-bottom-0">Service</th>
+                    <th class="border-bottom-0">Billable</th>
+                    <th class="border-bottom-0">Sign</th>
+                    <th class="border-bottom-0">Cancel</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach ($genericBills as $bill)
+                    <tr class="{{$bill->is_cancelled ? 'bg-light text-secondary' : ''}}">
+                        @if(@$adminView)
+                            <td>
+                                @include('app.rm-bills.context')
+                            </td>
+                        @endif
+                        <td>{{$bill->code}}
+                            @if($bill->generic_description)
+                                <pre class="max-width-300px text-wrap mb-0 text-sm text-secondary font-italic">{!! preg_replace('#<br\s*/?>#i', "\n", $bill->generic_description) !!}</pre>
+                            @endif
+                            @if(!$bill->is_signed_by_generic_pro)
+                                <div moe wide relative class="d-block">
+                                    <a href="#" start show class="text-nowrap text-sm">Edit Description</a>
+                                    <form url="/api/bill/putGenericDescription" right>
+                                        <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                        <p>Edit Description</p>
+                                        <div class="mb-2">
+                                                <textarea class="text form-control form-control-sm"
+                                                          rows="5"
+                                                          name="genericDescription"
+                                                          placeholder="">{{$bill->generic_description ? preg_replace('#<br\s*/?>#i', "\n", $bill->generic_description) : ''}}</textarea>
+                                        </div>
+                                        <div>
+                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @endif
+                            <div class="text-nowrap screen-only">
+                                <span class="text-secondary">Paid: </span>
+                                <span>{{ $bill->has_generic_pro_been_paid ? 'Yes' : 'No' }}</span>
+                            </div>
+                            @if(!$bill->has_generic_pro_been_paid)
+                                <div class="text-nowrap screen-only">
+                                    <span class="text-secondary">Expected: </span>
+                                    <span class="font-weight-bold">${{ round($bill->total_expected, 2) }}</span>
+                                </div>
+                            @else
+                                <div class="text-nowrap screen-only">
+                                    <span class="text-secondary">Amount: </span>
+                                    <span class="font-weight-bold">${{ round($bill->total_paid, 2) }}</span>
+                                </div>
+                            @endif
+                        </td>
+                        <td class="">
+                            <?php
+                            $totalSeconds = $bill->number_of_units * 3600;
+                            $remainder = $totalSeconds % 60;
+                            if ($remainder !== 0) {
+                                if ($remainder < 30) {
+                                    $totalSeconds = $totalSeconds - $remainder;
+                                }
+                                else {
+                                    $totalSeconds = $totalSeconds + (60 - $remainder);
+                                }
+                            }
+                            ?>
+                            {{ time_in_hrminsec($totalSeconds) }}
+                            <div>
+                                @if($bill->has_generic_pro_been_paid)
+                                    <span class="text-secondary">Paid. </span>
+                                    <span class="font-weight-bold">${{ round($bill->total_paid, 2) }}</span>
+                                @else
+                                    <span class="text-secondary">Exp. </span>
+                                    <span class="font-weight-bold">{{ $bill->total_expected ? '$' . round($bill->total_expected, 2) : '-' }}</span>
+                                @endif
+                            </div>
+                        </td>
+                        <td>
+                            @if(!$bill->is_cancelled)
+                                @if($bill->is_signed_by_generic_pro)
+                                    <div class="d-block text-secondary text-nowrap">
+                                        <i class="fa fa-check"></i>
+                                        Pro Signed
+                                    </div>
+                                @else
+                                    <div moe relative
+                                          class="d-block {{ $bill->generic_pro_id !== $pro->id ? 'moe-disabled' : '' }}"
+                                          title="{{ $bill->generic_pro_id !== $pro->id ? 'Only the bill\'s pro can sign' : '' }}">
+                                        <a class="text-nowrap" href="" show start>Sign</a>
+                                        <form url="/api/bill/signAsGenericPro" right>
+                                            <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                            <p>Sign this bill?</p>
+                                            <div class="mb-0">
+                                                <button class="btn btn-success btn-sm" submit>Sign</button>
+                                                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                            </div>
+                                        </form>
+                                    </div>
+                                @endif
+                            @endif
+                        </td>
+                        <td>  <!-- cancellation -->
+                            @if($bill->is_cancelled)
+                                <div class="text-warning-mellow font-weight-bold">Cancelled</div>
+                                @if($bill->cancellation_memo)
+                                    <div class="text-dark text-sm font-italic my-1">{{$bill->cancellation_memo}}</div>
+                                @endif
+                                @if($bill->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="{{$bill->uid}}">
+                                        <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>
+                                        </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="{{$bill->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
+
+                            @if($bill->is_cancelled && !$bill->is_cancellation_acknowledged)
+                                <div class="mt-2 text-secondary text-nowrap">
+                                    <i class="fa fa-exclamation-triangle"></i>
+                                    Not Ack.
+                                </div>
+                                <div class="d-block mt-1" moe>
+                                    <a class="text-nowrap" href="" show start>Ack. Cancellation</a>
+                                    <form url="/api/bill/acknowledgeCancellation">
+                                        <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                        <p>Acknowledge Cancellation?</p>
+                                        <div class="mb-0">
+                                            {{--<input type="text" class="text form-control form-control-sm" name="cancellationMemo" value="{{$bill->cancellation_memo}}" placeholder=""><br>--}}
+                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                            @endif
+
+                            @if($bill->is_cancellation_acknowledged)
+                                <div class="mt-2 text-secondary">
+                                    <i class="fa fa-check"></i>
+                                    Ack.
+                                </div>
+                                <div class="d-block mt-1" moe>
+                                    <a class="text-nowrap" href="" show start>Undo Cancellation Ack.</a>
+                                    <form url="/api/bill/undoAcknowledgeCancellation">
+                                        <input type="hidden" name="uid" value="{{$bill->uid}}">
+                                        <p>Undo Acknowledge Cancellation?</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
+
+                        </td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
+    </div>
+@endif

+ 8 - 0
resources/views/app/rm-bills/modal.blade.php

@@ -0,0 +1,8 @@
+<a native target="_blank"
+   open-in-stag-popup
+   class="text-nowrap"
+   popup-style="tall"
+   title="{{@$label ? $label : 'Admin'}} bills"
+   href="{{route('generic-bill-view', ['entityType' => @$entityType, 'entityUid' => @$entityUid])}}">
+    {{@$label ? $label : 'Admin'}} bills
+</a>

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

@@ -747,9 +747,9 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 
 									<section class="mr-4 align-self-start mt-2 ml-auto">
 										<label>Sticky Note:</label> <span class="text-secondary">{{$patient->sticky_note ?? '-' }}</span>
-											<div moe right class="ml-2 hide-inside-popup">
+											<div moe relative wide class="ml-2 hide-inside-popup">
 												<a start show><i class="fa fa-edit"></i></a>
-												<form url="/api/client/updateStickyNote" class="mcp-theme-1">
+												<form url="/api/client/updateStickyNote" class="mcp-theme-1" right>
 													<input type="hidden" name="uid" value="{{$patient->uid}}">
 													<div class="mb-2">
 														<label class="text-secondary text-sm">Sticky Note</label>

+ 5 - 2
resources/views/layouts/template.blade.php

@@ -407,8 +407,11 @@
                     let tab = $(this).attr('tab-link');
                     $(this).siblings().removeClass('tab-link-active');
                     $(this).addClass('tab-link-active');
-                    $('.cm-tab').addClass('d-none');
-                    $('.cm-tab[tab-key="' + tab + '"]').removeClass('d-none');
+                    $(this).closest('[tab-links]').siblings('.cm-tab').addClass('d-none');
+                    $(this).closest('[tab-links]').siblings('.cm-tab[tab-key="' + tab + '"]').removeClass('d-none');
+                    // TODO: move to context
+                    if(window.vgBPChart) window.vgBPChart.flush();
+                    if(window.vgWtChart) window.vgWtChart.flush();
                     return false;
                 });
         });