فهرست منبع

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

= 4 سال پیش
والد
کامیت
ab562d2726

+ 7 - 3
app/Http/Controllers/HomeController.php

@@ -362,7 +362,7 @@ class HomeController extends Controller
             default:
                 break;
         }
-        $patients = $query->orderBy('created_at', 'asc')->orderBy('name_last', 'asc')->orderBy('name_first', 'asc')->paginate(500);
+        $patients = $query->orderBy('id', 'desc')->paginate(500);
         return view('app/patients', compact('patients', 'filter'));
     }
 
@@ -446,8 +446,12 @@ class HomeController extends Controller
         if($this->pro->pro_type != 'ADMIN'){
             return redirect()->to(route('dashboard'));
         }
-
-        $pros =  Pro::where('pro_type', '!=', 'ADMIN')->orWhereNull('pro_type')->get();
+        $pros =  Pro
+            ::where('pro_type', '!=', 'ADMIN')
+            ->orWhereNull('pro_type')
+            ->orderBy('name_last', 'asc')
+            ->orderBy('name_first', 'asc')
+            ->get();
         return view('app/log-in-as', compact('pros'));
     }
 

+ 20 - 14
app/Http/Controllers/PatientController.php

@@ -23,10 +23,13 @@ class PatientController extends Controller
     public function dashboard(Request $request, Client $patient )
     {
         $mcpPros = Pro::where('is_enrolled_as_mcp', true)->get();
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         $devices = BDTDevice::where('is_active', true)->orderBy('imei', 'asc')->get();
         $devices = $devices->filter(function ($record) {
-            $matching = ClientBDTDevice::where('device_id', $record->id)->get();
+            $matching = ClientBDTDevice
+                ::where('device_id', $record->id)
+                ->where('is_active', true)
+                ->get();
             return count($matching) === 0;
         });
         $dxInfoLines = ClientInfoLine::where('client_id', $patient->id)
@@ -40,68 +43,68 @@ class PatientController extends Controller
 
     public function actionItems(Request $request, Client $patient )
     {
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         return view('app.patient.action-items', compact('patient', 'facilities'));
     }
 
     public function actionItemsErx(Request $request, Client $patient, $filter = 'open')
     {
         $allPros = Pro::all();
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         return view('app.patient.action-items-erx', compact('patient', 'facilities', 'filter', 'allPros'));
     }
 
     public function actionItemsLab(Request $request, Client $patient, $filter = 'open')
     {
         $allPros = Pro::all();
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         return view('app.patient.action-items-lab', compact('patient', 'facilities', 'filter', 'allPros'));
     }
 
     public function actionItemsImaging(Request $request, Client $patient, $filter = 'open')
     {
         $allPros = Pro::all();
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         return view('app.patient.action-items-imaging', compact('patient', 'facilities', 'filter', 'allPros'));
     }
 
     public function actionItemsEquipment(Request $request, Client $patient, $filter = 'open')
     {
         $allPros = Pro::all();
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         return view('app.patient.action-items-equipment', compact('patient', 'facilities', 'filter', 'allPros'));
     }
 
     public function actionItemsOther(Request $request, Client $patient, $filter = 'open')
     {
         $allPros = Pro::all();
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         return view('app.patient.action-items-other', compact('patient', 'facilities', 'filter', 'allPros'));
     }
 
     public function actionItemsErxSingle(Request $request, Client $patient, Ticket $ticket) {
         $allPros = Pro::all();
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         return view('app.patient.action-items-erx-single', compact('patient', 'facilities', 'allPros', 'ticket'));
     }
     public function actionItemsLabSingle(Request $request, Client $patient, Ticket $ticket) {
         $allPros = Pro::all();
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         return view('app.patient.action-items-lab-single', compact('patient', 'facilities', 'allPros', 'ticket'));
     }
     public function actionItemsImagingSingle(Request $request, Client $patient, Ticket $ticket) {
         $allPros = Pro::all();
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         return view('app.patient.action-items-imaging-single', compact('patient', 'facilities', 'allPros', 'ticket'));
     }
     public function actionItemsEquipmentSingle(Request $request, Client $patient, Ticket $ticket) {
         $allPros = Pro::all();
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         return view('app.patient.action-items-equipment-single', compact('patient', 'facilities', 'allPros', 'ticket'));
     }
     public function actionItemsOtherSingle(Request $request, Client $patient, Ticket $ticket) {
         $allPros = Pro::all();
-        $facilities = Facility::where('is_active', true)->get();
+        $facilities = []; // Facility::where('is_active', true)->get();
         return view('app.patient.action-items-other-single', compact('patient', 'facilities', 'allPros', 'ticket'));
     }
 
@@ -153,7 +156,10 @@ class PatientController extends Controller
     {
         $devices = BDTDevice::where('is_active', true)->get();
         $devices = $devices->filter(function ($record) {
-            $matching = ClientBDTDevice::where('device_id', $record->id)->get();
+            $matching = ClientBDTDevice
+                ::where('device_id', $record->id)
+                ->where('is_active', true)
+                ->get();
             return count($matching) === 0;
         });
         return view('app.patient.devices', compact('patient', 'devices'));

+ 23 - 3
app/Models/Client.php

@@ -31,6 +31,10 @@ class Client extends Model
         return $this->hasOne(Pro::class, 'id', 'rmm_pro_id');
     }
 
+    public function rme() {
+        return $this->hasOne(Pro::class, 'id', 'rme_pro_id');
+    }
+
     public function prosInMeetingWith() {
         return Pro::where('in_meeting_with_client_id', $this->id)->get();
     }
@@ -86,11 +90,25 @@ class Client extends Model
 
     public function measurements() {
         return $this->hasMany(Measurement::class, 'client_id', 'id')
-            ->distinct('label')
+            /*->distinct('label')*/
             ->where('is_removed', false)
-            ->orderBy('label', 'asc')
             ->orderBy('effective_date', 'desc');
     }
+
+    public function measurementsInCareMonth(CareMonth $careMonth) {
+        $cmStartDate = strtotime($careMonth->start_date);
+        $month = date("n", $cmStartDate);
+        $year = date("Y", $cmStartDate);
+        $measurements = Measurement
+            ::where('client_id', $this->id)
+            ->whereRaw('EXTRACT(MONTH FROM effective_date) = ?', [$month])
+            ->whereRaw('EXTRACT(YEAR FROM effective_date) = ?', [$year])
+            ->where('is_removed', false)
+            ->orderBy('effective_date', 'desc')
+            ->get();
+        return $measurements;
+    }
+
     public function allMeasurements() {
         return $this->hasMany(Measurement::class, 'client_id', 'id')
             ->where('is_removed', false)
@@ -185,11 +203,13 @@ class Client extends Model
         $pro = $this->mcp;
         if ($pro && $pro->id) $pros[] = ["pro" => $pro->displayName(), "association" => 'MCP'];
         $pro = $this->pcp;
-        if ($pro && $pro->id) $pros[] = ["pro" => $pro->displayName(), "association" => 'PCP'];
+        if ($pro && $pro->id) $pros[] = ["pro" => $pro->displayName(), "association" => 'PCP (Physician)'];
         $pro = $this->cm;
         if ($pro && $pro->id) $pros[] = ["pro" => $pro->displayName(), "association" => 'CM'];
         $pro = $this->rmm;
         if ($pro && $pro->id) $pros[] = ["pro" => $pro->displayName(), "association" => 'RMM'];
+        $pro = $this->rme;
+        if ($pro && $pro->id) $pros[] = ["pro" => $pro->displayName(), "association" => 'RME'];
 
         // via client pro access
         $cpAccesses = ClientProAccess::where('client_id', $this->id)->where('is_active', true)->get();

+ 5 - 0
app/Models/Measurement.php

@@ -13,6 +13,11 @@ class Measurement extends Model
         return $this->hasOne(Client::class, 'id', 'client_id');
     }
 
+    public function clientBDTMeasurement()
+    {
+        return $this->hasOne(ClientBDTMeasurement::class, 'id', 'client_bdt_measurement_id');
+    }
+
     public function numCPMEntries() {
         return ClientProgramMonthEntry::where('measurement_id', $this->id)->where('is_cancelled', false)->count();
     }

+ 3 - 27
app/Models/Pro.php

@@ -260,36 +260,11 @@ class Pro extends Model
 
     }
 
-    public function getMyClientIds(){
-
-        $accessibleClientIds = [];
-
-        $clientProAccesses = ClientProAccess::where('pro_id', $this->id)->get();
-        foreach($clientProAccesses as $cpa){
-            $accessibleClientIds[] = $cpa->client_id;
-        }
-
-        $appointmentClientIds = [];
-
-        $appointments = Appointment::where('pro_id', $this->id)->get();
-        foreach($appointments as $appts){
-            $appointmentClientIds[] = $appts->client_id;
-        }
-
-        $clients = Client::where('mcp_pro_id', $this->id)
-            ->orWhere('cm_pro_id', $this->id)
-            ->orWhere('rmm_pro_id', $this->id)
-            ->orWhere('rme_pro_id', $this->id)
-            ->orWhere('rd_pro_id', $this->id)
-            ->orWhereIn('id', $accessibleClientIds)
-            ->orWhereIn('id', $appointmentClientIds)->get();
-
-        $clientIds = [];
-
+    public function getMyClientIds() {
+        $clients = $this->getAccessibleClientsQuery()->get();
         foreach($clients as $client){
             $clientIds[] = $client->id;
         }
-
         return $clientIds;
     }
 
@@ -312,6 +287,7 @@ class Pro extends Model
                     ->orWhere('cm_pro_id', $proID)
                     ->orWhere('rmm_pro_id', $proID)
                     ->orWhere('rme_pro_id', $proID)
+                    ->orWhere('physician_pro_id', $proID)
                     ->orWhereRaw('id IN (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = ?)', [$proID])
                     ->orWhereRaw('id IN (SELECT client_id FROM appointment WHERE pro_id = ?)', [$proID])
                     ->orWhereRaw('id IN (SELECT mcp_pro_id FROM client_program WHERE client_id = client.id AND is_active = TRUE)')

+ 1 - 1
public/css/shortcut.css

@@ -6,7 +6,7 @@
     display: none;
     min-width: 160px;
     max-width: 280px;
-    z-index: 98;
+    z-index: 99999;
 }
 .stag-shortcuts>.sc {
     font-size: 13px;

+ 7 - 0
public/css/style.css

@@ -385,6 +385,10 @@ body>nav.navbar {
 .events-none {
     pointer-events: none;
 }
+.blocking-overlay {
+    opacity: 0 !important;
+    cursor: default;
+}
 .inset-comment p {
     margin-bottom: 0.3rem;
 }
@@ -1187,3 +1191,6 @@ button.note-templates-trigger-assessment {
 .claim-line:last-child td {
     padding-bottom: 1.3rem;
 }
+.in-table-markup p:last-of-type {
+    margin-bottom: 0;
+}

+ 10 - 3
public/js/yemi.js

@@ -18,12 +18,16 @@ var hideMask = function () {
     $('.mask-text-addition').remove();
 }
 
-var showMoeFormMask = function () {
+var showMoeFormMask = function (_additionalClass = false) {
+    if(_additionalClass) {
+        $('#moe-form-mask').addClass(_additionalClass);
+    }
     $('#moe-form-mask').show();
 }
 
 var hideMoeFormMask = function () {
-    $('#moe-form-mask').hide();
+    if($('body').is('.blocking-mode')) return false;
+    $('#moe-form-mask').hide().removeClass();
     $('#create-shortcut-form').hide();
 }
 
@@ -457,7 +461,10 @@ var initMoes = function() {
 jQuery(document).ready(function () {
     var $ = jQuery;
     $('body').mousedown(function(e){
-        if($(e.target).closest('[moe]').length || $(e.target).closest('#create-shortcut-form').length || $(e.target).is('#create-shortcut-form')){
+        if($(e.target).closest('[moe]').length ||
+            $(e.target).closest('#create-shortcut-form').length ||
+            $(e.target).is('#create-shortcut-form') ||
+            $(e.target).is('.stag-shortcuts .sc')){
             return;
         }
         $('[moe] [url]:not([show])').hide();

+ 35 - 33
resources/views/app/log-in-as.blade.php

@@ -3,39 +3,41 @@
 @section('content')
 
     <div class="p-3 mcp-theme-1">
-    <div class="card">
-        @if(session('message'))
-        <div class="alert alert-info">{{session('message')}}</div>
-        @endif
-        <table class="table table-sm table-striped">
-            <thead>
-                <tr>
-                    <th>First Name</th>
-                    <th>Last Name</th>
-                    <th>Cell Number</th>
-                    <th>Email</th>
-                    <th></th>
-                </tr>
-            </thead>
-            <tbody>
-                @foreach($pros as $pro)
-                <tr>
-                    <td>{{$pro->name_first}}</td>
-                    <td>{{$pro->name_last}}</td>
-                    <td>{{$pro->cell_number}}</td>
-                    <td>{{$pro->email}}</td>
-                    <td>
-                        <form action="{{route('process-log-in-as')}}" method="POST"  target="_top">
-                            @csrf
-                            <input type="hidden" name="proUid" value="{{$pro->uid}}">
-                            <button class="btn btn-primary">Login</button>
-                        </form>
-                    </td>
-                </tr>
-                @endforeach
-            </tbody>
-        </table>
-    </div>
+        <div class="row">
+            <div class="col-12 col-md-6">
+                <div class="card">
+                    @if(session('message'))
+                        <div class="alert alert-info">{{session('message')}}</div>
+                    @endif
+                    <table class="table table-sm table-striped mb-0">
+                        <thead>
+                        <tr>
+                            <th class="border-0 pl-2">Name</th>
+                            <th class="border-0">Cell Number</th>
+                            <th class="border-0">Email</th>
+                            <th class="border-0"></th>
+                        </tr>
+                        </thead>
+                        <tbody>
+                        @foreach($pros as $pro)
+                            <tr>
+                                <td class="pl-2">{{$pro->displayName()}}</td>
+                                <td>{{$pro->cell_number}}</td>
+                                <td>{{$pro->email}}</td>
+                                <td class="text-right pr-2">
+                                    <form action="{{route('process-log-in-as')}}" method="POST" target="_top">
+                                        @csrf
+                                        <input type="hidden" name="proUid" value="{{$pro->uid}}">
+                                        <button class="btn btn-sm btn-primary font-weight-bold px-4 py-1">Login</button>
+                                    </form>
+                                </td>
+                            </tr>
+                        @endforeach
+                        </tbody>
+                    </table>
+                </div>
+            </div>
+        </div>
     </div>
 
 @endsection

+ 53 - 5
resources/views/app/new-patient.blade.php

@@ -4,7 +4,7 @@
 
     <?php $patients = [1,2,3,4]; ?>
 
-    <div class="p-3 mcp-theme-1">
+    <div class="p-3 mcp-theme-1" id="newPatientContainer">
         <div class="col-12 col-lg-6 px-0">
             <div class="card d-block mb-3" moe="">
 
@@ -44,12 +44,28 @@
                             <input class='form-control' type='date' name='dateOfBirth' max="{{ date('Y-m-d') }}" required>
                         </div>
                         <div class='form-group mb-3'>
-                            <label class='control-label'>Home Phone Number </label>
-                            <input class='form-control' type='tel' name='homeNumber'>
+                            <label class='control-label d-flex align-items-center'>
+                                <span>Home Phone Number</span>
+                                <a href="#"
+                                   class="ml-2 px-1 on-hover-opaque hpn-to-cpn">
+                                    <i class="fa fa-arrow-down"></i>
+                                </a>
+                                <a href="#"
+                                   class="ml-2 px-1 on-hover-opaque swap-pns">
+                                    <i class="fa fa-retweet"></i>
+                                </a>
+                            </label>
+                            <input class='form-control' stag-input-phone type='tel' name='homeNumber'>
                         </div>
                         <div class='form-group mb-3'>
-                            <label class='control-label'>Cell Phone Number </label>
-                            <input class='form-control' type='tel' name='cellNumber'>
+                            <label class='control-label d-flex align-items-center'>
+                                <span>Cell Phone Number</span>
+                                <a href="#"
+                                   class="ml-2 px-1 on-hover-opaque cpn-to-hpn">
+                                    <i class="fa fa-arrow-up"></i>
+                                </a>
+                            </label>
+                            <input class='form-control' stag-input-phone type='tel' name='cellNumber'>
                         </div>
                         <div class='form-group mb-3'>
                             <label class='control-label'>Email Address </label>
@@ -77,4 +93,36 @@
         </div>
     </div>
 
+    <script src="/inputmask-5.x/dist/inputmask.js"></script>
+    <script>
+        (function() {
+            function init() {
+                let im = new Inputmask("(999) 999-9999").mask('[stag-input-phone]');
+                $(document)
+                    .off('click.hpn-to-cpn', '.hpn-to-cpn')
+                    .on('click.hpn-to-cpn', '.hpn-to-cpn', function() {
+                        $('[name="cellNumber"]').val($('[name="homeNumber"]').val());
+                        $('[name="homeNumber"]').val('');
+                        return false;
+                    });
+                $(document)
+                    .off('click.cpn-to-hpn', '.cpn-to-hpn')
+                    .on('click.cpn-to-hpn', '.cpn-to-hpn', function() {
+                        $('[name="homeNumber"]').val($('[name="cellNumber"]').val());
+                        $('[name="cellNumber"]').val('');
+                        return false;
+                    });
+                $(document)
+                    .off('click.swap-pns', '.swap-pns')
+                    .on('click.swap-pns', '.swap-pns', function() {
+                        let hpn = $('[name="homeNumber"]').val();
+                        $('[name="homeNumber"]').val($('[name="cellNumber"]').val());
+                        $('[name="cellNumber"]').val(hpn);
+                        return false;
+                    });
+            }
+            addMCInitializer('new-patient', init, '#newPatientContainer');
+        }).call(window);
+    </script>
+
 @endsection

+ 198 - 71
resources/views/app/patient/care-month/dashboard.blade.php

@@ -5,6 +5,24 @@
 @extends ('layouts.patient')
 
 @section('inner-content')
+
+    <?php
+    $shortCutsObject = [];
+    foreach ($pro->shortcuts as $shortcut) {
+
+        // %replaceables%
+        $shortcut->text = str_replace("%AGE%", $patient->age_in_years, $shortcut->text);
+        $shortcut->text = str_replace("%GENDER%", $patient->sex, $shortcut->text);
+        $shortcut->text = str_replace("%NAME%", $patient->displayName(), $shortcut->text);
+
+        $shortCutsObject[] = [
+            "name" => $shortcut->shortcut,
+            "value" => $shortcut->text
+        ];
+    }
+    ?>
+    <script>window.userShortcuts = <?= json_encode($shortCutsObject); ?>;</script>
+
     @if($patient->has_mcp_done_onboarding_visit !== 'YES')
         <div class="pt-2 d-flex align-items-start">
             <h6 class="my-0 text-secondary d-flex align-items-start">
@@ -66,7 +84,7 @@
         </div>
     @else
 
-    <div class="">
+    <div id="care-month-container">
         <div class="pt-2 d-flex align-items-start">
             <h6 class="my-0 text-secondary d-flex align-items-start">
                 <a href="/patients/view/{{ $patient->uid }}/care-months" class="small text-decoration-none mr-3">
@@ -196,7 +214,7 @@
 
         <div class="row mb-3">
             <div class="col-12">
-                <div class="mt-0 pb-1">
+                <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>
@@ -219,11 +237,108 @@
                                 </div>
                             </form>
                         </div>
-                        {{--<span class="mx-2 text-secondary">|</span>
-                        <a start show class="py-0 font-weight-normal"
-                           href="/patients/view/{{ $patient->uid }}/measurements">
-                            View All
-                        </a>--}}
+                        @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>
+                                    <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>
+                                </form>
+                            </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>
+                                    <div class="mb-2">
+                                        <input type="text" class="form-control form-control-sm" name="valueIrregular" value="" placeholder="valueIrregular">
+                                    </div>
+                                    <div class="mb-2">
+                                        <input type="text" class="form-control form-control-sm" name="rssi" value="78" placeholder="rssi">
+                                    </div>
+                                    <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>
+                                    </div>
+                                </form>
+                            </div>
+                        @endif
                     </div>
                     <table class="table table-striped table-sm table-bordered mt-2 mb-0">
                         <thead>
@@ -236,12 +351,27 @@
                         </tr>
                         </thead>
                         <tbody>
-                        @foreach($patient->measurements as $measurement)
-                            @if(!empty($measurement->label) && !in_array($measurement->label, $vitalLabels))
+                        @php $measurementsInCareMonth = $patient->measurementsInCareMonth($careMonth); @endphp
+                        @foreach($measurementsInCareMonth as $measurement)
+                            @if(1 || !empty($measurement->label) && !in_array($measurement->label, $vitalLabels))
                                 <tr>
                                     <td class="px-2">{{ friendly_date_time($measurement->created_at) }}</td>
                                     <td class="px-2">{{ $measurement->label }}</td>
-                                    <td class="px-2">{{ $measurement->value }}</td>
+                                    <td class="px-2">
+                                        @if(empty($measurement->client_bdt_measurement_id))
+                                            {{ $measurement->value }}
+                                        @else
+                                            @if($measurement->label === 'BP')
+                                                {{ $measurement->clientBDTMeasurement->measurement->systolic_bp_in_mm_hg }}/{{ $measurement->clientBDTMeasurement->measurement->diastolic_bp_in_mm_hg }} mmHg
+                                            @elseif($measurement->label === 'SBP')
+                                                {{ $measurement->clientBDTMeasurement->measurement->systolic_bp_in_mm_hg }} mmHg
+                                            @elseif($measurement->label === 'DBP')
+                                                {{ $measurement->clientBDTMeasurement->measurement->diastolic_bp_in_mm_hg }} mmHg
+                                            @elseif($measurement->label === 'Wt. (lbs.)')
+                                                {{ $measurement->clientBDTMeasurement->measurement->weight_in_pounds }} lbs
+                                            @endif
+                                        @endif
+                                    </td>
                                     <td></td>
                                     <td></td>
 
@@ -302,66 +432,14 @@
             </div>
         </div>
 
-        <hr class="m-negator mt-4 mb-3">
+        {{-- BDT Measurements --}}
+        {{-- <hr class="m-negator mt-4 mb-3">
 
         <div class="row mb-3">
-            {{-- BDT Measurements --}}
             <div class="col-12">
                 <div class="d-flex align-items-center">
                     <h6 class="my-0 text-secondary font-weight-bold text-dark lh-24px">Cellular Measurements</h6>
                 </div>
-                {{--<div class="mt-2 pb-1">
-                    <table class="table table-sm border-0 m-0">
-                        <tbody>
-                        @foreach($patient->deviceMeasurements as $measurement)
-                            <tr>
-                                <td class="text-black p-0 border-0">
-                                    <div class="pb-1 d-flex align-items-center">
-                                        <span class="text-secondary mr-2">{{ $measurement->measurement->device_category }}:</span>
-                                        @if($measurement->measurement->device_category === 'WEIGHT')
-                                            <b class="text-nowrap">{{ round(($measurement->measurement->value_weight / 1000)*2.20462, 1) }} lb</b>
-                                        @elseif($measurement->measurement->device_category === 'BP')
-                                            <b class="text-nowrap">{{ $measurement->measurement->systolic_bp_in_mm_hg }}/{{ $measurement->measurement->diastolic_bp_in_mm_hg }} mmHg</b>
-                                        @endif
-                                        <span class="font-weight-normal text-secondary ml-2 text-sm">({{ friendly_date_time_short($measurement->measurement->created_at, true) }})</span>
-                                        <span class="ml-2 text-sm {{$measurement->status === 'NEW' ? 'text-info' : ($measurement->status === 'ACCEPTED' ? 'text-success' : 'text-sacondary')}}">{{$measurement->status}}</span>
-                                        <span>
-                                            <span moe class="ml-2" relative>
-                                                <a href="#" start show><i class="on-hover-opaque font-size-11 fa fa-edit text-primary"></i></a>
-                                                <form url="/api/clientBdtMeasurement/updateStatus" right>
-                                                    <input type="hidden" name="uid" value="{{ $measurement->uid }}">
-                                                    <div class="mb-2">
-                                                        <select name="status" class="form-control form-control-sm" required>
-                                                            <option value="">-- select --</option>
-                                                            <option {{$measurement->status === 'NEW' ? 'selected' : ''  }} value="NEW">NEW</option>
-                                                            <option {{$measurement->status === 'ACCEPTED' ? 'selected' : ''  }} value="ACCEPTED">ACCEPTED</option>
-                                                            <option {{$measurement->status === 'REJECTED' ? 'selected' : ''  }} value="REJECTED">REJECTED</option>
-                                                        </select>
-                                                    </div>
-                                                    <div class="mb-2">
-                                                        <input type="text" name="statusMemo" placeholder="Status memo" class="form-control form-control-sm">
-                                                    </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>
-                                            </span>
-                                        </span>
-                                    </div>
-                                </td>
-                            </tr>
-                        @endforeach
-                        @if(!$patient->deviceMeasurements || count($patient->deviceMeasurements) === 0)
-                            <tr>
-                                <td class="text-secondary p-0 border-0">
-                                    No measurements
-                                </td>
-                            </tr>
-                        @endif
-                        </tbody>
-                    </table>
-                </div>--}}
                 <table class="table table-striped table-sm table-bordered mt-2 mb-0">
                     @if($patient->measurements && count($patient->measurements))
                         <thead>
@@ -426,7 +504,7 @@
                     @endif
                 </table>
             </div>
-        </div>
+        </div> --}}
 
         <hr class="m-negator mt-4 mb-3">
 
@@ -501,7 +579,7 @@
                                     <div class="mb-2">
                                         <div class="row">
                                             <div class="col-12">
-                                                <input type="text" name="contentText" class="form-control form-control-sm" rows="5" placeholder="Reviewed/managed patient measurements" value="Reviewed/managed patient measurements">
+                                                <div cm-rte data-content="Reviewed/managed patient measurements" data-name="contentText"></div>
                                             </div>
                                         </div>
                                     </div>
@@ -534,7 +612,7 @@
                             <th class="px-2 text-secondary border-bottom-0">Effective Date</th>
                             <th class="px-2 text-secondary border-bottom-0">Time</th>
                             <th class="px-2 text-secondary border-bottom-0">Created</th>
-                            {{--<th class="px-2 text-secondary border-bottom-0 w-50">Details</th>--}}
+                            <th class="px-2 text-secondary border-bottom-0 w-50">Details</th>
                             <th class="px-2 text-secondary border-bottom-0 delete-column">&nbsp;</th>
                         </tr>
                         </thead>
@@ -551,10 +629,10 @@
                                     <td class="px-2">
                                         {{friendly_date_time($entry->created_at)}}
                                     </td>
-                                    {{--<td class="px-2">
-                                        <div class="text-secondary text-s">{!! $entry->content_text !!}</div>
-                                        --}}{{--<div class="text-secondary text-sm">{{$entry->content_detail}}</div>--}}{{--
-                                    </td>--}}
+                                    <td class="px-2">
+                                        <div class="text-secondary in-table-markup">{!! $entry->content_text !!}</div>
+<!--                                        <div class="text-secondary text-sm">{{$entry->content_detail}}</div>-->
+                                    </td>
                                     <td class="px-2 text-center delete-column">
                                         @if(!$activeRMBill)
                                             <div moe relative>
@@ -1206,5 +1284,54 @@
 
     </div>
 
+    <script>
+        (function() {
+            function init() {
+                $('#care-month-container [cm-rte]').each(function() {
+
+                    $(this).wrap(
+                        $('<div class="border-left border-right rte-holder"/>')
+                            .attr('data-shortcuts', '')
+                    );
+
+                    // give a unique id to this editor instance
+                    var editorID = Math.ceil(Math.random() * 99999), fieldName = $(this).attr('data-name');
+
+                    var el = this;
+                    var existingContent = $(el).attr('data-content');
+                    var quill = new Quill(el, {
+                        theme: 'snow',
+                        modules: stagQuillConfig
+                    });
+
+                    var toolbar = $(quill.container).prev('.ql-toolbar');
+
+                    // add button for new shortcut
+                    var newSCButton = $('<button class="btn bg-white btn-sm btn-default text-primary w-auto px-2 border py-0 ' +
+                        'text-sm add-shortcut" data-editor-id="' + editorID + '">+ Shortcut</button>');
+                    toolbar.append(newSCButton);
+
+                    quill.root.innerHTML = existingContent;
+
+                    $('<input type="hidden" name="' + fieldName + '">').val(existingContent).insertAfter(el);
+
+                    quill.on('text-change', function(delta, oldDelta, source) {
+                        $(el).next('[name="' + fieldName + '"]').val(quill.root.innerHTML);
+                    });
+
+                    $(quill.container)
+                        .find('.ql-editor[contenteditable]')
+                        .attr('data-field', fieldName)
+                        .attr('data-editor-id', editorID)
+                        .attr('with-shortcuts', 1);
+
+                })
+            }
+
+            addMCInitializer('care-month-dashboard', init, '#care-month-container');
+
+        }).call(window);
+    </script>
+
     @endif
 @endsection

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

@@ -660,7 +660,7 @@
                 </div>
             </div>
         </div>
-        <div class="row my-3">
+        <?php /* <div class="row my-3">
             <div class="col-12">
                 {{-- erx --}}
                 <div  class="mb-2 pt-3 pb-2 border-top">
@@ -829,7 +829,7 @@
                     </table>
                 </div>
             </div>
-        </div>
+        </div> */ ?>
 
         <div class="row my-3">
             <div class="col-12">

+ 83 - 69
resources/views/app/patient/measurements.blade.php

@@ -1,7 +1,7 @@
 @extends ('layouts.patient')
 @section('inner-content')
 
-    <div class="mb-3">
+    <div class="">
         <div class="mt-0 pb-1">
             <div class="d-flex align-items-center mb-2">
                 <h6 class="my-0 font-weight-bold text-dark">Measurements</h6>
@@ -29,7 +29,7 @@
             <table class="table table-striped table-sm table-bordered mt-2 mb-0">
                 <thead>
                 <tr>
-                    <th class="px-2 text-secondary w-25">Created</th>
+                    <th class="px-2 text-secondary w-25">Effective Date</th>
                     <th class="px-2 text-secondary w-25">Category</th>
                     <th class="px-2 text-secondary w-25">Value</th>
                     {{--<th class="px-2 text-secondary">Status</th>
@@ -41,9 +41,23 @@
                 @foreach($patient->measurements as $measurement)
                     @if(!empty($measurement->label))
                         <tr>
-                            <td class="px-2">{{ friendly_date_time($measurement->created_at) }}</td>
+                            <td class="px-2">{{ friendly_date_time($measurement->effective_date) }}</td>
                             <td class="px-2">{{ $measurement->label }}</td>
-                            <td class="px-2">{{ $measurement->value }}</td>
+                            <td class="px-2">
+                                @if(empty($measurement->client_bdt_measurement_id))
+                                    {{ $measurement->value }}
+                                @else
+                                    @if($measurement->label === 'BP')
+                                        {{ $measurement->clientBDTMeasurement->measurement->systolic_bp_in_mm_hg }}/{{ $measurement->clientBDTMeasurement->measurement->diastolic_bp_in_mm_hg }} mmHg
+                                    @elseif($measurement->label === 'SBP')
+                                        {{ $measurement->clientBDTMeasurement->measurement->systolic_bp_in_mm_hg }} mmHg
+                                    @elseif($measurement->label === 'DBP')
+                                        {{ $measurement->clientBDTMeasurement->measurement->diastolic_bp_in_mm_hg }} mmHg
+                                    @elseif($measurement->label === 'Wt. (lbs.)')
+                                        {{ round($measurement->clientBDTMeasurement->measurement->weight_in_pounds, 1) }} lbs
+                                    @endif
+                                @endif
+                            </td>
                             {{--<td></td>
                             <td></td>--}}
                             <td class="px-2">
@@ -97,70 +111,70 @@
         </div>
     </div>
 
-    <hr class="m-negator mt-4 mb-3">
+{{--    <hr class="m-negator mt-4 mb-3">--}}
 
-    <div class="">
-        <div class="d-flex align-items-start pb-2">
-            <h4 class="font-weight-bold m-0">Cellular Measurements</h4>
-        </div>
-        <table class="table table-striped table-sm table-bordered mb-0">
-            @if($patient->measurements && count($patient->measurements))
-                <thead>
-                <tr>
-                    <th class="px-2 text-secondary w-25">Created</th>
-                    <th class="px-2 text-secondary w-25">Category</th>
-                    <th class="px-2 text-secondary w-25">Value</th>
-                    <th class="px-2 text-secondary">Status</th>
-                </tr>
-                </thead>
-                <tbody>
-                @foreach($patient->deviceMeasurements as $measurement)
-                    <tr>
-                        <td class="px-2">{{ friendly_date_time($measurement->created_at) }}</td>
-                        <td class="px-2">{{ $measurement->measurement->device_category }}</td>
-                        <td class="px-2">
-                            @if($measurement->measurement->device_category === 'WEIGHT')
-                                <b>{{ round(($measurement->measurement->value_weight / 1000)*2.20462, 1) }} lb</b>
-                            @elseif($measurement->measurement->device_category === 'BP')
-                                <b>{{ $measurement->measurement->systolic_bp_in_mm_hg }}/{{ $measurement->measurement->diastolic_bp_in_mm_hg }} mmHg</b>
-                            @endif
-                        </td>
-                        <td class="px-2">
-                            <span>
-                                <span>{{ $measurement->status }}</span>
-                                <span moe class="ml-2" relative>
-                                    <a href="#" start show><i class="fa fa-edit text-primary"></i></a>
-                                    <form url="/api/clientBdtMeasurement/updateStatus" right>
-                                        <input type="hidden" name="uid" value="{{ $measurement->uid }}">
-                                        <div class="mb-2">
-                                            <select name="status" class="form-control form-control-sm" required>
-                                                <option value="">-- select --</option>
-                                                <option {{$measurement->status === 'NEW' ? 'selected' : ''  }} value="NEW">NEW</option>
-                                                <option {{$measurement->status === 'ACCEPTED' ? 'selected' : ''  }} value="ACCEPTED">ACCEPTED</option>
-                                                <option {{$measurement->status === 'REJECTED' ? 'selected' : ''  }} value="REJECTED">REJECTED</option>
-                                            </select>
-                                        </div>
-                                        <div class="mb-2">
-                                            <input type="text" name="statusMemo" placeholder="Status memo" class="form-control form-control-sm">
-                                        </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>
-                                </span>
-                            </span>
-                        </td>
-                    </tr>
-                @endforeach
-                </tbody>
-            @else
-                <tbody>
-                <tr>
-                    <td class="text-secondary p-3">No device measurements for this patient</td>
-                </tr>
-                </tbody>
-            @endif
-        </table>
-    </div>
+{{--    <div class="">--}}
+{{--        <div class="d-flex align-items-start pb-2">--}}
+{{--            <h4 class="font-weight-bold m-0">Cellular Measurements</h4>--}}
+{{--        </div>--}}
+{{--        <table class="table table-striped table-sm table-bordered mb-0">--}}
+{{--            @if($patient->measurements && count($patient->measurements))--}}
+{{--                <thead>--}}
+{{--                <tr>--}}
+{{--                    <th class="px-2 text-secondary w-25">Created</th>--}}
+{{--                    <th class="px-2 text-secondary w-25">Category</th>--}}
+{{--                    <th class="px-2 text-secondary w-25">Value</th>--}}
+{{--                    <th class="px-2 text-secondary">Status</th>--}}
+{{--                </tr>--}}
+{{--                </thead>--}}
+{{--                <tbody>--}}
+{{--                @foreach($patient->deviceMeasurements as $measurement)--}}
+{{--                    <tr>--}}
+{{--                        <td class="px-2">{{ friendly_date_time($measurement->created_at) }}</td>--}}
+{{--                        <td class="px-2">{{ $measurement->measurement->device_category }}</td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            @if($measurement->measurement->device_category === 'WEIGHT')--}}
+{{--                                <b>{{ round(($measurement->measurement->value_weight / 1000)*2.20462, 1) }} lb</b>--}}
+{{--                            @elseif($measurement->measurement->device_category === 'BP')--}}
+{{--                                <b>{{ $measurement->measurement->systolic_bp_in_mm_hg }}/{{ $measurement->measurement->diastolic_bp_in_mm_hg }} mmHg</b>--}}
+{{--                            @endif--}}
+{{--                        </td>--}}
+{{--                        <td class="px-2">--}}
+{{--                            <span>--}}
+{{--                                <span>{{ $measurement->status }}</span>--}}
+{{--                                <span moe class="ml-2" relative>--}}
+{{--                                    <a href="#" start show><i class="fa fa-edit text-primary"></i></a>--}}
+{{--                                    <form url="/api/clientBdtMeasurement/updateStatus" right>--}}
+{{--                                        <input type="hidden" name="uid" value="{{ $measurement->uid }}">--}}
+{{--                                        <div class="mb-2">--}}
+{{--                                            <select name="status" class="form-control form-control-sm" required>--}}
+{{--                                                <option value="">-- select --</option>--}}
+{{--                                                <option {{$measurement->status === 'NEW' ? 'selected' : ''  }} value="NEW">NEW</option>--}}
+{{--                                                <option {{$measurement->status === 'ACCEPTED' ? 'selected' : ''  }} value="ACCEPTED">ACCEPTED</option>--}}
+{{--                                                <option {{$measurement->status === 'REJECTED' ? 'selected' : ''  }} value="REJECTED">REJECTED</option>--}}
+{{--                                            </select>--}}
+{{--                                        </div>--}}
+{{--                                        <div class="mb-2">--}}
+{{--                                            <input type="text" name="statusMemo" placeholder="Status memo" class="form-control form-control-sm">--}}
+{{--                                        </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>--}}
+{{--                                </span>--}}
+{{--                            </span>--}}
+{{--                        </td>--}}
+{{--                    </tr>--}}
+{{--                @endforeach--}}
+{{--                </tbody>--}}
+{{--            @else--}}
+{{--                <tbody>--}}
+{{--                <tr>--}}
+{{--                    <td class="text-secondary p-3">No device measurements for this patient</td>--}}
+{{--                </tr>--}}
+{{--                </tbody>--}}
+{{--            @endif--}}
+{{--        </table>--}}
+{{--    </div>--}}
 @endsection

+ 5 - 2
resources/views/app/patient/note/section_script.blade.php

@@ -119,7 +119,8 @@
         }
 
         function handleSubmitResponse(resp,_section, summaryContainer){
-            console.log(resp);
+            $('body').removeClass('blocking-mode');
+            hideMoeFormMask();
             if (resp.success) {
                 summaryContainer.html(resp.newSummaryHtml);
             }
@@ -134,7 +135,9 @@
             new MutationObserver(debounce(function() {
                 if(_elem.closest('.note-section').is('.edit')) {
                     // console.log('ALIX: In edit mode. Auto-saving', _elem.closest('.note-section').attr('data-section-template-name'))
-                    doSave(_elem.closest('.note-section'))
+                    $('body').addClass('blocking-mode');
+                    showMoeFormMask('blocking-overlay');
+                    doSave(_elem.closest('.note-section'));
                 }
                 else {
                     // console.log('ALIX: Not in edit mode. Not auto-saving', _elem.closest('.note-section').attr('data-section-template-name'))

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

@@ -40,8 +40,10 @@
             <table class="table table-condensed p-0 m-0">
                 <thead class="bg-light">
                 <tr>
+                    @if($pro->pro_type === 'ADMIN')
                     <th class="border-0"></th>
-                    <th class="px-3 border-0">#</th>
+                    @endif
+                    <th class="px-3 border-0">Chart #</th>
                     <th class="border-0">Patient</th>
                     <th class="border-0">Created At</th>
                     @if($showProgramsColumn)<th class="border-0">Program(s)</th>@endif
@@ -54,7 +56,9 @@
                 <tbody>
                 @foreach($patients as $patient)
                     <tr>
+                        @if($pro->pro_type === 'ADMIN')
                         <td>{{$loop->index + 1}}</td>
+                        @endif
                         <td class="px-3">
                             <a href="{{route('patients.view.dashboard', $patient)}}">
                                 {{$patient->chart_number}}

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

@@ -17,10 +17,10 @@
                             <a class="nav-link {{ strpos($routeName, 'patients.view.calendar') === 0 ? 'active' : '' }}"
                                href="{{ route('patients.view.calendar', ['patient' => $patient]) }}">Calendar</a>
                         </li>
-                        <li class="nav-item">
+                        {{--<li class="nav-item">
                             <a class="nav-link {{ strpos($routeName, 'patients.view.programs') === 0 ? 'active' : '' }}"
                                href="{{ route('patients.view.programs', ['patient' => $patient]) }}">Programs</a>
-                        </li>
+                        </li>--}}
                         <li class="nav-item">
                             <a class="nav-link {{ strpos($routeName, 'patients.view.care-months') === 0 ? 'active' : '' }}"
                                href="{{ route('patients.view.care-months', ['patient' => $patient]) }}">Care Months</a>