浏览代码

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

Josh 4 年之前
父节点
当前提交
a54aafff67

+ 6 - 2
app/Http/Controllers/HomeController.php

@@ -67,7 +67,7 @@ class HomeController extends Controller
             $reimbursement["lastPaymentDate"] = '--';
         }
 
-         //if today is < 15th, next payment is 15th, else nextPayment is 
+         //if today is < 15th, next payment is 15th, else nextPayment is
          $today = strtotime(date('Y-m-d'));
          $todayDate = date('j', $today);
 
@@ -90,7 +90,7 @@ class HomeController extends Controller
         $expectedForRme = DB::select(DB::raw("SELECT coalesce(SUM(rme_expected_payment_amount),0) as expected_pay  FROM bill WHERE rme_pro_id = :performerProID  AND has_rme_been_paid = false AND is_cancelled = false"), ['performerProID'=>$performerProID])[0]->expected_pay;
         $expectedForRmm = DB::select(DB::raw("SELECT coalesce(SUM(rmm_expected_payment_amount),0) as expected_pay  FROM bill WHERE rmm_pro_id = :performerProID  AND has_rmm_been_paid = false AND is_cancelled = false"), ['performerProID'=>$performerProID])[0]->expected_pay;
         $expectedForNa = DB::select(DB::raw("SELECT coalesce(SUM(na_expected_payment_amount),0) as expected_pay  FROM bill WHERE na_pro_id = :performerProID  AND has_na_been_paid = false AND is_cancelled = false"), ['performerProID'=>$performerProID])[0]->expected_pay;
-       
+
         $totalExpectedAmount =  $expectedForHcp + $expectedForCm + $expectedForRme + $expectedForRmm + $expectedForNa;
         $reimbursement['nextPaymentAmount'] = '$'.$totalExpectedAmount;
 
@@ -139,4 +139,8 @@ class HomeController extends Controller
         }
         return view('app/mc', compact('page'));
     }
+
+    public function blank(Request $request) {
+        return view('app/blank');
+    }
 }

+ 1 - 1
app/Models/Client.php

@@ -27,7 +27,7 @@ class Client extends Model
     }
 
     public function notes(){
-        return $this->hasMany(Note::class, 'client_id', 'id')->orderBy('id', 'desc');
+        return $this->hasMany(Note::class, 'client_id', 'id')->orderBy('created_at', 'desc');
     }
 
     public function duplicateOf(){

+ 5 - 0
app/Models/Pro.php

@@ -39,4 +39,9 @@ class Pro extends Model
             ->orderBy('created_at', 'desc')
             ->first();
     }
+
+    public function hasRates() {
+        $numRates = ProRate::where('is_active', true)->where('pro_id', $this->id)->count();
+        return $numRates > 0;
+    }
 }

+ 21 - 1
public/css/style.css

@@ -188,4 +188,24 @@ body>nav.navbar {
 .cancelled-item {
     opacity: 0.5;
 }
-
+.cancelled-item:not(.always-clickable) * {
+    pointer-events: none;
+}
+.note-content:not([auto-edit]) {
+    padding: 1rem;
+    padding-bottom: 0;
+    cursor: pointer;
+    position: relative;
+}
+.note-content:not(.cancelled):not([auto-edit]):not(.readonly):after {
+    content: 'Click to change';
+    display: inline;
+    color: #535353;
+}
+.mcp-theme-1 .ql-container, .mcp-theme-1 .ql-toolbar {
+    border-left: 0;
+    border-right: 0;
+}
+.mcp-theme-1 .ql-editor[contenteditable] {
+    min-height: 120px;
+}

+ 2 - 0
public/css/z.css

@@ -6,6 +6,8 @@
     font-size: 0.9em;
     min-width: 92px;
     white-space: nowrap;
+} .z button:focus {
+    outline: none;
 } .z form input {
     display: block;
     margin-bottom: 3px;

+ 126 - 26
public/js/mc.js

@@ -67,7 +67,12 @@ var findEventHandlers = function (eventType, jqSelector) {
 
 window.top.addEventListener('popstate', function (event) {
     window.setTimeout(function () {
-        if (!event) return;
+        hideMask();
+        hideMoeFormMask();
+        if (!event || (!event.state && event.state !== '')) {
+            console.error('ALIX No state!', event, event.state);
+            return;
+        }
         var state = event.state;
         if (state === '') state = '/';
         if (state[0] !== '/') state = '/' + state;
@@ -75,8 +80,9 @@ window.top.addEventListener('popstate', function (event) {
     }, 0);
 });
 $(document).ready(function () {
-    if(window.location.href === window.top.location.href) {
-        window.location.href = '/mc' + window.location.pathname;
+
+    if(window.location.pathname === window.top.location.pathname) {
+        window.top.location.href = '/mc' + window.location.pathname;
         return;
     }
     // window.top.ensureRHS();
@@ -94,8 +100,10 @@ $(document).ready(function () {
     if (body.is('.stag_rhs_collapsed')) {
         icon.removeClass().addClass('fa fa-arrow-left');
     }
-    initPrimaryForm();
+    initCreateNote();
+    initQuillEdit();
     initFastLoad();
+    initPrimaryForm();
     if(typeof initializeCalendar !== 'undefined') {
         initializeCalendar();
     }
@@ -103,12 +111,13 @@ $(document).ready(function () {
         initIntakeEvents();
     }
 
-    // replace history on fresh load
+    // populate history on fresh load
     var target = window.top.location.pathname;
     if (target.indexOf('/mc') === 0) {
         target = target.split('/mc')[1];
     }
-    window.top.history.pushState(target, null, '/mc' + target);
+    fastLoad(target, true, false, true);
+
 });
 function enableTimeSpecificFields(_checked, _valueClass, _rangeClass) {
     if(_valueClass) $('.' + _valueClass).prop('disabled', _checked);
@@ -173,7 +182,6 @@ function initFastLoad(_parent = false) {
         $(_a)
             .off('click.fast-load')
             .on('click.fast-load', function () {
-                showMask();
                 fastLoad(this.href, true, true);
                 $('.dropdown-menu[aria-labelledby="practice-management"]')
                     .removeClass('show')
@@ -203,8 +211,10 @@ function onFastLoaded(_data, _href, _history) {
         content += '<script src="/js/yemi.js?_=4"></script>';
         targetParent.html(content);
         window.setTimeout(function() {
-            initPrimaryForm();
+            initCreateNote();
+            initQuillEdit();
             initFastLoad(targetParent);
+            initPrimaryForm();
         }, 50);
         if(typeof initializeCalendar !== 'undefined') {
             initializeCalendar();
@@ -212,38 +222,66 @@ function onFastLoaded(_data, _href, _history) {
         if(typeof initIntakeEvents !== 'undefined') {
             initIntakeEvents();
         }
+    } else {
+        // fallback
+        console.warn('MC: Target page failed: ' + _href);
+        targetParent.html('<p class="text-danger p-3 small">Target page not found or returned error: <b>' + _href + '</b></p>');
+    }
+    hideMask();
+}
+function fastLoad(_href, _history = true, _useCache = true, _replaceState = false) {
 
-        // push state
-        if (_history) {
-            var target = _href;
-            if (target.indexOf('//') !== -1) {
-                target = target.split('//')[1];
-                if (target.indexOf('/') !== -1) {
-                    target = target.substr(target.indexOf('/') + 1);
-                }
+    showMask();
+
+    if(_href === '') _href = '/';
+
+    // push state
+    if (_history) {
+        var target = _href;
+        if (target.indexOf('//') !== -1) {
+            target = target.split('//')[1];
+            if (target.indexOf('/') !== -1) {
+                target = target.substr(target.indexOf('/') + 1);
             }
+        }
+        if(target[0] === '/') target = target.substr(1);
+        if(_replaceState) {
+            window.top.history.replaceState(target, null, '/mc/' + target);
+            console.log('ALIX replaceState: [' + target + ']');
+        }
+        else {
             window.top.history.pushState(target, null, '/mc/' + target);
+            console.log('ALIX pushState: [' + target + ']');
         }
-
-    } else {
-        console.warn('Target page not found: ' + _href);
-        window.location.href = _href; // fallback
     }
-    // hideMask();
-}
-function fastLoad(_href, _history = true, _useCache = true) {
+
     if (_useCache && !!fastCache[_href]) {
         onFastLoaded(fastCache[_href], _href, _history);
     } else {
         $.get(_href, function(_data) {
             onFastLoaded(_data, _href, _history);
+        }).fail(function() {
+            onFastLoaded('error', _href, _history);
         });
     }
 }
 
-function initPrimaryForm() {
-    if($('.primary-form:visible').length) {
-        $('.primary-form:visible').first().find('input, textarea, select').first().focus().select();
+function initPrimaryForm(_form = false) {
+    var primaryForm = _form ? _form : $('.primary-form:visible');
+    if (primaryForm.length) {
+        primaryForm = primaryForm.first();
+        var rte = primaryForm.find('[contenteditable="true"]').first();
+        if(rte.length) {
+            rte.focus().select();
+        }
+        else {
+            if(primaryForm.find('[autofocus]:visible').length) {
+                primaryForm.find('[autofocus]:visible').first().focus().select();
+            }
+            else {
+                primaryForm.find('input:not([type="hidden"]):visible, textarea:visible, select:visible').first().focus().select();
+            }
+        }
     }
 }
 
@@ -254,3 +292,65 @@ function openInRHS(_url) {
     window.top.openInRHS(_url);
     return false;
 }
+
+function initCreateNote() {
+    $(document)
+        .off('click.create-note', '.create-auto-note-trigger')
+        .on('click.create-note', '.create-auto-note-trigger', function() {
+            showMask();
+            var clientUid = $(this).attr('data-patient-uid');
+            $.post('/api/note/createUsingFreeTextHtml', {
+                clientUid: clientUid,
+                hcpProUid: $(this).attr('data-hcp-uid'),
+                effectiveDateEST: $(this).attr('data-effective-date'),
+            }, function(_data) {
+                hideMask();
+                if (!_data.success) {
+                    toastr.error(_data.message);
+                }
+                else {
+                    fastLoad('/patients/view/' + clientUid + '/notes/view/' + _data.data, true, false);
+                }
+            }, 'json');
+        });
+}
+
+function initQuillEdit(_selector = '.note-content[auto-edit]') {
+
+    $(document)
+        .off('click.enable-edit', '.note-content:not([auto-edit]):not(.readonly)')
+        .on('click.enable-edit', '.note-content:not([auto-edit]):not(.readonly)', function() {
+            $(this).attr('auto-edit', 1);
+            initQuillEdit();
+            initPrimaryForm();
+        });
+
+    if(!$(_selector).length) return;
+    var noteUid = $(_selector).attr('data-note-uid');
+    var qe = new Quill(_selector, {
+        theme: 'snow'
+    });
+    var toolbar = $(qe.container).prev('.ql-toolbar');
+    var saveButton = $('<button class="btn btn-sm btn-primary w-auto px-3 py-0 text-sm text-white save-note-content">Save</button>');
+    toolbar.append(saveButton);
+    saveButton.on('click', function() {
+        $.post('/api/note/putFreeTextHtml', {
+            uid: noteUid,
+            freeTextHtml: qe.root.innerHTML,
+        }, function(_data) {
+            if (!_data.success) {
+                toastr.error(_data.message);
+            }
+            else {
+                // toastr.success('Note saved');
+                // saveButton.prop('disabled', true);
+                fastLoad(window.top.location.pathname.substr(3), false, false);
+            }
+        }, 'json');
+    });
+    // qe.on('text-change', function() {
+    //     saveButton.prop('disabled', false);
+    // });
+}
+
+

+ 12 - 5
public/js/yemi.js

@@ -120,12 +120,19 @@ var justLog = false; //THIS IS FOR TEST MODE, FORMS WILL NOT TRIGGER REFRESH/RED
 var pageReload = function () {
     setTimeout(function () {
         hideMoeFormMask();
-        var targetLocation = window.top.location.href.split('/mc')[1];
-        if(targetLocation[0] !== '/') targetLocation = '/' + targetLocation;
-        fastLoad(targetLocation, false, false);
+        fastReload();
     }, 500);
 };
 
+var fastReload = function() {
+    var targetLocation = window.top.location.pathname;
+    if(targetLocation.indexOf('/mc') === 0) {
+        targetLocation = targetLocation.substr(3);
+    }
+    if(targetLocation === '' || targetLocation[0] !== '/') targetLocation = '/' + targetLocation;
+    fastLoad(targetLocation, false, false);
+}
+
 if (typeof String.prototype.startsWith != 'function') {
     // see below for better implementation!
     String.prototype.startsWith = function (str) {
@@ -296,8 +303,8 @@ jQuery(document).ready(function () {
                             $(realForm)[0].reset();
                             showMoeFormMask();
                             setTimeout(function() {
-                                $(realForm).find('input:not([type="hidden"]), textarea, select').first().select().focus();
-                            }, 0);
+                                initPrimaryForm($(realForm));
+                            }, 100);
                         }
                     }
                 }

+ 7 - 0
resources/views/app/blank.blade.php

@@ -0,0 +1,7 @@
+@extends ('layouts.template')
+
+@section('content')
+    <div class="mcp-theme-1">
+        <p class="p-3 text-secondary small">Please wait...</p>
+    </div>
+@endsection

+ 16 - 4
resources/views/app/mc.blade.php

@@ -15,7 +15,7 @@
 <body class="h-100">
     <div class="row mx-0 h-100">
         <div class="col-9 px-0 app-left-panel">
-            <iframe id="stag_mcp_lhs" src="{{ $page }}" frameborder="0" class="h-100 w-100"></iframe>
+            <iframe id="stag_mcp_lhs" src="/blank" frameborder="0" class="h-100 w-100"></iframe>
         </div>
         <div class="col-3 border-left app-right-panel pr-1">
             <iframe id="stag_mcp_rhs" src="/pro/meet" frameborder="0" class="h-100 w-100"></iframe>
@@ -33,7 +33,7 @@
         };
         window.ensureRHS = function() {
             if(!$('#stag_mcp_rhs').length) window.location.reload();
-        }
+        };
         window.toggleRHS = function() {
             var body = $('body'), leftPanel = $('.app-left-panel');
             if(!body.is('.stag_rhs_collapsed')) {
@@ -52,7 +52,7 @@
                 body.removeClass('stag_rhs_collapsed');
                 return 'expanded';
             }
-        }
+        };
         window.showRHS = function() {
             var body = $('body'), leftPanel = $('.app-left-panel');
             if(body.is('.stag_rhs_collapsed')) {
@@ -64,7 +64,19 @@
                 body.removeClass('stag_rhs_collapsed');
                 return 'expanded';
             }
-        }
+        };
+        $(document).ready(function() {
+            var body = $('body'), leftPanel = $('.app-left-panel');
+            if(!{{$pro->is_enrolled_as_mcp ? 1 : 0}}) {
+                if(!body.is('.stag_rhs_collapsed')) {
+                    body.addClass('stag_rhs_collapsed');
+                    leftPanel.attr('data-prev-style', leftPanel.attr('style'));
+                    leftPanel.attr('style', '');
+                    leftPanel.removeClass('col-9').addClass('col-12');
+                    return 'collapsed';
+                }
+            }
+        });
     </script>
 </body>
 </html>

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

@@ -5,6 +5,9 @@
     <?php $patients = [1,2,3,4]; ?>
 
     <div class="p-3 mcp-theme-1">
+        @if(!$pro->hasRates() && !$pro->is_enrolled_as_mcp)
+            <div class="alert alert-info">Not allowed</div>
+        @else
         <div class="col-12 col-lg-6 px-0">
             <div class="card d-block mb-3" moe="">
 
@@ -58,6 +61,7 @@
                 </div>
             </div>
         </div>
+        @endif
     </div>
 
 @endsection

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

@@ -227,7 +227,8 @@
                                             <select class="form-control form-control-sm" name="proUid">
                                                 <option value="">-- Select Pro --</option>
                                                 @foreach($pros as $iPro)
-                                                    <option value="{{ $iPro->uid }}">{{ $iPro->displayName() }}</option>
+                                                    <option {{ $iPro->uid === $pro->uid ? 'selected' : '' }}
+                                                            value="{{ $iPro->uid }}">{{ $iPro->displayName() }}</option>
                                                 @endforeach
                                             </select>
                                         </div>
@@ -243,7 +244,7 @@
                                                 $d = date('d');
                                             }
                                             ?>
-                                            <input type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}" class="form-control form-control-sm" name="effectiveDate"
+                                            <input autofocus type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}" class="form-control form-control-sm" name="effectiveDate"
                                                    value="" placeholder="Effective Date">
                                         </div>
                                         <div class="mb-2">
@@ -378,7 +379,8 @@
                                     <select class="form-control form-control-sm" name="proUid">
                                         <option value="">-- Select Pro --</option>
                                         @foreach($pros as $iPro)
-                                            <option value="{{ $iPro->uid }}">{{ $iPro->displayName() }}</option>
+                                            <option {{ $iPro->uid === $pro->uid ? 'selected' : '' }}
+                                                    value="{{ $iPro->uid }}">{{ $iPro->displayName() }}</option>
                                         @endforeach
                                     </select>
                                 </div>
@@ -394,7 +396,7 @@
                                         $d = date('d');
                                     }
                                     ?>
-                                    <input type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}" class="form-control form-control-sm" name="effectiveDate"
+                                    <input autofocus type="date" min="{{ date($y . '-' . $m . '-01') }}" max="{{ date($y . '-' . $m . '-' . $d) }}" class="form-control form-control-sm" name="effectiveDate"
                                            value="" placeholder="Effective Date">
                                 </div>
                                 <div class="mb-2">

+ 81 - 3
resources/views/app/patient/intake.blade.php

@@ -1,12 +1,15 @@
 @extends ('layouts.patient')
 @section('inner-content')
     <?
-    	$myName = implode(' ', array_filter([$patient->mcp->name_first, $patient->mcp->name_last]));
+        $myName = '-';
+        if($patient->mcp) {
+            $myName = implode(' ', array_filter([$patient->mcp->name_first, $patient->mcp->name_last]));
+        }
     	$theirName = ($patient->name_prefix ?? ($patient->sex === 'M' ? 'Mr.' : 'Ms.'))
     		.' '.($patient->name_last ?? $patient->name_first);
     ?>
 
-    <section class=intake>
+    <section class="intake primary-form">
         <p>Hello, {{$theirName}}. My name is {{$myName}}.</p>
         <p>We will have about 15-20 minutes together, and I’m going to ask you some questions to help customize your personalized wellness plan that we will send along with the weight scale, blood pressure cuff, and infrared thermometer - that you can use to stay healthy during quarantine. Is this OK with you?</p>
 
@@ -194,7 +197,7 @@
         </ol>
 
         <button>Save</button>
-        <button>Sign & Submit</button>
+        <button id="sign-and-submit">Sign & Submit</button>
     </section>
 
     <style>
@@ -254,6 +257,81 @@
                     newInput.focus()
                 })
             )
+
+            $('#sign-and-submit').off('click.sign').on('click.sign', function() {
+
+                // showMask();
+
+                // prepare note content
+                var content = $('<div/>');
+                content.append($('.intake.primary-form').clone(true));
+                content.find('button').remove();
+
+                // change checkboxes to tick/empty
+                content.find('input[type="checkbox"]').each(function() {
+                    var checked = $(this).prop('checked');
+                    $(this).replaceWith(
+                        $('<b/>')
+                            .css({
+                                display: 'inline-block',
+                                minWidth: '18px',
+                                marginRight: '13px',
+                            })
+                            .text(checked ? '✔' : '-')
+                    );
+                });
+
+                // change other inputs to text
+                content.find('input').each(function() {
+                    $(this).replaceWith(
+                        $('<b/>')
+                            .css({
+                                display: 'inline-block',
+                                paddingLeft: '6px',
+                                paddingRight: '6px',
+                            })
+                            .text(this.value)
+                    );
+                });
+
+                content.addClass('intake');
+
+                // create note
+                $.post('/api/note/createUsingFreeTextHtml', {
+                    clientUid: '{{ $patient->uid  }}',
+                    hcpProUid: '{{ $pro->uid  }}',
+                    effectiveDateEST: '{{ date('Y-m-d') }}',
+                    title: 'Visit Note',
+                    freeTextHtml: content[0].outerHTML
+                }, function(_data) {
+                    if (!_data.success) {
+                        toastr.error(_data.message);
+                    }
+                    else {
+                        var noteUid = _data.data;
+
+                        // update visit info
+                        $.post('/api/client/updateMcpOnboardingVisitInfo', {
+                            uid: '{{$patient->uid}}',
+                            hasMcpDoneOnboardingVisit: 'YES',
+                            mcpOnboardingVisitDate: '{{date('Y-m-d')}}',
+                            mcpOnboardingVisitNoteUid: noteUid,
+                        }, function(_data) {
+                            if (!_data.success) {
+                                toastr.error(_data.message);
+                            }
+                            else {
+                                toastr.success('Patient onboarding complete');
+                                hideMask();
+                                fastLoad('/patients/view/{{$patient->uid}}', true, false);
+                            }
+                        }, 'json');
+                        return false;
+
+                    }
+                }, 'json');
+
+            });
         }
 	</script>
 @endsection

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

@@ -23,7 +23,7 @@
                 <i class="fa fa-chevron-left"></i>
             </a>
             <div>
-                <span class="text-dark font-weight-bold">{{$note->title}}
+                <span class="text-dark font-weight-bold">Note
                     <span class="text-secondary font-weight-normal">{{ $note->is_cancelled ? '(CANCELLED)' : '' }}</span>
                 </span>
             </div>
@@ -31,7 +31,7 @@
     </div>
 
     <div class="card mb-0 {{ $note->is_cancelled ? 'cancelled-item' : '' }}">
-        <div class="card-header d-flex align-items-start px-3">
+        <div class="card-header d-flex align-items-start px-3 border-bottom-0">
             <div class="pr-2">
                 {{$note->title}}
                 <div moe>
@@ -178,6 +178,7 @@
                     </div>--}}
                 </div>
                 <div class="pl-2 border-left">
+                    @if($patient->has_mcp_done_onboarding_visit === 'YES')
                     <div class="d-flex justify-content-end">
                         <div moe relatve class="">
                             <a class="" href="" show start>Create Bill</a>
@@ -212,6 +213,7 @@
                             </form>
                         </div>
                     </div>
+                    @endif
                     <div class="d-flex justify-content-end">
                         @if(!$note->is_cancelled)
                         <div moe relatve
@@ -237,13 +239,17 @@
                 </div>
             </div>
         </div>
-        <div class="card-body p-3">
+        <div class="card-body p-0">
             <div>
 
-                <div class="mb-2">
+                <div class="mb-3">
                     <div>
-                        {!! $note->free_text_html !!}
-                        <div moe class="d-inline">
+                        <div class="primary-form">
+                            <div class="note-content {{ $note->is_cancelled ? 'cancelled' : '' }} {{ $note->is_signed_by_hcp ? 'readonly' : '' }}"
+                                 data-note-uid="{{ $note->uid  }}"
+                                 {{ !$note->is_cancelled && empty($note->free_text_html) ? 'auto-edit' : '' }}>{!! $note->free_text_html !!}</div>
+                        </div>
+                        {{--<div moe class="d-inline">
                             <a show start><i class="fa fa-edit"></i></a>
                             <form url="/api/note/putFreeTextHtml">
                                 <input type="hidden" name="uid" value="{{$note->uid}}">
@@ -257,23 +263,24 @@
                                     <button class="btn btn-default border btn-sm" cancel>Cancel</button>
                                 </div>
                             </form>
-                        </div>
+                        </div>--}}
                     </div>
                 </div>
 
                 @if($note->bills->count())
-                    <div class="mt-2">
-                        <table class="table table-sm tabe-striped mb-0">
+                    <div class="mt-2 px-3">
+                        <p class="font-weight-bold mb-2 text-secondary">Bills</p>
+                        <table class="table table-sm tabe-striped mb-3 border-left border-right border-bottom">
                             <thead class="bg-light">
                             <tr>
-                                <th class="border-bottom-0 w-25">Code</th>
+                                <th class="border-bottom-0 w-25 pl-3">Code</th>
                                 <th class="border-bottom-0"></th>
                             </tr>
                             </thead>
                             <tbody>
                             @foreach ($note->bills as $bill)
                                 <tr>
-                                    <td class="{{ $bill->is_cancelled ? 'text-secondary' : '' }}">{{$bill->code}}</td>
+                                    <td class="pl-3 {{ $bill->is_cancelled ? 'text-secondary' : '' }}">{{$bill->code}}</td>
                                     <td>
                                         <div class="d-flex align-items-center">
                                             @if(!$bill->is_cancelled)
@@ -323,6 +330,45 @@
                             </tbody>
                         </table>
                     </div>
+                @else
+                    <div class="my-3 px-3 d-flex">
+                        <p class="font-weight-bold mb-0 text-secondary">No bills in this note</p>
+                        @if($patient->has_mcp_done_onboarding_visit === 'YES')
+                        <span class="mx-2 text-secondary">|</span>
+                        <span moe class="">
+                            <a class="" href="" show start>Create Bill</a>
+                            <form url="/api/bill/createForNote">
+                                <input type="hidden" name="noteUid" value="{{$note->uid}}">
+                                <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" required>
+                                </div>
+                                <div class="mb-2">
+                                    <input type="text" name="code" placeholder="Code" class="form-control form-control-sm" required>
+                                </div>
+                                <div class="mb-2">
+                                    <input type="text" name="reason1" placeholder="Reason 1" class="form-control form-control-sm">
+                                </div>
+                                <div class="mb-2">
+                                    <input type="text" name="reason2" placeholder="Reason 2" class="form-control form-control-sm">
+                                </div>
+                                <div class="mb-2">
+                                    <input type="text" name="serviceLocation" placeholder="Service Location" class="form-control form-control-sm">
+                                </div>
+                                <div class="mb-2">
+                                    <input type="text" name="modifier" placeholder="Modifier" class="form-control form-control-sm">
+                                </div>
+                                <div class="mb-2">
+                                    <input type="number" name="numberOfUnits" placeholder="Number of Units" class="form-control form-control-sm">
+                                </div>
+                                <div class="">
+                                    <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </span>
+                        @endif
+                    </div>
                 @endif
             </div>
         </div>

+ 13 - 7
resources/views/app/patient/notes.blade.php

@@ -2,6 +2,7 @@
 
 @section('inner-content')
 
+    <?php /*
     @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">
@@ -58,13 +59,17 @@
                 </div>
             </h6>
         </div>
-    @else
+    @else */ ?>
 
         <div class="pt-2 d-flex align-items-start">
             <h6 class="my-0 text-secondary d-flex align-items-start">
                 <span class="font-weight-bold text-secondary">Notes</span>
                 <span class="mx-2 text-secondary">|</span>
-                <div moe>
+                <a href="#" class="py-0 mb-0 create-auto-note-trigger"
+                   data-patient-uid="{{ $patient->uid  }}"
+                   data-hcp-uid="{{ $pro->uid }}"
+                   data-effective-date="{{ date('Y-m-d') }}">Add</a>
+                <?php /*<div moe>
                     <a start show class="py-0 mb-3">Add</a>
                     <form url="/api/note/createUsingFreeTextHtml" class="mcp-theme-1">
                         <input type="hidden" name="clientUid" value="{{$patient->uid}}">
@@ -105,7 +110,7 @@
                             <button cancel class="btn btn-sm btn-default border">Cancel</button>
                         </div>
                     </form>
-                </div>
+                </div> */ ?>
             </h6>
         </div>
 
@@ -113,21 +118,22 @@
             <thead>
             <tr>
                 <th class="px-2 text-secondary border-bottom-0">Created</th>
-                <th class="px-2 text-secondary border-bottom-0">Title</th>
+                <th class="px-2 text-secondary border-bottom-0">Effective Date</th>
                 <th class="px-2 text-secondary border-bottom-0">HCP</th>
                 {{--<th class="px-2 text-secondary border-bottom-0">Ally</th>--}}
             </tr>
             </thead>
             <tbody>
             @foreach ($patient->notes as $note)
-                <tr class="{{ $note->is_cancelled ? 'cancelled-item' : '' }}">
+                <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
                     <td class="px-2">
                         {{ friendly_date_time($note->created_at, true) }}
                     </td>
                     <td class="px-2">
                         <a href="/patients/view/{{ $patient->uid }}/notes/view/{{ $note->uid }}" class="font-weight-bold">
-                            {{ $note->title }}
+                            {{ friendly_date_time($note->effective_dateest, false) }}
                         </a>
+                        <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
                     </td>
                     <td class="px-2">
                         {{$note->hcpPro ? $note->hcpPro->name_display: '-'}}
@@ -140,5 +146,5 @@
             </tbody>
         </table>
 
-    @endif
+    <?php /* @endif */ ?>
 @endsection

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

@@ -19,7 +19,7 @@
                     <th class="border-0">Name</th>
                     <th class="border-0">DOB</th>
                     <th class="border-0">Sex</th>
-                    <th class="border-0">Ins.</th>
+                    <th class="border-0">MCN</th>
                     <th class="border-0">PCP</th>
                     <th class="border-0">Assistant</th>
                     <th class="border-0">Next E&M</th>

+ 1 - 1
resources/views/app/practice-management/financial-transactions.blade.php

@@ -54,7 +54,7 @@
                                 <b>{{ $transaction->bill->code }}</b>
                                 -
                                 <a href="/patients/view/{{ $transaction->client->uid }}/notes/view/{{ $transaction->bill->note->uid }}">
-                                    <b>{{ $transaction->bill->note->title }}</b>
+                                    <b>Note</b>
                                 </a>
                             @endif
                             @if(!empty($transaction->bill->reason1))

+ 4 - 3
resources/views/app/video/call.blade.php

@@ -119,9 +119,6 @@
                                 self.clientUid = _data.data;
                                 self.videoActive = true;
                                 self.startOpenTokSession();
-
-                                // navigate to this patient on LHS
-                                window.top.openInLHS('/patients/view/' + self.clientUid + '/intake', true, false);
                             }
                         }
                     }, 'json');
@@ -420,6 +417,10 @@
                     })
                         .done(function (_data) {
                             console.log(_data);
+
+                            // navigate to this patient on LHS
+                            window.top.openInLHS('/patients/view/' + self.clientUid + '/intake', true, false);
+
                         })
                         .fail(function (_data) {
                             console.warn(_data);

+ 61 - 15
resources/views/layouts/patient.blade.php

@@ -86,9 +86,11 @@
                             $online = $patient->is_online ? 'online' : '';
                             $patientName = implode(', ', array_filter([$patient->name_last, $patient->name_first]));
 
-                            $confirmedCell = $patient->is_cell_number_confirmed ? $patient->cell_number : null;
-                            $confirmedEmail = $patient->is_email_address_confirmed ? $patient->email_address : null;
+                            $confirmedCell = empty($patient->cell_number) ? '-' : $patient->cell_number;
+                            $confirmedEmail = empty($patient->email_address) ? '-' : $patient->email_address;
+
                             $location = implode(', ', array_filter([$patient->home_address_city, $patient->home_address_state]));
+                            $location = empty($location) ? '-' : $location;
 
                             $mcpName = $patient->mcp ? implode(', ', array_filter([$patient->mcp->name_last, $patient->mcp->name_first])) : null;
                             $cmName = $patient->cm ? implode(', ', array_filter([$patient->cm->name_last, $patient->cm->name_first])) : null;
@@ -178,13 +180,53 @@
                                         <li><i class="fa fa-phone-alt" aria-hidden="true"></i> {{$confirmedCell}}</li>
                                         <li><i class="fa fa-envelope" aria-hidden="true"></i> {{$confirmedEmail}}</li>
                                         <li><i class="fa fa-map-marker-alt" aria-hidden="true"></i> {{$location}}</li>
+                                        <li>
+                                            <div moe>
+                                                <a start show><i class="fa fa-edit"></i></a>
+                                                <form url="/api/client/putContactInfo" class="mcp-theme-1">
+                                                    <input type="hidden" name="uid" value="{{$patient->uid}}">
+                                                    <div class="mb-2">
+                                                        <input type="tel"
+                                                               class="form-control form-control-sm"
+                                                               name="cellNumber"
+                                                               placeholder="Phone Number"
+                                                               value="{{ $patient->cell_number }}">
+                                                    </div>
+                                                    <div class="mb-2">
+                                                        <input type="text"
+                                                               class="form-control form-control-sm"
+                                                               name="email"
+                                                               placeholder="Email"
+                                                               value="{{ $patient->email_address }}">
+                                                    </div>
+                                                    <div class="mb-2">
+                                                        <input type="text"
+                                                               class="form-control form-control-sm"
+                                                               name="city"
+                                                               placeholder="City"
+                                                               value="{{ $patient->home_address_city }}">
+                                                    </div>
+                                                    <div class="mb-2">
+                                                        <input type="text"
+                                                               class="form-control form-control-sm"
+                                                               name="state"
+                                                               placeholder="State"
+                                                               value="{{ $patient->home_address_state }}">
+                                                    </div>
+                                                    <div>
+                                                        <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                                                        <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                                    </div>
+                                                </form>
+                                            </div>
+                                        </li>
                                     </ul>
                                     <div class=separators>
                                         <div>Joined <?=$memberSince?></div>
                                         <div><label>PCP:</label> {{$mcpName}}</div>
                                         <div><label>MA:</label> {{$cmName}}</div>
                                     </div>
-                                    @if($patient->mcp && $patient->has_mcp_done_onboarding_visit !== 'YES')
+                                    @if($patient->has_mcp_done_onboarding_visit !== 'YES')
                                     <div class="text-dark d-flex align-items-center">
                                         <span class="mr-2">
                                             <i class="fa fa-exclamation-triangle"></i>
@@ -242,11 +284,15 @@
                                     </div>
                                 </section>
                                 <section class=vbox>
-                                    <div moe relative
-                                         title="Create Note">
+                                    <button class="create-auto-note-trigger"
+                                            data-patient-uid="{{ $patient->uid  }}"
+                                            data-hcp-uid="{{ $pro->uid }}"
+                                            data-effective-date="{{ date('Y-m-d') }}">+ Note</button>
+                                    <?php /* <div moe relative
+                                         >
                                         <a start show>
                                             <!-- <i class="fa fa-plus-circle"></i> -->
-                                            <button>+ Note</button>
+                                            <button id="btn-create-note" >+ Note</button>
                                         </a>
                                         <form url="/api/note/createUsingFreeTextHtml" right class="mcp-theme-1">
                                             <input type="hidden" name="clientUid" value="{{$patient->uid}}">
@@ -260,28 +306,28 @@
                                                     @endforeach
                                                 </select>
                                             </div>--}}
-                                            <div class="mb-2">
+                                            {{--<div class="mb-2">
                                                 <input type="text" name="title" placeholder="Title" class="form-control form-control-sm">
-                                            </div>
+                                            </div>--}}
                                             <div class="mb-2">
-                                                <label class="text-secondary text-sm">Effective Date</label>
-                                                <input type="date" name="effectiveDateEST" placeholder="Effective Date" class="form-control form-control-sm">
+                                                <label class="text-secondary text-sm mb-2">Effective Date</label>
+                                                <input type="date" name="effectiveDateEST" placeholder="Effective Date" class="form-control form-control-sm"
+                                                       value="{{ date('Y-m-d') }}" required>
                                             </div>
-                                            <div class="mb-2">
+                                            {{--<div class="mb-2">
                                                 <label class="text-secondary text-sm">Effective Time</label>
                                                 <input type="time" name="effectiveTime" placeholder="Effective Time" class="form-control form-control-sm">
                                             </div>
                                             <div class="mb-2">
                                                 <textarea name="freeTextHtml" id="" cols="30" rows="5" placeholder="Content" class="form-control form-control-sm"></textarea>
-                                            </div>
+                                            </div>--}}
                                             <div>
                                                 <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
                                                 <button cancel class="btn btn-sm btn-default border">Cancel</button>
                                             </div>
                                         </form>
-                                    </div>
-                                    <button>Pt. Ed.</button>
-                                    <button onclick="return window.top.openInRHS('/pro/meet/{{ $patient->uid }}')">Video</button>
+                                    </div> */ ?>
+                                    <button onclick="return openInRHS('/pro/meet/{{ $patient->uid }}')">Video</button>
                                     {{--<div moe relative>
                                         <a start show>
                                             <button>+ Appointment</button>

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

@@ -10,6 +10,10 @@
     <!-- Fonts -->
     <link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
 
+    {{-- Quill RTE --}}
+    <link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
+    <script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
+
     <!-- <link href="{{ asset('bootstrap-4.5.0/css/bootstrap.css') }}" rel="stylesheet"> -->
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.1/css/all.min.css">
     <link href="{{ asset('/css/app.css') }}" rel="stylesheet">
@@ -45,7 +49,9 @@
             <ul class="navbar-nav mr-auto">
                 <li class="nav-item"><a class="nav-link" href="{{ route('dashboard') }}"><i class="mr-1 fas fa-tachometer-alt"></i> Dashboard</a> </li>
                 <li class="nav-item"><a class="nav-link" href="{{ route('patients') }}"><i class="mr-1 fas fa-user-injured"></i> Patients</a> </li>
-                <li class="nav-item"><a class="nav-link" href="{{ route('new-patient') }}"><i class="mr-1 fas fa-user-plus"></i> New Patient</a> </li>
+                @if($pro->hasRates() || $pro->is_enrolled_as_mcp)
+                    <li class="nav-item"><a class="nav-link" href="{{ route('new-patient') }}"><i class="mr-1 fas fa-user-plus"></i> New Patient</a> </li>
+                @endif
                 <li class="nav-item dropdown">
                     <a class="nav-link dropdown-toggle" href="#" id="practice-management" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="mr-1 fas fa-tasks"></i> Practice Management</a>
                     <div class="dropdown-menu" aria-labelledby="practice-management">
@@ -59,7 +65,7 @@
                 </li>
             </ul>
             <div class="d-flex align-items-center">
-                <p class="text-white my-0 mr-3">Hello, <b>{{ $pro->name_first }}!</b></p>
+                <p class="text-white my-0 mr-3">Hello, <b title="Cell# {{$pro->cell_number}}">{{ $pro->name_first }}!</b></p>
                 <form action="{{ route('logout') }}" method="post" target="_top">
                     @csrf
                     <button class="btn btn-link text-light">

+ 2 - 0
routes/web.php

@@ -27,6 +27,8 @@ Route::post('logout', 'LoginController@logout')->name('logout');
 
 Route::middleware('pro.auth')->group(function () {
 
+    Route::get('/blank', 'HomeController@blank')->name('blank');
+
     Route::get('/', 'HomeController@dashboard')->name('dashboard');
 
     Route::get('/new-patient', 'HomeController@newPatient')->name('new-patient');