Browse Source

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

root 4 years ago
parent
commit
5a0caa00cb
37 changed files with 2064 additions and 481 deletions
  1. 30 0
      app/Helpers/helpers.php
  2. 121 60
      app/Http/Controllers/HomeController.php
  3. 5 0
      app/Http/Controllers/PatientController.php
  4. 14 1
      app/Http/Controllers/PracticeManagementController.php
  5. 29 0
      app/Models/Claim.php
  6. 12 0
      app/Models/ClaimVersion.php
  7. 16 0
      app/Models/Company.php
  8. 12 0
      app/Models/CompanyLocation.php
  9. 12 0
      app/Models/CompanyPayer.php
  10. 22 0
      app/Models/CompanyPro.php
  11. 32 0
      app/Models/CompanyProPayer.php
  12. 14 0
      app/Models/MBClaim.php
  13. 16 1
      app/Models/Note.php
  14. 12 0
      app/Models/Payer.php
  15. 47 0
      app/Models/Pro.php
  16. 16 0
      public/css/style.css
  17. 2 2
      public/js/mc.js
  18. 25 2
      resources/views/app/dashboard.blade.php
  19. 23 1
      resources/views/app/dashboard/measurements.blade.php
  20. 43 6
      resources/views/app/log-in-as.blade.php
  21. 301 0
      resources/views/app/patient/mb-claim-single.blade.php
  22. 98 89
      resources/views/app/patient/note/_create-bill.blade.php
  23. 448 85
      resources/views/app/patient/note/dashboard.blade.php
  24. 21 0
      resources/views/app/patient/note/dashboard_script.blade.php
  25. 31 1
      resources/views/app/patient/notes.blade.php
  26. 1 1
      resources/views/app/patient/partials/mcp-queue.blade.php
  27. 59 12
      resources/views/app/patient/partials/packs.blade.php
  28. 2 2
      resources/views/app/patient/settings.blade.php
  29. 291 0
      resources/views/app/practice-management/billing-manager-v1.blade.php
  30. 172 86
      resources/views/app/practice-management/billing-manager.blade.php
  31. 8 0
      resources/views/app/practice-management/billing-report.blade.php
  32. 1 117
      resources/views/app/practice-management/shipment.blade.php
  33. 49 0
      resources/views/app/practice-management/supply-orders-cancelled-but-unacknowledged.blade.php
  34. 10 1
      resources/views/app/practice-management/treatment-services-util.blade.php
  35. 46 3
      resources/views/layouts/patient.blade.php
  36. 17 11
      resources/views/layouts/template.blade.php
  37. 6 0
      routes/web.php

+ 30 - 0
app/Helpers/helpers.php

@@ -10,6 +10,36 @@ use App\Models\AppSession;
 //require_once './class.Diff.php';
 use Soundasleep\Html2Text as Html2Text;
 
+if(!function_exists('queryLineExcept')) {
+    function queryLineExcept($except = []) {
+        $params = request()->all();
+        $final = [];
+        foreach ($params as $k => $v) {
+            if(in_array($k, $except) === FALSE) {
+                $final[] = "$k=" . urlencode($v);
+            }
+        }
+        return implode('&', $final);
+    }
+}
+
+if(!function_exists('sortColumnHead')) {
+    function sortColumnHead($url, $label, $sortKey, $defaultDirection = 'ASC') {
+        $currentSortKey = request()->input('sort');
+        $currentDir = request()->input('dir');
+        $targetDir = $currentDir ? ($currentDir === 'ASC' ? 'DESC' : 'ASC') : $defaultDirection;
+        echo '<a href="' . $url . '?sort=' . $sortKey . '&dir=' . $targetDir . '&' . queryLineExcept(['sort', 'dir']) . '">' . $label . '</a>';
+        if($currentSortKey === $sortKey) {
+            if($currentDir === 'ASC') {
+                echo "&nbsp;&nbsp;↑";
+            }
+            elseif($currentDir === 'DESC') {
+                echo "&nbsp;&nbsp;↓";
+            }
+        }
+    }
+}
+
 if(!function_exists('html2Text')) {
     function html2Text($old, $new){
 

+ 121 - 60
app/Http/Controllers/HomeController.php

@@ -205,14 +205,15 @@ class HomeController extends Controller
                 $query->where('mcp_pro_id', $performer->pro->id)
                     ->where('has_mcp_done_onboarding_visit', '!=', 'YES');
             })
-            ->orWhere(function ($query) {   // mcp of any client program and program OB pending
-                $query->where(function ($_query) {
-                    $_query->select(DB::raw('COUNT(id)'))
-                        ->from('client_program')
-                        ->whereColumn('client_id', 'client.id')
-                        ->where('has_mcp_done_onboarding_visit', '!=', 'YES');
-                }, '>=', 1);
-            })->count();
+//            ->orWhere(function ($query) {   // mcp of any client program and program OB pending
+//                $query->where(function ($_query) {
+//                    $_query->select(DB::raw('COUNT(id)'))
+//                        ->from('client_program')
+//                        ->whereColumn('client_id', 'client.id')
+//                        ->where('has_mcp_done_onboarding_visit', '!=', 'YES');
+//                }, '>=', 1);
+//            })
+            ->count();
         $keyNumbers['patientsNotSeenYet'] = $patientNotSeenYet;
 
         $pendingBillsToSign = Bill::where(function ($query) use ($performerProID) {
@@ -256,6 +257,12 @@ class HomeController extends Controller
             ->where('is_cancellation_acknowledged', false)
             ->count();
 
+        // unacknowledged cancelled supply orders for authed pro
+        $keyNumbers['unacknowledgedCancelledSupplyOrders'] = SupplyOrder::where('signed_by_pro_id', $performerProID)
+            ->where('is_cancelled', true)
+            ->where('is_cancellation_acknowledged', false)
+            ->count();
+
         // patientsHavingBirthdayToday
         $queryClients = $this->performer()->pro->getAccessibleClientsQuery();
         $keyNumbers['patientsHavingBirthdayToday'] = $queryClients
@@ -304,50 +311,6 @@ class HomeController extends Controller
 
         $milliseconds = strtotime(date('Y-m-d')) . '000';
 
-        // $measurements = $performer->pro->getMeasurements();
-
-        $myClientIDs = [];
-        if ($performer->pro->pro_type != 'ADMIN') {
-            $myClientIDs = $this->getMyClientIds();
-        }
-
-        $measurements = DB::select(
-            DB::raw(
-"
-SELECT measurement.uid as uid,
-       care_month.uid as care_month_uid,
-       measurement.label,
-       measurement.value,
-       measurement.sbp_mm_hg,
-       measurement.dbp_mm_hg,
-       measurement.numeric_value,
-       measurement.ts,
-       client.uid as client_uid,
-       client.name_last,
-       client.name_first,
-       care_month.rm_total_time_in_seconds
-FROM measurement
-         join client on measurement.client_id = client.id
-         join care_month on client.id = care_month.client_id
-WHERE measurement.label NOT IN ('SBP', 'DBP')
-  AND (measurement.is_cellular_zero = FALSE or measurement.is_cellular_zero IS NULL)
-  AND measurement.is_removed IS FALSE
-  AND measurement.ts IS NOT NULL
-  AND measurement.client_bdt_measurement_id IS NOT NULL
-  AND (measurement.status IS NULL OR (measurement.status <> 'ACK' AND measurement.status <> 'INVALID_ACK'))
-  AND EXTRACT(MONTH from care_month.start_date) = EXTRACT(MONTH from now())
-  AND EXTRACT(YEAR from care_month.start_date) = EXTRACT(YEAR from now())
-" .
-                (
-                    $performer->pro->pro_type != 'ADMIN' && count($myClientIDs) ?
-                        ' AND client.id IN (' . implode(", ", $myClientIDs) . ')' :
-                        ''
-                )
-            ) .
-" ORDER BY measurement.ts DESC LIMIT 12"
-
-        );
-
         // bills & claims
         $businessNumbers = [];
 
@@ -401,11 +364,93 @@ WHERE measurement.label NOT IN ('SBP', 'DBP')
             ->whereRaw('created_by_session_id IN (SELECT id FROM app_session where pro_id = ?)', [$performer->pro->id])
             ->count();
 
-        return view('app/dashboard', compact('keyNumbers', 'reimbursement', 'milliseconds', 'measurements', 'businessNumbers',
+        return view('app/dashboard', compact('keyNumbers', 'reimbursement', 'milliseconds',
+            'businessNumbers',
             'incomingReports', 'tickets', 'supplyOrders',
             'numERx', 'numLabs', 'numImaging', 'numSupplyOrders'));
     }
 
+    public function dashboardMeasurementsTab(Request $request, $page = 1) {
+
+        $performer = $this->performer();
+
+        $myClientIDs = [];
+        if ($performer->pro->pro_type != 'ADMIN') {
+            $myClientIDs = $this->getMyClientIds();
+            $myClientIDs = implode(", ", $myClientIDs);
+        }
+
+        $ifNotAdmin = " AND (
+            client.mcp_pro_id = {$performer->pro->id}
+            OR client.rmm_pro_id = {$performer->pro->id}
+            OR client.rme_pro_id = {$performer->pro->id}
+            OR client.physician_pro_id = {$performer->pro->id}
+            OR client.id in (SELECT client_id FROM client_pro_access WHERE is_active AND pro_id = {$performer->pro->id})
+            OR client.id in (SELECT client_id FROM appointment WHERE status NOT IN ('CANCELLED', 'ABANDONED') AND pro_id = {$performer->pro->id})
+        )";
+
+        $numMeasurements = DB::select(
+            DB::raw(
+                "
+SELECT count(measurement.id) as cnt
+FROM measurement
+         join client on measurement.client_id = client.id
+         join care_month on client.id = care_month.client_id
+WHERE measurement.label NOT IN ('SBP', 'DBP')
+  AND (measurement.is_cellular_zero = FALSE or measurement.is_cellular_zero IS NULL)
+  AND measurement.is_removed IS FALSE
+  AND measurement.ts IS NOT NULL
+  AND measurement.client_bdt_measurement_id IS NOT NULL
+  AND (measurement.status IS NULL OR (measurement.status <> 'ACK' AND measurement.status <> 'INVALID_ACK'))
+  AND EXTRACT(MONTH from care_month.start_date) = EXTRACT(MONTH from now())
+  AND EXTRACT(YEAR from care_month.start_date) = EXTRACT(YEAR from now())
+" .
+                (
+                $performer->pro->pro_type != 'ADMIN' ? $ifNotAdmin : ''
+                )
+            )
+        );
+
+        $numMeasurements = $numMeasurements[0]->cnt;
+
+        $measurements = DB::select(
+            DB::raw(
+                "
+SELECT measurement.uid as uid,
+       care_month.uid as care_month_uid,
+       measurement.label,
+       measurement.value,
+       measurement.sbp_mm_hg,
+       measurement.dbp_mm_hg,
+       measurement.numeric_value,
+       measurement.ts,
+       client.uid as client_uid,
+       client.name_last,
+       client.name_first,
+       care_month.rm_total_time_in_seconds
+FROM measurement
+         join client on measurement.client_id = client.id
+         join care_month on client.id = care_month.client_id
+WHERE measurement.label NOT IN ('SBP', 'DBP')
+  AND (measurement.is_cellular_zero = FALSE or measurement.is_cellular_zero IS NULL)
+  AND measurement.is_removed IS FALSE
+  AND measurement.ts IS NOT NULL
+  AND measurement.client_bdt_measurement_id IS NOT NULL
+  AND (measurement.status IS NULL OR (measurement.status <> 'ACK' AND measurement.status <> 'INVALID_ACK'))
+  AND EXTRACT(MONTH from care_month.start_date) = EXTRACT(MONTH from now())
+  AND EXTRACT(YEAR from care_month.start_date) = EXTRACT(YEAR from now())
+" .
+                (
+                $performer->pro->pro_type != 'ADMIN' ? $ifNotAdmin : ''
+                )
+            ) .
+            " ORDER BY measurement.ts DESC LIMIT 20 OFFSET " . (($page - 1) * 20)
+
+        );
+
+        return view('app.dashboard.measurements', compact('numMeasurements', 'measurements', 'page'));
+    }
+
     public function dashboardAppointments(Request $request, $from, $to) {
 
         $performer = $this->performer();
@@ -643,13 +688,29 @@ WHERE measurement.label NOT IN ('SBP', 'DBP')
         if($this->pro->pro_type != 'ADMIN'){
             return redirect()->to(route('dashboard'));
         }
-        $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'));
+
+        $pros =  Pro::where('pro_type', '!=', 'ADMIN');
+
+        if($request->input('q')) {
+            $nameQuery = '%' . $request->input('q') . '%';
+            $pros = $pros->where(function ($query) use ($nameQuery) {
+                $query->where('name_first', 'ILIKE', $nameQuery)
+                    ->orWhere('name_last', 'ILIKE', $nameQuery)
+                    ->orWhere('email_address', 'ILIKE', $nameQuery)
+                    ->orWhere('cell_number', 'ILIKE', $nameQuery);
+            });
+        }
+
+        if($request->input('sort') && $request->input('dir')) {
+            $pros = $pros->orderBy($request->input('sort'), $request->input('dir'));
+        }
+        else {
+            $pros = $pros->orderBy('name_last', 'asc');
+        }
+            
+        $pros = $pros->paginate(20);
+
+        return view('app/log-in-as', ['logInAsPros' => $pros]);
     }
 
     public function processLogInAs(Request $request)

+ 5 - 0
app/Http/Controllers/PatientController.php

@@ -11,6 +11,7 @@ use App\Models\ClientInfoLine;
 use App\Models\Facility;
 use App\Models\Handout;
 use App\Models\IncomingReport;
+use App\Models\MBClaim;
 use App\Models\MBPayer;
 use App\Models\NoteTemplate;
 use App\Models\Pro;
@@ -424,4 +425,8 @@ class PatientController extends Controller
         $mbPayers = MBPayer::all();
         return view('app.patient.insurance-coverage', compact('patient', 'mbPayers'));
     }
+
+    public function mbClaim(Request $request, MBClaim $mbClaim) {
+        return view('app.patient.mb-claim-single', compact('mbClaim'));
+    }
 }

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

@@ -531,6 +531,10 @@ class PracticeManagementController extends Controller
             $notes = Note::where('id', '>', 0);
         }
 
+        if($request->input('date')) {
+            $notes = $notes->where('effective_dateest', $request->input('date'));
+        }
+
         $filters = [];
         $filters['bills_created'] = $request->input('bills_created');
         $filters['is_billing_marked_done'] = $request->input('is_billing_marked_done');
@@ -583,7 +587,7 @@ class PracticeManagementController extends Controller
                 true);
         }
 
-        $notes = $notes->orderBy('effective_dateest', 'desc')->paginate();
+        $notes = $notes->orderBy('effective_dateest', 'desc')->paginate(10);
 
         return view('app.practice-management.billing-manager', compact('notes', 'allPros', 'expectedForHcp', 'targetPro', 'proUid', 'filters'));
     }
@@ -819,6 +823,15 @@ class PracticeManagementController extends Controller
         return view('app.practice-management.supply-orders-hanging', compact('supplyOrders', 'counts'));
     }
 
+    public function supplyOrdersCancelledButUnacknowledged(Request $request)
+    {
+        $supplyOrders = SupplyOrder::where('signed_by_pro_id', $this->performer()->pro->id)
+            ->where('is_cancelled', true)
+            ->where('is_cancellation_acknowledged', false)
+            ->paginate();
+        return view('app.practice-management.supply-orders-cancelled-but-unacknowledged', compact('supplyOrders'));
+    }
+
     private function getSupplyOrderCounts()
     {
         return [

+ 29 - 0
app/Models/Claim.php

@@ -20,4 +20,33 @@ class Claim extends Model
     public function edi(){
         return $this->hasOne(ClaimEDI::class, 'id', 'claim_edi_id');
     }
+
+    public function currentVersion(){
+        return $this->hasOne(ClaimVersion::class, 'id', 'current_version_id');
+    }
+
+    public function mbClaims(){
+        return $this->hasMany(MBClaim::class, 'claim_id', 'id')->orderBy('created_at', 'DESC');
+    }
+
+    public function company(){
+        return $this->hasOne(Company::class, 'id', 'company_id');
+    }
+
+    public function companyPro(){
+        return $this->hasOne(CompanyPro::class, 'id', 'company_pro_id');
+    }
+
+    public function primaryCompany(){
+        return $this->hasOne(Company::class, 'id', 'primary_company_id');
+    }
+
+    public function companyLocation(){
+        return $this->hasOne(CompanyLocation::class, 'id', 'company_location_id');
+    }
+
+    public function primaryPayer(){
+        return $this->hasOne(Payer::class, 'id', 'primary_payer_id');
+    }
+
 }

+ 12 - 0
app/Models/ClaimVersion.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ClaimVersion extends Model
+{
+
+    protected $table = 'claim_version';
+
+}

+ 16 - 0
app/Models/Company.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Company extends Model
+{
+
+    protected $table = 'company';
+
+    public function locations(){
+        return $this->hasMany(CompanyLocation::class, 'company_id', 'id')->orderBy('line1', 'ASC');
+    }
+
+}

+ 12 - 0
app/Models/CompanyLocation.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class CompanyLocation extends Model
+{
+
+    protected $table = 'company_location';
+
+}

+ 12 - 0
app/Models/CompanyPayer.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class CompanyPayer extends Model
+{
+
+    protected $table = 'company_payer';
+
+}

+ 22 - 0
app/Models/CompanyPro.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class CompanyPro extends Model
+{
+
+    protected $table = 'company_pro';
+
+    public function company()
+    {
+        return $this->hasOne(Company::class, 'id', 'company_id');
+    }
+
+    public function pro()
+    {
+        return $this->hasOne(Pro::class, 'id', 'pro_id');
+    }
+
+}

+ 32 - 0
app/Models/CompanyProPayer.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class CompanyProPayer extends Model
+{
+
+    protected $table = 'company_pro_payer';
+
+    public function company()
+    {
+        return $this->hasOne(Company::class, 'id', 'company_id');
+    }
+
+    public function pro()
+    {
+        return $this->hasOne(Pro::class, 'id', 'pro_id');
+    }
+
+    public function payer()
+    {
+        return $this->hasOne(Payer::class, 'id', 'payer_id');
+    }
+
+    public function companyPro()
+    {
+        return $this->hasOne(CompanyPro::class, 'id', 'company_pro_id');
+    }
+
+}

+ 14 - 0
app/Models/MBClaim.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class MBClaim extends Model
+{
+    protected $table = 'mb_claim';
+
+    public function currentVersion(){
+        return $this->hasOne(ClaimVersion::class, 'id', 'current_version_id');
+    }
+}

+ 16 - 1
app/Models/Note.php

@@ -58,7 +58,7 @@ class Note extends Model
 
     public function claims()
     {
-        return $this->hasMany(Claim::class, 'note_id', 'id');
+        return $this->hasMany(Claim::class, 'note_id', 'id')->orderBy('created_at', 'DESC');
     }
 
     public function summary()
@@ -72,4 +72,19 @@ class Note extends Model
         }, $parts);
         return implode("", $parts);
     }
+
+    public function hcpCompany()
+    {
+        return $this->hasOne(Company::class, 'id', 'hcp_company_id');
+    }
+
+    public function hcpCompanyProPayer()
+    {
+        return $this->hasOne(CompanyProPayer::class, 'id', 'hcp_company_pro_payer_id');
+    }
+
+    public function hcpCompanyLocation()
+    {
+        return $this->hasOne(CompanyLocation::class, 'id', 'hcp_company_location_id');
+    }
 }

+ 12 - 0
app/Models/Payer.php

@@ -0,0 +1,12 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Payer extends Model
+{
+
+    protected $table = 'payer';
+
+}

+ 47 - 0
app/Models/Pro.php

@@ -392,4 +392,51 @@ class Pro extends Model
 
         return $measurements;
     }
+
+    public function companyProPayers()
+    {
+        return $this->hasMany(CompanyProPayer::class, 'pro_id', 'id');
+    }
+
+    public function isAssociatedWithMCPayer() {
+        $companyProPayers = $this->companyProPayers;
+        $foundMC = false;
+        if($companyProPayers) {
+            foreach ($companyProPayers as $companyProPayer) {
+                if($companyProPayer->payer && $companyProPayer->payer->is_medicare) {
+                    $foundMC = true;
+                    break;
+                }
+            }
+        }
+        return $foundMC;
+    }
+
+    public function isAssociatedWithNonMCPayer($_payerID) {
+        $companyProPayers = $this->companyProPayers;
+        $foundNonMC = false;
+        if($companyProPayers) {
+            foreach ($companyProPayers as $companyProPayer) {
+                if($companyProPayer->payer && !$companyProPayer->payer->is_medicare && $companyProPayer->payer->id === $_payerID) {
+                    $foundNonMC = true;
+                    break;
+                }
+            }
+        }
+        return $foundNonMC;
+    }
+
+    public function companyLocations() {
+        $companyProPayers = $this->companyProPayers;
+        $companyIDs = [];
+        foreach ($companyProPayers as $companyProPayer) {
+            $companyIDs[] = $companyProPayer->company_id;
+        }
+        $locations = [];
+        if(count($companyIDs)) {
+            $locations = CompanyLocation::whereIn('id', $companyIDs)->get();
+        }
+        return $locations;
+    }
+
 }

+ 16 - 0
public/css/style.css

@@ -268,6 +268,9 @@ body>nav.navbar {
 .mcp-theme-1 .width-200px {
     width: 200px !important;
 }
+.mcp-theme-1 .width-300px {
+    width: 300px !important;
+}
 .mcp-theme-1 .width-22px {
     width: 22px !important;
 }
@@ -1603,4 +1606,17 @@ th.only-screen, td.only-screen {
 .fill-bar {
     height: 20px !important;
     border: 1px solid #ddd;
+}
+
+.if-in-clinic {
+    display: none;
+}
+
+.stag-table-container {
+    max-height: calc(100vh - 230px - 1rem);
+    width: 100%;
+    overflow: auto !important;
+}
+.stag-table-container-lg>table{
+    min-width: 1450px;
 }

+ 2 - 2
public/js/mc.js

@@ -18,7 +18,7 @@ $(document).ready(function () {
 
     if(!window.noMc){
         if (window.location.pathname === window.top.location.pathname) {
-            window.top.location.href = '/mc' + window.location.pathname;
+            window.top.location.href = '/mc' + window.location.pathname + window.location.search;
             return;
         }
     }
@@ -165,7 +165,7 @@ function onFastLoaded(_data, _href, _history) {
                 initPrimaryForm();
                 initPatientPresenceIndicator();
                 runMCInitializers();
-                if (window.top.currentMcUrl !== window.top.location.href) {
+                if (window.top.currentMcUrl.split('?')[0] !== window.top.location.href.split('?')[0]) {
                     $(window).scrollTop(0);
                 }
                 window.top.currentMcUrl = window.top.location.href;

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

@@ -51,6 +51,12 @@
                                         <a href="/practice-management/unacknowledged-cancelled-bills">Unacknowledged Cancelled Bills</a>
                                     </th>
                                 </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$keyNumbers['unacknowledgedCancelledSupplyOrders']}}</th>
+                                    <th class="pl-2">
+                                        <a href="/practice-management/supply-orders/cancelled-but-unacknowledged">Unacknowledged Cancelled Supply Orders</a>
+                                    </th>
+                                </tr>
                                 <tr>
                                     <th class="px-2 text-center">{{$keyNumbers['patientsHavingBirthdayToday']}}</th>
                                     <th class="pl-2">
@@ -137,7 +143,7 @@
                     <li class="nav-item">
                         <a native data-tab="measurements" class="nav-link"
                            :class="tab == 'measurements' ? 'active' : ''" href="#"
-                           v-on:click.prevent="tab='measurements'">
+                           v-on:click.prevent="tab='measurements'; loadMeasurements();">
                             Measurements
                         </a>
                     </li>
@@ -241,7 +247,7 @@
                         </div>
                     </div>
                     <div v-show="tab==='measurements'">
-                        @include('app.dashboard.measurements')
+                        <div id="measurements-tab">Loading...</div>
                     </div>
                     <div v-show="tab==='incoming_reports'">
                         @include('app.dashboard.incoming_reports')
@@ -477,6 +483,12 @@
                         this.selectToday();
                         this.updateNumEventsForDate();
                         $('.datepicker-days .day.active').trigger('click');
+                    },
+                    loadMeasurements: function() {
+                        $('#measurements-tab').load('/pro-dashboard-measurements-tab', () => {
+                            initMoes();
+                            initFastLoad($('#measurements-tab'));
+                        });
                     }
                 },
                 mounted: function () {
@@ -505,6 +517,17 @@
                     // init fast load
                     initFastLoad($('#pro-dashboard-container'));
 
+                    $(document)
+                        .off('click', '.dashboard-measurements.pagination a.page-link')
+                        .on('click', '.dashboard-measurements.pagination a.page-link', function() {
+                            $('#measurements-tab').text('Loading...').load('/pro-dashboard-measurements-tab/' + $(this).attr('data-target-page'), () => {
+                                initMoes();
+                                initFastLoad($('#measurements-tab'));
+                            });
+                            return false;
+                        });
+
+                    this.loadMeasurements();
                 }
             });
             // refresh once ticket popup is closed

+ 23 - 1
resources/views/app/dashboard/measurements.blade.php

@@ -9,7 +9,7 @@
             <th class="border-0 px-2 text-secondary">Value</th>
             <th class="border-0 px-2 text-secondary">Timestamp</th>
             <th class="border-0 px-2 text-secondary">Mins this month</th>
-            <th class="border-0 px-2 text-secondary text-center">Stamp</th>
+            <th class="border-0 px-2 text-secondary">Stamp</th>
             <th class="border-0 px-2 text-secondary text-center">Entry</th>
         </tr>
     </thead>
@@ -125,3 +125,25 @@
         @endif
     </tbody>
 </table>
+<ul class="dashboard-measurements pagination mt-3">
+
+    <?php $totalPages = ceil($numMeasurements / $page); ?>
+
+    <li class="page-item {{ $page === 1 ? 'disabled' : ''}}" aria-disabled="true" aria-label="« Previous">
+        @if($page == 1)
+            <span class="page-link" aria-hidden="true">‹</span>
+        @else
+            <a native target="_top" class="page-link" href="#" data-target-page="{{$page - 1}}">‹</a>
+        @endif
+    </li>
+
+    <li class="page-item"><span class="page-link text-secondary">Showing {{(($page-1) * 20) + 1}} to {{$numMeasurements < $page * 20 ? $numMeasurements : $page * 20}} of {{$numMeasurements}} measurements</span></li>
+
+    <li class="page-item {{ $page === $totalPages ? 'disabled' : ''}}">
+        @if($page === $totalPages)
+            <span class="page-link" aria-hidden="true">›</span>
+        @else
+            <a native target="_top" class="page-link" href="#" data-target-page="{{$page + 1}}">›</a>
+        @endif
+    </li>
+</ul>

+ 43 - 6
resources/views/app/log-in-as.blade.php

@@ -3,8 +3,27 @@
 @section('content')
 
     <div class="p-3 mcp-theme-1">
+
+        <div class="d-flex align-items-center mb-3">
+            <h4 class="font-weight-bold m-0 font-size-16">
+                Log in as
+            </h4>
+        </div>
+
         <div class="row">
             <div class="col-12 col-md-6">
+
+                <div class="d-flex align-items-center">
+                    {{ $logInAsPros->withQueryString()->links() }}
+                    <span class="{{ $logInAsPros->lastPage() > 1 ? 'ml-3' : '' }} mb-3">
+                        Total records: <b>{{ $logInAsPros->total() }}</b>&nbsp;&nbsp;@if($logInAsPros->lastPage() > 1) ({{ $logInAsPros->perPage() }} per page) @endif
+                    </span>
+                    <form class="ml-auto width-200px mb-3 log-in-as-form" method="GET" action="/log_in_as" target="_top">
+                        <input type="text" placeholder="Name/email/phone" class="form-control form-control-sm" name="q"
+                               value="{{request()->input('q')}}">
+                    </form>
+                </div>
+
                 <div class="card">
                     @if(session('message'))
                         <div class="alert alert-info">{{session('message')}}</div>
@@ -12,18 +31,18 @@
                     <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>
+                            <th class="font-weight-normal border-0 pl-2">{{sortColumnHead('/log_in_as', 'Name', 'name_last')}}</th>
+                            <th class="font-weight-normal border-0">{{sortColumnHead('/log_in_as', 'Cell Number', 'cell_number')}}</th>
+                            <th class="font-weight-normal border-0">{{sortColumnHead('/log_in_as', 'Email', 'email_address')}}</th>
+                            <th class="font-weight-normal border-0"></th>
                         </tr>
                         </thead>
                         <tbody>
-                        @foreach($pros as $pro)
+                        @foreach($logInAsPros as $pro)
                             <tr>
                                 <td class="pl-2">{{$pro->displayName()}}</td>
                                 <td>{{$pro->cell_number}}</td>
-                                <td>{{$pro->email}}</td>
+                                <td>{{$pro->email_address}}</td>
                                 <td class="text-right pr-2">
                                     <form action="{{route('process-log-in-as')}}" onsubmit="saveProUid('{{$pro->uid}}')" method="POST" target="_top">
                                         @csrf
@@ -38,6 +57,14 @@
                 </div>
             </div>
         </div>
+
+        <div class="d-flex align-items-center mt-3">
+            {{ $logInAsPros->withQueryString()->links() }}
+            <span class="{{ $logInAsPros->lastPage() > 1 ? 'ml-3' : '' }} mb-3">
+                Total records: <b>{{ $logInAsPros->total() }}</b>&nbsp;&nbsp;@if($logInAsPros->lastPage() > 1) ({{ $logInAsPros->perPage() }} per page) @endif
+            </span>
+        </div>
+
     </div>
 
     <script>
@@ -45,6 +72,16 @@
         window.top.localStorage.currentProUid = _uid;
         return true;
     }
+    (function() {
+        function init() {
+            $('.log-in-as-form').on('submit', function() {
+                let q = $.trim($('[name="q"]').val());
+                fastLoad('/log_in_as?q=' + encodeURIComponent(q));
+                return false;
+            });
+        }
+        addMCInitializer('log-in-as', init, '.log-in-as-form');
+    }).call(window);
     </script>
 
 @endsection

+ 301 - 0
resources/views/app/patient/mb-claim-single.blade.php

@@ -0,0 +1,301 @@
+@extends ('layouts/template')
+
+@section('content')
+    <div class="p-3 mcp-theme-1">
+        <div class="card border-0">
+            <div class="card-body p-0">
+                <table class="table table-striped table-bordered table-sm">
+                    <tbody>
+                    <tr>
+                        <td class="border-top-0 width-300px">Current Version</td>
+                        <td class="border-top-0">{{friendlier_date_time($mbClaim->currentVersion->created_at)}}</td>
+                    </tr>
+                    <tr>
+                        <td>Claim Version</td>
+                        <td>{{friendlier_date_time($mbClaim->currentVersion->created_at)}}</td>
+                    </tr>
+                    <tr>
+                        <td>Is Submitted</td>
+                        <td>{{$mbClaim->is_submitted ? 'YES' : 'NO'}}</td>
+                    </tr>
+                    <tr>
+                        <td>Created At</td>
+                        <td>{{friendlier_date_time($mbClaim->created_at)}}</td>
+                    </tr>
+                    <tr>
+                        <td>Status</td>
+                        <td>{{$mbClaim->status}}</td>
+                    </tr>
+                    <tr>
+                        <td>Status Memo</td>
+                        <td>{{$mbClaim->status_memo}}</td>
+                    </tr>
+                    <tr>
+                        <td>Status Updated At</td>
+                        <td>{{$mbClaim->status_updated_at}}</td>
+                    </tr>
+                    <tr>
+                        <td>Vendor Identifier</td>
+                        <td>{{$mbClaim->vendor_identifier}}</td>
+                    </tr>
+                    <tr>
+                        <td>Claim Date</td>
+                        <td>{{friendlier_date_time($mbClaim->claim_date)}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Tax ID</td>
+                        <td>{{$mbClaim->billing_provider_tax_id}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Tax ID Type</td>
+                        <td>{{$mbClaim->billing_provider_tax_id_type}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Entity</td>
+                        <td>{{$mbClaim->billing_provider_entity}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Phone Number</td>
+                        <td>{{$mbClaim->billing_provider_phone_number}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Organization Name</td>
+                        <td>{{$mbClaim->billing_provider_organization_name}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Last Name</td>
+                        <td>{{$mbClaim->billing_provider_last_name}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider First Name</td>
+                        <td>{{$mbClaim->billing_provider_first_name}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Middle Name</td>
+                        <td>{{$mbClaim->billing_provider_middle_name}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Address Street Line 1</td>
+                        <td>{{$mbClaim->billing_provider_address_street_line1}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Address Street Line 2</td>
+                        <td>{{$mbClaim->billing_provider_address_street_line2}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Address City</td>
+                        <td>{{$mbClaim->billing_provider_address_city}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Address State</td>
+                        <td>{{$mbClaim->billing_provider_address_state}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Address Zip</td>
+                        <td>{{$mbClaim->billing_provider_address_zip}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider NPI</td>
+                        <td>{{$mbClaim->billing_provider_npi}}</td>
+                    </tr>
+                    <tr>
+                        <td>Billing Provider Taxonomy Code</td>
+                        <td>{{$mbClaim->billing_provider_taxonomy_code}}</td>
+                    </tr>
+                    <tr>
+                        <td>Payer Identifier ID</td>
+                        <td>{{$mbClaim->payer_identifier_id}}</td>
+                    </tr>
+                    <tr>
+                        <td>Payer Name</td>
+                        <td>{{$mbClaim->payer_name}}</td>
+                    </tr>
+                    <tr>
+                        <td>Payer Address Street Line 1</td>
+                        <td>{{$mbClaim->payer_address_street_line1}}</td>
+                    </tr>
+                    <tr>
+                        <td>Payer Address Street Line 2</td>
+                        <td>{{$mbClaim->payer_address_street_line2}}</td>
+                    </tr>
+                    <tr>
+                        <td>Payer Address City</td>
+                        <td>{{$mbClaim->payer_address_city}}</td>
+                    </tr>
+                    <tr>
+                        <td>Payer Address State</td>
+                        <td>{{$mbClaim->payer_address_state}}</td>
+                    </tr>
+                    <tr>
+                        <td>Payer Address Zip</td>
+                        <td>{{$mbClaim->payer_address_zip}}</td>
+                    </tr>
+                    <tr>
+                        <td>Patient Chart Number</td>
+                        <td>{{$mbClaim->patient_chart_number}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Identifier</td>
+                        <td>{{$mbClaim->subscriber_identifier}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber First Name</td>
+                        <td>{{$mbClaim->subscriber_first_name}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Last Name</td>
+                        <td>{{$mbClaim->subscriber_last_name}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Middle Name</td>
+                        <td>{{$mbClaim->subscriber_middle_name}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Address Street Line 1</td>
+                        <td>{{$mbClaim->subscriber_address_street_line1}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Address Street Line 2</td>
+                        <td>{{$mbClaim->subscriber_address_street_line2}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Address City</td>
+                        <td>{{$mbClaim->subscriber_address_city}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Address State</td>
+                        <td>{{$mbClaim->subscriber_address_state}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Address Zip</td>
+                        <td>{{$mbClaim->subscriber_address_zip}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Phone Number</td>
+                        <td>{{$mbClaim->subscriber_phone_number}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Group ID</td>
+                        <td>{{$mbClaim->subscriber_group_id}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber DOB</td>
+                        <td>{{$mbClaim->subscriber_dob}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Gender</td>
+                        <td>{{$mbClaim->subscriber_gender}}</td>
+                    </tr>
+                    <tr>
+                        <td>Subscriber Group Name</td>
+                        <td>{{$mbClaim->subscriber_group_name}}</td>
+                    </tr>
+                    <tr>
+                        <td>Claim Direct Payment Authorized</td>
+                        <td>{{$mbClaim->claim_direct_payment_authorized}}</td>
+                    </tr>
+                    <tr>
+                        <td>Claim Frequency</td>
+                        <td>{{$mbClaim->claim_frequency}}</td>
+                    </tr>
+                    <tr>
+                        <td>Claim Prior Authorization Number</td>
+                        <td>{{$mbClaim->claim_prior_authorization_number}}</td>
+                    </tr>
+                    <tr>
+                        <td>Claim Accept Assignment Code</td>
+                        <td>{{$mbClaim->claim_accept_assignment_code}}</td>
+                    </tr>
+                    <tr>
+                        <td>Claim Total Charge</td>
+                        <td>{{$mbClaim->claim_total_charge}}</td>
+                    </tr>
+                    <tr>
+                        <td>Claim Patient Amount Paid</td>
+                        <td>{{$mbClaim->claim_patient_amount_paid}}</td>
+                    </tr>
+                    <tr>
+                        <td>Claim Diagnosis Codes</td>
+                        <td>{{str_replace("|", ", ", $mbClaim->claim_diagnosis_codes)}}</td>
+                    </tr>
+                    <tr>
+                        <td>Attending Provider First Name</td>
+                        <td>{{$mbClaim->attending_provider_first_name}}</td>
+                    </tr>
+                    <tr>
+                        <td>Attending Provider Last Name</td>
+                        <td>{{$mbClaim->attending_provider_last_name}}</td>
+                    </tr>
+                    <tr>
+                        <td>Attending Provider NPI</td>
+                        <td>{{$mbClaim->attending_provider_npi}}</td>
+                    </tr>
+                    </tbody>
+                </table>
+            </div>
+        </div>
+    </div>
+@endsection
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 98 - 89
resources/views/app/patient/note/_create-bill.blade.php

@@ -1,89 +1,96 @@
 <?php $noteRates = $pro->noteRates(); ?>
-<span class="mx-2 text-secondary">|</span>
-<div moe wide 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" value="{{$note->effective_dateest ? $note->effective_dateest : date('Y-m-d')}}" required>
-        </div>
-        <div class="mb-2">
-            @if($noteRates && count($noteRates))
-                @if(count($noteRates) === 1)
-                    <input type="hidden" name="code" value="{{$noteRates[0]->code}}">
-                    <p class="mb-2">Service: <b>{{ $noteRates[0]->code }} (${{ $noteRates[0]->amount }}/hr)</b></p>
-                @else
-                    <select autofocus class="form-control" name="code" onchange="switchNumberOfUnitsByType(this)">
-                        <option value="">-- Select Code --</option>
-                        @foreach($noteRates as $noteRate)
-                            <option data-amount="{{ $noteRate->amount }}" value="{{ $noteRate->code }}">
-                                {{ $noteRate->code }} (${{ $noteRate->amount }}{{ $noteRate->code === 'Treatment Services' ? '/hr' : '' }})
-                            </option>
-                        @endforeach
-                    </select>
+@if(!$note->is_bill_closed && !$note->is_billing_marked_done)
+    <span class="mx-2 text-secondary">|</span>
+    <div moe wide 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" value="{{$note->effective_dateest ? $note->effective_dateest : date('Y-m-d')}}" required>
+            </div>
+            <div class="mb-2">
+                @if($noteRates && count($noteRates))
+                    @if(count($noteRates) === 1)
+                        <input type="hidden" name="code" value="{{$noteRates[0]->code}}">
+                        <p class="mb-2">Service: <b>{{ $noteRates[0]->code }} (${{ $noteRates[0]->amount }}/hr)</b></p>
+                    @else
+                        <select autofocus class="form-control" name="code" onchange="switchNumberOfUnitsByType(this)">
+                            <option value="">-- Select Code --</option>
+                            @foreach($noteRates as $noteRate)
+                                <option data-amount="{{ $noteRate->amount }}" value="{{ $noteRate->code }}">
+                                    {{ $noteRate->code }} (${{ $noteRate->amount }}{{ $noteRate->code === 'Treatment Services' ? '/hr' : '' }})
+                                </option>
+                            @endforeach
+                        </select>
+                    @endif
                 @endif
-            @endif
-        </div>
+            </div>
 
-        <?php
-            $maxMinutes = 120;
-            if($note->new_or_fu_or_na === 'NEW') {
-                $maxMinutes = 90;
-            }
-            else if($note->new_or_fu_or_na === 'FU') {
-                if($note->method === 'VIDEO') {
-                    $maxMinutes = 75;
+            <?php
+                $maxMinutes = 120;
+                if($note->new_or_fu_or_na === 'NEW') {
+                    $maxMinutes = 90;
                 }
-                else if($note->method === 'AUDIO') {
-                    $maxMinutes = 45;
+                else if($note->new_or_fu_or_na === 'FU') {
+                    if($note->method === 'VIDEO') {
+                        $maxMinutes = 75;
+                    }
+                    else if($note->method === 'AUDIO') {
+                        $maxMinutes = 45;
+                    }
                 }
-            }
-        ?>
+            ?>
 
-        @if($noteRates && count($noteRates) && count($noteRates) === 1)
-            @if(strpos(strtolower($noteRates[0]->code), "treatment services") !== FALSE)
-                <div class="mb-2">
-                    <select name="numberOfUnits" class="form-control form-control-sm"
-                            onchange="calculateBillAmount(this)">
-                        <option value=""> -- select -- </option>
-                        <?php for ($i = 5; $i <= $maxMinutes; $i+=5) { ?>
-                        <option value="{{ $i/60 }}" {{ $i === 30 ? 'selected' : '' }}>{{ $i }} minutes</option>
-                        <?php } ?>
-                    </select>
-                </div>
-                <div class="mb-2" calculated-amount></div>
-            @else
-                <input type="hidden" name="numberOfUnits" value="1">
+            @if($noteRates && count($noteRates) && count($noteRates) === 1)
+                @if(strpos(strtolower($noteRates[0]->code), "treatment services") !== FALSE)
+                    <div class="mb-2">
+                        <select name="numberOfUnits" class="form-control form-control-sm"
+                                onchange="calculateBillAmount(this)">
+                            <option value=""> -- select -- </option>
+                            <?php for ($i = 5; $i <= $maxMinutes; $i+=5) { ?>
+                            <option value="{{ $i/60 }}" {{ $i === 30 ? 'selected' : '' }}>{{ $i }} minutes</option>
+                            <?php } ?>
+                        </select>
+                    </div>
+                    <div class="mb-2" calculated-amount></div>
+                @else
+                    <input type="hidden" name="numberOfUnits" value="1">
+                @endif
             @endif
-        @endif
-        <div class="bill-conditional">
+            <div class="bill-conditional">
 
+            </div>
+
+            <div class="my-3">
+                <input type="checkbox" name="signAndMarkBillingDone" checked>&nbsp;Sign and Mark Billing Done
+            </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>
+        <div class="d-none" hourly-template>
+            <div class="mb-2">
+                <select name="numberOfUnits" class="form-control form-control-sm"
+                        onchange="calculateBillAmount(this)">
+                    <option value=""> -- select -- </option>
+                    <?php for ($i = 5; $i <= $maxMinutes; $i+=5) { ?>
+                        <option value="{{ $i/60 }}" {{ $i === 30 ? 'selected' : '' }}>{{ $i }} minutes</option>
+                    <?php } ?>
+                </select>
+            </div>
+            <div class="mb-2" calculated-amount></div>
         </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>
-    <div class="d-none" hourly-template>
-        <div class="mb-2">
-            <select name="numberOfUnits" class="form-control form-control-sm"
-                    onchange="calculateBillAmount(this)">
-                <option value=""> -- select -- </option>
-                <?php for ($i = 5; $i <= $maxMinutes; $i+=5) { ?>
-                    <option value="{{ $i/60 }}" {{ $i === 30 ? 'selected' : '' }}>{{ $i }} minutes</option>
-                <?php } ?>
-            </select>
+        <div class="d-none" non-hourly-template>
+            <input type="hidden" name="numberOfUnits" value="1">
         </div>
-        <div class="mb-2" calculated-amount></div>
-    </div>
-    <div class="d-none" non-hourly-template>
-        <input type="hidden" name="numberOfUnits" value="1">
     </div>
-</div>
-@if(!$note->is_bill_closed)
-    <span class="mx-2 text-secondary">|</span>
-    @if($pro->pro_type === 'ADMIN')
+@endif
+@if($pro->pro_type === 'ADMIN')
+    @if(!$note->is_bill_closed)
+        <span class="mx-2 text-secondary">|</span>
         <span class="d-block" moe>
             <a class="text-danger" href="" show start>Close Billing</a>
             <form url="/api/note/closeBilling">
@@ -95,23 +102,23 @@
                 </div>
             </form>
         </span>
+    @elseif($note->is_bill_closed)
+        <span class="mx-2 text-secondary">|</span>
+        <span class="d-block" moe>
+            <a class="text-danger" href="" show start>Reopen Billing</a>
+            <form url="/api/note/reopenBilling">
+                <input type="hidden" name="uid" value="{{$note->uid}}">
+                <p>Reopen billing?</p>
+                <div class="mb-0">
+                    <button class="btn btn-success btn-sm" submit>Submit</button>
+                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                </div>
+            </form>
+        </span>
     @endif
-@elseif($note->is_bill_closed)
-    <span class="mx-2 text-secondary">|</span>
-    <span class="d-block" moe>
-        <a class="text-danger" href="" show start>Reopen Billing</a>
-        <form url="/api/note/reopenBilling">
-            <input type="hidden" name="uid" value="{{$note->uid}}">
-            <p>Reopen billing?</p>
-            <div class="mb-0">
-                <button class="btn btn-success btn-sm" submit>Submit</button>
-                <button class="btn btn-default border btn-sm" cancel>Cancel</button>
-            </div>
-        </form>
-    </span>
 @endif
-<span class="mx-2 text-secondary">|</span>
 @if(!$note->is_billing_marked_done)
+    <span class="mx-2 text-secondary">|</span>
     <span class="d-block" moe>
         <a class="text-danger" href="" show start>Mark Billing Done</a>
         <form url="/api/note/setIsBillingMarkedDoneToTrue">
@@ -124,6 +131,7 @@
         </form>
     </span>
 @else
+    <span class="mx-2 text-secondary">|</span>
     <span class="d-block" moe>
         <i class="fa fa-check"></i>
         <a class="text-danger" href="" show start>Undo Mark Billing Done</a>
@@ -137,6 +145,7 @@
         </form>
     </span>
 @endif
+
 <script>
     (function() {
         let selectedCodeHourlyRate = 0;

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

@@ -20,6 +20,20 @@
     }
     ?>
 
+    @if(!count($pro->companyProPayers) ||  /* pro has no assoc with any payer */
+                    ($patient->is_part_b_primary !== 'YES' && !$patient->non_mc_primary_payer_id) ||    /* patient is not part_b and has no primary non-mc payer */
+                    ($patient->is_part_b_primary === 'YES' && !$pro->isAssociatedWithMCPayer()) ||      /* patient is part_b but pro has no mc payer assoc */
+                    ($patient->is_part_b_primary !== 'YES' && $patient->non_mc_primary_payer_id &&      /* patient is not part_b and has non-mc-primary, but pro has no assoc with that payer */
+                        !$pro->isAssociatedWithNonMCPayer($patient->non_mc_primary_payer_id))
+                )
+        <div class="alert alert-warning mcp-theme-1 p-3 hide-inside-ticket-popup">
+            <div class="font-size-14 font-weight-bold">
+                <i class="fa fa-exclamation-triangle text-warning-mellow"></i>
+                This patient may not be covered for this visit. Please check with practice administrator.
+            </div>
+        </div>
+    @endif
+
     <div id="note-single-header" class="pt-2 pb-3 d-flex align-items-start">
         <h6 class="my-0 text-secondary d-flex align-items-start w-100">
             <a href="/patients/view/{{ $patient->uid }}/notes" class="small text-decoration-none mr-3">
@@ -226,13 +240,22 @@
                             <form url="/api/note/updateMethod">
                                 <input type="hidden" name="uid" value="{{$note->uid}}">
                                 <div class="mb-2">
-                                    <select name="method" class="form-control form-control-sm" required>
+                                    <select name="method" class="form-control form-control-sm note-method-select" required>
                                         <option value="AUDIO" {{ $note->method === "AUDIO" ? "selected" : "" }}>Audio</option>
                                         <option value="VIDEO" {{ $note->method === "VIDEO" ? "selected" : "" }}>Video</option>
                                         <option value="IN_CLINIC" {{ $note->method === "IN_CLINIC" ? "selected" : "" }}>In-Clinic</option>
                                         <option value="HOUSE_CALL" {{ $note->method === "HOUSE_CALL" ? "selected" : "" }}>House Call</option>
                                     </select>
                                 </div>
+                                <div class="form-group if-in-clinic">
+                                    <label for="" class="text-secondary text-sm mb-1">Location</label>
+                                    <select name="hcpCompanyLocationUid" class="form-control">
+                                        <option value="-- select --"></option>
+                                        @foreach($pro->companyLocations() as $location)
+                                            <option value="{{$location->uid}}" {{$location->id === $note->hcp_company_location_id ? 'selected' : ''}}>{{$location->line1}} {{$location->city}}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
                                 <div class="mb-0">
                                     <button class="btn btn-primary btn-sm" submit>Submit</button>
                                     <button class="btn btn-default border btn-sm" cancel>Cancel</button>
@@ -881,12 +904,103 @@
                 </div>
                 @endif
 
+                @if($note->method === 'IN_CLINIC' || $pro->pro_type === 'ADMIN')
+                <div class="p-3 border-bottom">
+                    <div class="ml-auto d-inline-flex align-items-center">
+
+                        <span class="text-secondary font-weight-bold">Pro:&nbsp;</span>
+                        <b>{{$note->hcpPro ? $note->hcpPro->displayName() : '-'}}</b>
+
+                        <span class="mx-3 text-secondary">|</span>
+                        <span>
+                            <span class="text-secondary font-weight-bold">Payer (1°): </span>
+                            <b>{{$note->hcpCompanyProPayer && $note->hcpCompanyProPayer->payer ? $note->hcpCompanyProPayer->payer->name : '-'}}</b>
+                            <span moe class="ml-1">
+                                <a class="text-primary" href="" show start><i class="fa fa-edit"></i></a>
+                                <form url="/api/note/putHcpCompanyProPayer">
+                                    <input type="hidden" name="uid" value="{{$note->uid}}">
+                                    <div class="mb-2">
+                                        <select name="hcpCompanyProPayerUid" class="form-control form-control-sm">
+                                            <option value="">-- select --</option>
+                                            @foreach($note->hcpPro->companyProPayers as $companyProPayer)
+                                                <option value="{{$companyProPayer->uid}}">{{$companyProPayer->company->name}} / {{$companyProPayer->payer->name}}</option>
+                                            @endforeach
+                                        </select>
+                                    </div>
+                                    <div class="mb-0">
+                                        <button class="btn btn-success btn-sm" submit>Submit</button>
+                                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </span>
+                            @if($note->hcpCompanyProPayer && $note->hcpCompanyProPayer->payer)
+                            <span moe class="ml-1">
+                                <a class="text-danger" href="" show start><i class="fa fa-trash-alt"></i></a>
+                                <form url="/api/note/wipeHcpCompanyProPayer">
+                                    <input type="hidden" name="uid" value="{{$note->uid}}">
+                                    <p>Wipe payer from this note?</p>
+                                    <div class="mb-0">
+                                        <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </span>
+                            @endif
+                        </span>
+
+                        <span class="mx-3 text-secondary">|</span>
+                        <span>
+                            <span class="text-secondary font-weight-bold">Payer (2°): </span>
+                            <b>-</b>
+                        </span>
+
+                        <span class="mx-3 text-secondary">|</span>
+                        <span>
+                            <span class="text-secondary font-weight-bold">Location: </span><b>{{$note->hcpCompanyLocation ? $note->hcpCompanyLocation->line1 . ', ' . $note->hcpCompanyLocation->city : '-'}}</b>
+                            <span moe class="ml-1">
+                                <a class="text-primary" href="" show start><i class="fa fa-edit"></i></a>
+                                <form url="/api/note/putHcpCompanyLocation">
+                                    <input type="hidden" name="uid" value="{{$note->uid}}">
+                                    <div class="mb-2">
+                                        <select name="hcpCompanyLocationUid" class="form-control form-control-sm">
+                                            <option value="">-- select --</option>
+                                            @if($note->hcpCompany && $note->hcpCompany->locations)
+                                                @foreach($note->hcpCompany->locations as $location)
+                                                    <option value="{{$location->uid}}">{{$location->line1 . ', ' . $location->city}}</option>
+                                                @endforeach
+                                            @endif
+                                        </select>
+                                    </div>
+                                    <div class="mb-0">
+                                        <button class="btn btn-success btn-sm" submit>Submit</button>
+                                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </span>
+                            @if($note->hcpCompanyLocation)
+                            <span moe class="ml-1">
+                                <a class="text-danger" href="" show start><i class="fa fa-trash-alt"></i></a>
+                                <form url="/api/note/wipeHcpCompanyLocation">
+                                    <input type="hidden" name="uid" value="{{$note->uid}}">
+                                    <p>Wipe location from this note?</p>
+                                    <div class="mb-0">
+                                        <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                    </div>
+                                </form>
+                            </span>
+                            @endif
+                        </span>
+                    </div>
+                </div>
+                @endif
+
                 {{-- bills --}}
                 @if($pro->pro_type === 'ADMIN' || ($note->hcpPro && $pro->id === $note->hcpPro->id))
                 @if($note->bills->count())
                     <div class="p-3 border-bottom">
                         <div class="d-flex align-items-center mb-2">
-                            <p class="font-weight-bold text-secondary m-0">Bills</p>
+                            <p class="font-weight-bold text-secondary font-size-13 m-0">Bills</p>
                             @include('app/patient/note/_create-bill')
                         </div>
 
@@ -1155,7 +1269,7 @@
                                             </div>
                                         @endif
 
-                                        @if($bill->is_cancellation_acknowledged)
+                                        @if($bill->is_cancellation_acknowledged && !$note->is_billing_marked_done)
                                             <div class="mt-2 text-secondary">
                                                 <i class="fa fa-check"></i>
                                                 Acknowledged
@@ -1176,7 +1290,7 @@
                                     </td>
                                     <td> <!-- submit payment -->
                                         <div class="my-1">
-                                            @if($pro->pro_type === 'ADMIN' && !$bill->is_cancelled)
+                                            @if(!$bill->is_cancelled && !$bill->has_hcp_been_paid)
                                                 <span class="d-block" moe relative="">
                                                     <a class="font-weight-bold" href="" show start>Submit Payment For HCP</a>
                                                     <form url="/api/bill/payHcpAmount" right>
@@ -1192,7 +1306,7 @@
                                             @endif
                                         </div>
                                         <div class="my-1">
-                                            @if($pro->pro_type === 'ADMIN' && !$bill->is_cancelled)
+                                            @if(!$bill->is_cancelled && !$bill->has_na_been_paid && $bill->ally)
                                                 <span class="d-block" moe relative="">
                                                     <a class="font-weight-bold" href="" show start>Submit Payment For NA</a>
                                                     <form url="/api/bill/payNaAmount" right>
@@ -1345,105 +1459,354 @@
                         <div class="d-flex align-items-center mb-2">
                             <p class="font-weight-bold text-secondary m-0">Claims</p>
                             @include('app/patient/note/_create-claim')
+                            <div class="ml-auto">
+                                <select class="form-control form-control-sm"
+                                    onchange="fastLoad('{{route('patients.view.notes.view.dashboard', ['patient' => $patient, 'note' => $note])}}?claims-filter=' + this.value)">
+                                    <option value="active" {{!request('claims-filter') || request('claims-filter') === 'active' ? 'selected' : ''}}>Active Claims</option>
+                                    <option value="all" {{request('claims-filter') === 'all' ? 'selected' : ''}}>All Claims</option>
+                                </select>
+                            </div>
                         </div>
 
                         <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 pl-2">IID</th>
-                                <th class="border-bottom-0 w-50">Details</th>
-                                <th class="border-bottom-0 text-center">Submitted?</th>
-                                <th class="border-bottom-0">Actions</th>
+                                <th class="border-bottom-0">Details</th>
+                                <th class="border-bottom-0">Current Version</th>
+                                <th class="border-bottom-0">Status</th>
+                                <th class="border-bottom-0">Submissions</th>
                             </tr>
                             </thead>
                             <tbody>
                             @foreach ($note->claims as $claim)
-                                <tr class="{{ $claim->is_cancelled ? 'text-secondary bg-light on-hover-opaque' : '' }}"">
-                                    <td class="pl-2">
-                                        {{ $claim->iid }}
-                                        @if($claim->is_cancelled)
-                                            <div class="text-secondary font-weight-bold text-sm mt-1">[CANCELLED]</div>
-                                        @endif
-                                    </td>
-                                    <td class="p-0">
-                                        @if($claim->lines->count())
-                                            <table class="table table-sm table-condensed border-left border-right mb-0">
-                                                <thead>
-                                                    <tr class="bg-light">
-                                                        <th class="border-0">CPT</th>
-                                                        <th class="border-0">Date of Service</th>
-                                                        <th class="border-0">ICDs</th>
-                                                    </tr>
-                                                </thead>
-                                                <tbody class="pb-3">
-                                                    @foreach($claim->lines as $line)
-                                                    <tr class="claim-line">
-                                                        <td>{{$line->cpt}}</td>
-                                                        <td>{{$line->date_of_service}}</td>
-                                                        <td>
-                                                            @if(count($line->claimLineIcds))
-                                                                @foreach($line->claimLineIcds as $icd)
-                                                                    <div>
-                                                                        <b>{{$icd->code}}</b> <span class="text-secondary">({{$icd->description}})</span>
-                                                                    </div>
-                                                                @endforeach
-                                                            @else
-                                                                <p>No ICDs set</p>
-                                                            @endif
-                                                        </td>
-                                                    </tr>
-                                                    @endforeach
-                                                </tbody>
-                                            </table>
-                                        @else
-                                            <p>No lines for this claim</p>
-                                        @endif
-                                    </td>
-                                    <td class="text-center">{{$claim->was_submitted? 'Yes':'No'}}</td>
-
-                                    <td>
-                                        <div class="d-flex align-items-center">
-                                            @if($claim->was_submitted)
-                                                <span class="d-block text-secondary">
-                                                    Submitted
-                                                </span>
+                                @if($claim->status !== 'CANCELLED' || request('claims-filter') === 'all')
+                                    <tr class="bg-secondary on-hover-opaque">
+                                        <td colspan="5" class="pt-0 pb-1"></td>
+                                    </tr>
+                                    <tr class="{{ $claim->status === 'CANCELLED' ? 'text-secondary bg-light on-hover-opaque' : '' }}">
+                                        <td class="pl-2">
+                                            <div>{{ $claim->iid }}</div>
+                                            @if($claim->status === 'CANCELLED')
+                                                <div class="text-secondary font-weight-bold text-sm mt-1">[CANCELLED]</div>
                                             @else
-                                                @include('app/patient/note/_update-claim')
-                                                <span class="mx-2 text-secondary">|</span>
-                                                <span moe class="d-block" title="Submit Claim">
-                                                    <a class="" href="" show start>Submit</a>
-                                                    <form url="/api/claim/submit">
+                                                <div moe class="text-left mt-1" title="Cancel Claim">
+                                                    <a class="" href="" show start>Cancel</a>
+                                                    <form url="/api/claim/updateStatus">
                                                         <input type="hidden" name="uid" value="{{$claim->uid}}">
-                                                        <p>Submit claim?</p>
+                                                        <input type="hidden" name="status" value="CANCELLED">
+                                                        <p>Cancel this claim?</p>
+                                                        <div class="mb-2">
+                                                            <label for="" class="control-label">Cancellation Memo</label>
+                                                            <textarea name="memo" class="form-control"></textarea>
+                                                        </div>
                                                         <div class="mb-0">
-                                                            <button class="btn btn-success btn-sm" submit>Sign</button>
+                                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
                                                             <button class="btn btn-default border btn-sm" cancel>Cancel</button>
                                                         </div>
                                                     </form>
-                                                </span>
+                                                </div>
                                             @endif
-                                            @if($claim->is_cancelled)
-                                                <span class="mx-2 text-secondary">|</span>
-                                                <span class="d-block text-secondary">
-                                                    Cancelled
-                                                </span>
+                                        </td>
+                                        <td class="p-0 border-left border-right">
+                                            @if($claim->lines->count())
+                                                <table class="table table-sm table-condensed border-0 mb-0">
+                                                    <thead>
+                                                        <tr class="bg-light">
+                                                            <th class="border-0">CPT</th>
+                                                            <th class="border-0">DOS</th>
+                                                            <th class="border-0">ICDs</th>
+                                                        </tr>
+                                                    </thead>
+                                                    <tbody class="pb-3">
+                                                        @foreach($claim->lines as $line)
+                                                        <tr class="claim-line">
+                                                            <td>{{$line->cpt}}</td>
+                                                            <td class="text-nowrap">{{friendlier_date($line->date_of_service)}}</td>
+                                                            <td>
+                                                                @if(count($line->claimLineIcds))
+                                                                    @foreach($line->claimLineIcds as $icd)
+                                                                        <div>
+                                                                            <b class="c-pointer border-secondary border-bottom" title="{{$icd->description}}">{{$icd->code}}</b>
+                                                                        </div>
+                                                                    @endforeach
+                                                                @else
+                                                                    <p>No ICDs set</p>
+                                                                @endif
+                                                            </td>
+                                                        </tr>
+                                                        @endforeach
+                                                    </tbody>
+                                                </table>
                                             @else
-                                                <span class="mx-2 text-secondary">|</span>
-                                                <span class="d-block" moe>
-                                                    <a class="text-danger" href="" show start>Cancel</a>
-                                                    <form url="/api/claim/cancel">
-                                                        <input type="hidden" name="uid" value="{{$claim->uid}}">
-                                                        <p>Cancel this claim?</p>
-                                                        <div class="mb-0">
-                                                            <button class="btn btn-danger btn-sm" submit>Yes</button>
-                                                            <button class="btn btn-default border btn-sm" cancel>No</button>
-                                                        </div>
-                                                    </form>
-                                                </span>
+                                                <p>No lines for this claim</p>
                                             @endif
-                                        </div>
-                                    </td>
-                                </tr>
+                                        </td>
+                                        <td class="border-right">
+                                            {{$claim->currentVersion ? friendlier_date_time($claim->currentVersion->created_at) : '-'}}
+                                        </td>
+                                        <td class="border-right p-0">
+
+                                            <!-- status -->
+                                            <div class="p-1 border-bottom">
+                                                <div>
+                                                    {{$claim->status ? $claim->status : '(not set)'}}
+                                                    @if($claim->status !== 'CANCELLED')
+                                                        <span moe class="d-inline-block text-left ml-1" title="Update Status">
+                                                            <a class="" href="" show start><i class="fa fa-edit"></i></a>
+                                                            <form url="/api/claim/updateStatus">
+                                                                <input type="hidden" name="uid" value="{{$claim->uid}}">
+                                                                <div class="mb-2">
+                                                                    <label for="" class="control-label">Status</label>
+                                                                    <select name="status" class="form-control form-control-sm" required>
+                                                                        <option value="">-- select --</option>
+                                                                        <option value="NEW" {{$claim->status === 'NEW' ? 'selected' : ''}}>New</option>
+                                                                        <option value="PROCESSING" {{$claim->status === 'PROCESSING' ? 'selected' : ''}}>Processing</option>
+                                                                        <option value="SUBMITTED" {{$claim->status === 'SUBMITTED' ? 'selected' : ''}}>Submitted</option>
+                                                                    </select>
+                                                                </div>
+                                                                <div class="mb-2">
+                                                                    <label for="" class="control-label">Status Memo</label>
+                                                                    <textarea name="memo" class="form-control"></textarea>
+                                                                </div>
+                                                                <div class="mb-0">
+                                                                    <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                                </div>
+                                                            </form>
+                                                        </span>
+                                                    @endif
+                                                </div>
+                                                @if($claim->status_memo)
+                                                <div class="text-secondary font-italic text-sm">{{$claim->status_memo}}</div>
+                                                @endif
+                                            </div>
+
+                                            <!-- payer, company, location -->
+                                            <div class="p-1">
+                                                <div class="mt-1">
+                                                    <span class="text-secondary text-sm">Payer (1°): </span>
+                                                    <b>{{$claim->primaryPayer ? $claim->primaryPayer->name : '-'}}</b>
+                                                    @if($claim->status !== 'CANCELLED')
+                                                        <span moe class="ml-1">
+                                                            <a class="text-primary" href="" show start><i class="fa fa-edit"></i></a>
+                                                            <form url="/api/claim/putPrimaryPayer">
+                                                                <input type="hidden" name="uid" value="{{$claim->uid}}">
+                                                                <div class="mb-2">
+                                                                    <select name="primaryPayerUid" class="form-control form-control-sm">
+                                                                        <option value="">-- select --</option>
+                                                                        @foreach($note->hcpPro->companyProPayers as $companyProPayer)
+                                                                            <option value="{{$companyProPayer->payer->uid}}"
+                                                                                    {{$claim->primaryPayer && $claim->primaryPayer->uid === $companyProPayer->payer->uid ? 'selected' : ''}}>{{$companyProPayer->payer->name}}</option>
+                                                                        @endforeach
+                                                                    </select>
+                                                                </div>
+                                                                <div class="mb-0">
+                                                                    <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                                </div>
+                                                            </form>
+                                                        </span>
+                                                        @if($claim->primaryPayer)
+                                                        <span moe class="ml-1">
+                                                            <a class="text-danger" href="" show start><i class="fa fa-trash-alt"></i></a>
+                                                            <form url="/api/claim/wipePrimaryPayer">
+                                                                <input type="hidden" name="uid" value="{{$claim->uid}}">
+                                                                <p>Wipe payer from this claim?</p>
+                                                                <div class="mb-0">
+                                                                    <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                                </div>
+                                                            </form>
+                                                        </span>
+                                                        @endif
+                                                    @endif
+                                                </div>
+
+                                                <div class="mt-1">
+                                                    <span class="text-secondary text-sm">Payer (2°): </span>
+                                                    <b>-</b>
+                                                </div>
+
+                                                <div class="mt-1">
+                                                    <span class="text-secondary text-sm">Company: </span>
+                                                    <b>{{$claim->companyPro && $claim->companyPro->company ? $claim->companyPro->company->name : '-'}}</b>
+                                                    @if($claim->status !== 'CANCELLED')
+                                                        <span moe class="ml-1">
+                                                            <a class="text-primary" href="" show start><i class="fa fa-edit"></i></a>
+                                                            <form url="/api/claim/putCompanyPro">
+                                                                <input type="hidden" name="uid" value="{{$claim->uid}}">
+                                                                <div class="mb-2">
+                                                                    <select name="companyProUid" class="form-control form-control-sm">
+                                                                        <option value="">-- select --</option>
+                                                                        @foreach($note->hcpPro->companyProPayers as $companyProPayer)
+                                                                            <option value="{{$companyProPayer->companyPro->uid}}"
+                                                                                    {{$claim->companyPro && $claim->companyPro->uid === $companyProPayer->companyPro->uid ? 'selected' : ''}}>{{$companyProPayer->company->name}}</option>
+                                                                        @endforeach
+                                                                    </select>
+                                                                </div>
+                                                                <div class="mb-0">
+                                                                    <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                                </div>
+                                                            </form>
+                                                        </span>
+                                                        @if($claim->companyPro && $claim->companyPro->company)
+                                                            <span moe class="ml-1">
+                                                                <a class="text-danger" href="" show start><i class="fa fa-trash-alt"></i></a>
+                                                                <form url="/api/claim/wipeCompanyPro">
+                                                                    <input type="hidden" name="uid" value="{{$claim->uid}}">
+                                                                    <p>Wipe company from this claim?</p>
+                                                                    <div class="mb-0">
+                                                                        <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                                                        <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                                    </div>
+                                                                </form>
+                                                            </span>
+                                                        @endif
+                                                    @endif
+                                                </div>
+
+                                                <div class="mt-1">
+                                                    <span class="text-secondary text-sm">Location: </span>
+                                                    <b>{{$claim->companyLocation ? $claim->companyLocation->line1 . ', ' . $claim->companyLocation->city : '-'}}</b>
+                                                    @if($claim->status !== 'CANCELLED')
+                                                        <span moe class="ml-1">
+                                                            <a class="text-primary" href="" show start><i class="fa fa-edit"></i></a>
+                                                            <form url="/api/claim/putCompanyLocation">
+                                                                <input type="hidden" name="uid" value="{{$claim->uid}}">
+                                                                <div class="mb-2">
+                                                                    <select name="companyLocationUid" class="form-control form-control-sm">
+                                                                        <option value="">-- select --</option>
+                                                                        @if($claim->company && $claim->company->locations)
+                                                                            @foreach($claim->company->locations as $location)
+                                                                                <option value="{{$location->uid}}"
+                                                                                        {{$claim->companyLocation && $claim->companyLocation->uid === $location->uid ? 'selected' : ''}}>
+                                                                                    {{$location->line1 . ', ' . $location->city}}
+                                                                                </option>
+                                                                            @endforeach
+                                                                        @endif
+                                                                    </select>
+                                                                </div>
+                                                                <div class="mb-0">
+                                                                    <button class="btn btn-success btn-sm" submit>Submit</button>
+                                                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                                </div>
+                                                            </form>
+                                                        </span>
+                                                        @if($claim->companyLocation)
+                                                        <span moe class="ml-1">
+                                                            <a class="text-danger" href="" show start><i class="fa fa-trash-alt"></i></a>
+                                                            <form url="/api/claim/wipeCompanyLocation">
+                                                                <input type="hidden" name="uid" value="{{$claim->uid}}">
+                                                                <p>Wipe location from this claim?</p>
+                                                                <div class="mb-0">
+                                                                    <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                                                    <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                                </div>
+                                                            </form>
+                                                        </span>
+                                                        @endif
+                                                    @endif
+                                                </div>
+                                            </div>
+                                        </td>
+                                        <td class="p-0 border-left border-right">
+                                            <table class="table table-sm table-condensed border-0 mb-0">
+                                                @if($claim->status !== 'CANCELLED')
+                                                    <thead>
+                                                    <tr class="">
+                                                        <th colspan="3" class="border-top-0 border-bottom">
+                                                            <div>
+                                                                <span moe class="d-block" title="Submit Claim">
+                                                                    <a class="" href="" show start>Generate Submission to Payer (1°)</a>
+                                                                    <form url="/api/mbClaim/create">
+                                                                        <input type="hidden" name="claimUid" value="{{$claim->uid}}">
+                                                                        <p>Generate Submission?</p>
+                                                                        <div class="mb-0">
+                                                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                                        </div>
+                                                                    </form>
+                                                                </span>
+                                                            </div>
+                                                        </th>
+                                                    </tr>
+                                                    </thead>
+                                                @endif
+                                                @if(count($claim->mbClaims))
+                                                    <thead>
+                                                    <tr class="bg-light">
+                                                        <th class="border-0">Created</th>
+                                                        <th class="border-0">Status</th>
+                                                        <th class="border-0">&nbsp;</th>
+                                                    </tr>
+                                                    </thead>
+                                                    <tbody class="pb-3">
+                                                    @foreach($claim->mbClaims as $mbClaim)
+                                                        <tr>
+                                                            <td>
+                                                                @if($mbClaim->claim_version_id !== $claim->current_version_id)
+                                                                    <i class="fa fa-exclamation-triangle text-warning-mellow text-sm" title="This submission was generated using an older version of the claim"></i>
+                                                                @else
+                                                                    <i class="fa fa-asterisk text-secondary text-sm" title="This submission is up to date"></i>
+                                                                @endif
+                                                                <a native target="_blank"
+                                                                   open-in-stag-popup
+                                                                   title="Submission Details"
+                                                                   href="{{route('mb-claim', ['patient' => $patient, 'mbClaim' => $mbClaim])}}">
+                                                                    {{ friendlier_date_time($mbClaim->created_at) }}
+                                                                </a>
+                                                            </td>
+                                                            <td>
+                                                                {{$mbClaim->status}}
+                                                                @if($mbClaim->status_memo)
+                                                                    <div class="font-italic text-secondary text-sm">{{$mbClaim->status_memo}}</div>
+                                                                @endif
+                                                            </td>
+                                                            <td class="text-right pr-2">
+                                                                 <span moe relative title="Submit Claim">
+                                                                    <a class="" href="" show start><i class="fa fa-edit"></i></a>
+                                                                    <form url="/api/mbClaim/updateStatus" right>
+                                                                        <input type="hidden" name="uid" value="{{$mbClaim->uid}}">
+                                                                        <div class="form-group">
+                                                                            <label for="" class="control-label">Status</label>
+                                                                            <select name="status" class="form-control form-control-sm" required>
+                                                                                <option value="">-- select --</option>
+                                                                                <option value="NEW" {{$mbClaim->status === 'NEW' ? 'selected' : ''}}>New</option>
+                                                                                <option value="PROCESSING" {{$mbClaim->status === 'PROCESSING' ? 'selected' : ''}}>Processing</option>
+                                                                                <option value="SUBMITTED" {{$mbClaim->status === 'SUBMITTED' ? 'selected' : ''}}>Submitted</option>
+                                                                            </select>
+                                                                        </div>
+                                                                        <div class="form-group">
+                                                                            <label for="" class="control-label">Status Memo</label>
+                                                                            <textarea name="memo" class="form-control"></textarea>
+                                                                        </div>
+                                                                        <div class="mb-0">
+                                                                            <button class="btn btn-primary btn-sm" submit>Submit</button>
+                                                                            <button class="btn btn-default border btn-sm" cancel>Cancel</button>
+                                                                        </div>
+                                                                    </form>
+                                                                </span>
+                                                                <a class="ml-1" target="_blank" native href="/api/mbClaim/downloadEDI/{{$mbClaim->uid}}" show start><i class="fa fa-file-download"></i></a>
+                                                                <a class="ml-1 text-success" href="" show start><i class="fa fa-arrow-right"></i></a>
+                                                            </td>
+                                                        </tr>
+                                                    @endforeach
+                                                    </tbody>
+                                                @else
+                                                    <tbody>
+                                                        <tr>
+                                                            <td colspan="3">
+                                                                <p class="p-1 text-secondary m-0">No submissions in this claim</p>
+                                                            </td>
+                                                        </tr>
+                                                    </tbody>
+                                                @endif
+                                            </table>
+                                        </td>
+                                    </tr>
+                                @endif
                             @endforeach
                             </tbody>
                         </table>

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

@@ -4,6 +4,27 @@
             let numSectionsPendingInitialization = 0;
 
             function init() {
+
+                $('.note-method-select').change(function() {
+                    let form = $(this).closest('form');
+                    if(this.value === 'IN_CLINIC') {
+                        form.find('.if-in-clinic').show();
+                    }
+                    else {
+                        form.find('.if-in-clinic').hide();
+                    }
+                });
+
+                $('.note-method-select').each(function() {
+                    let form = $(this).closest('form');
+                    if(this.value === 'IN_CLINIC') {
+                        form.find('.if-in-clinic').show();
+                    }
+                    else {
+                        form.find('.if-in-clinic').hide();
+                    }
+                });
+
                 $('textarea[rte]').each(function() {
 
                     $(this).wrap(

+ 31 - 1
resources/views/app/patient/notes.blade.php

@@ -8,18 +8,38 @@
             <span class="mx-2 text-secondary">|</span>
             <div moe>
                 <a start show class="py-0 mb-3">Add</a>
-                <form url="/api/note/createUsingFreeTextHtml" class="mcp-theme-1"
+                <form url="/api/note/create" class="mcp-theme-1"
                       redir="patients/view/{{ $patient->uid }}/notes/view/[data]">
                     <input type="hidden" name="clientUid" value="{{$patient->uid}}">
                     <input type="hidden" name="hcpProUid" value="{{$pro->uid}}">
                     <input type="hidden" name="effectiveDateEST" value="{{ date('Y-m-d') }}">
                     <div class="form-group">
+                        <label for="" class="text-secondary text-sm mb-1">Type *</label>
                         <select name="newOrFuOrNa" class="form-control">
                             <option value="NEW">New Patient</option>
                             <option value="FU">Follow Up</option>
                             <option value="NA">N/A</option>
                         </select>
                     </div>
+                    <div class="form-group">
+                        <label for="" class="text-secondary text-sm mb-1">Method *</label>
+                        <select name="method" class="form-control note-method-select" required>
+                            <option value="">-- select --</option>
+                            <option value="VIDEO">Video</option>
+                            <option value="AUDIO">Audio</option>
+                            <option value="IN_CLINIC">In Clinic</option>
+                            <option value="HOUSE_CALL">House Call</option>
+                        </select>
+                    </div>
+                    <div class="form-group if-in-clinic">
+                        <label for="" class="text-secondary text-sm mb-1">Location</label>
+                        <select name="hcpCompanyLocationUid" class="form-control">
+                            <option value="-- select --"></option>
+                            @foreach($pro->companyLocations() as $location)
+                                <option value="{{$location->uid}}">{{$location->line1}} {{$location->city}}</option>
+                            @endforeach
+                        </select>
+                    </div>
                     <div>
                         <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
                         <button cancel class="btn btn-sm btn-default border">Cancel</button>
@@ -159,6 +179,16 @@
                             }
                         }, 'json');
                     });
+
+                $('.note-method-select').change(function() {
+                    let form = $(this).closest('form');
+                    if(this.value === 'IN_CLINIC') {
+                        form.find('.if-in-clinic').show();
+                    }
+                    else {
+                        form.find('.if-in-clinic').hide();
+                    }
+                });
             }
             addMCInitializer('notes-list', initNotesList);
         })();

+ 1 - 1
resources/views/app/patient/partials/mcp-queue.blade.php

@@ -102,7 +102,7 @@
                 self.refresh();
                 window.setInterval(function(){
                     self.refresh();
-                }, 5000)
+                }, 60000);
                 let socket = new SockJS("{{ config('app.backend_ws_url') }}");
                 self.socketClient = Stomp.over(socket);
                 self.socketClient.connect({}, (frame) => {

+ 59 - 12
resources/views/app/patient/partials/packs.blade.php

@@ -8,12 +8,12 @@
             <div class="mb-2">
                 <label class="text-secondary mb-1 text-sm">Ship Date</label>
                 <input type="date" class="form-control form-control-sm"
-                       name="shipDate" value="">
+                       name="shipDate" value="{{date('Y-m-d')}}">
             </div>
             <div class="mb-2">
                 <label class="text-secondary mb-1 text-sm">Courier</label>
                 <input type="text" class="form-control form-control-sm"
-                       name="courier" value="">
+                       name="courier" value="FedEx">
             </div>
             <div class="mb-2">
                 <label class="text-secondary mb-1 text-sm">Label File</label>
@@ -23,7 +23,7 @@
             <div class="mb-2">
                 <label class="text-secondary mb-1 text-sm">Tracking Number</label>
                 <input type="text" class="form-control form-control-sm"
-                       name="trackingNumber" value="">
+                       name="trackingNumber" value="" autofocus>
             </div>
             <div class="d-flex align-items-center">
                 <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
@@ -41,8 +41,7 @@
             <th class="px-2 text-nowrap text-secondary border-bottom-0">#</th>
             <th class="px-2 text-nowrap text-secondary border-bottom-0">Items</th>
             <th class="px-2 text-nowrap text-secondary border-bottom-0">Label</th>
-            <th class="px-2 text-nowrap text-secondary border-bottom-0">Courier</th>
-            <th class="px-2 text-nowrap text-secondary border-bottom-0">Tracking #</th>
+            <th class="px-2 text-nowrap text-secondary border-bottom-0">Courier / Tracking #</th>
             <th class="px-2 text-nowrap text-secondary border-bottom-0">Status</th>
             <th class="px-2 text-nowrap text-secondary border-bottom-0">&nbsp;</th>
         </tr>
@@ -86,20 +85,68 @@
                         @endif
                     </td>
                     <td class="px-2">
-                        {{$pack->label_system_file_id}}
-                    </td>
-                    <td class="px-2">
-                        {{$pack->courier}}
+                        @if($pack->label_system_file_id)
+                            <a class="pdf-viewer-trigger" native target="_blank"
+                               href="/api/pack/downloadLabel/{{ $pack->uid }}"
+                               title="View">View</a>
+                        @else
+                            <span class="text-secondary">(not set)</span>
+                        @endif
+                        <a native target="_top" href="/api/pack/downloadLabel/{{ $pack->uid }}" class="ml-2">
+                            <i class="fa fa-download"></i>
+                        </a>
+                        <div moe relative class="ml-1">
+                            <a start show href="#"><i class="fa fa-edit"></i></a>
+                            <form url="/api/pack/updateLabel" right>
+                                <input type="hidden" name="uid" value="{{ $pack->uid }}">
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Label File</label>
+                                    <input type="file" class="form-control form-control-sm"
+                                           name="label" value="">
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Submit</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
                     </td>
                     <td class="px-2">
-                        {{$pack->tracking_number}}
+                        {{$pack->courier ? $pack->courier : '(not set)'}}
+                        /
+                        {{$pack->tracking_number ? substr($pack->tracking_number, -12) . '...' : '(not set)'}}
+                        <div moe relative class="ml-2">
+                            <a start show href="#"><i class="fa fa-edit"></i></a>
+                            <form url="/api/pack/updateCourierInfo" right>
+                                <input type="hidden" name="uid" value="{{ $pack->uid }}">
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Courier</label>
+                                    <input type="text" class="form-control form-control-sm"
+                                           name="courier" value="{{$pack->courier}}">
+                                </div>
+                                <div class="mb-2">
+                                    <label class="text-secondary mb-1 text-sm">Tracking Number</label>
+                                    <input type="text" class="form-control form-control-sm"
+                                           name="trackingNumber" value="{{$pack->tracking_number}}">
+                                </div>
+                                <div class="d-flex align-items-center">
+                                    <button class="btn btn-sm btn-primary mr-2" submit>Submit</button>
+                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                                </div>
+                            </form>
+                        </div>
+                        @if(strtolower($pack->courier) === 'fedex' && $pack->tracking_number && strlen($pack->tracking_number) >= 12)
+                        <a native target="_blank" class="d-block mt-1" href="https://www.fedex.com/fedextrack/?trknbr={{substr($pack->tracking_number, -12)}}">
+                            Track via FedEx
+                        </a>
+                        @endif
                     </td>
                     <td class="px-2">
-                        {{$pack->status}}
+                        {{$pack->status ? $pack->status : '-'}}
                     </td>
                     <td class="px-2">
                         <div moe relative>
-                            <a start show class="py-0 text-danger"><i class="fa fa-times-circle text-danger"></i></a>
+                            <a start show class="py-0 text-danger">Remove</a>
                             <form url="/api/pack/updateStatus" right>
                                 <input type="hidden" name="uid" value="{{ $pack->uid }}">
                                 <input type="hidden" name="status" value="DELETED">

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

@@ -574,7 +574,7 @@
                         <span class="text-secondary mx-2">|</span>
                         @if(!$patient->is_coverage_manually_verified)
                             <div moe wide>
-                                <a start show><i class="fa fa-edit"></i> Set coverage to <b>Manually Verified</b></a>
+                                <a start show><i class="fa fa-edit"></i> <b>Set Part B to Manually Verified</b></a>
                                 <form url="/api/client/markCoverageAsManuallyVerified" class="mcp-theme-1">
                                     <input type="hidden" name="uid" value="{{$patient->uid}}">
                                     <div class="mb-2">
@@ -589,7 +589,7 @@
                                 </form>
                             </div>
                         @else
-                            <span class="text-info font-weight-bold"><i class="fa fa-check"></i>&nbsp;Manually Verified</span>
+                            <span class="text-info font-weight-bold"><i class="fa fa-check"></i>&nbsp;Part B Manually Verified</span>
                             <div moe wide class="ml-3">
                                 <a start show><i class="fa fa-edit"></i> Undo</a>
                                 <form url="/api/client/undoMarkCoverageAsManuallyVerified" class="mcp-theme-1">

+ 291 - 0
resources/views/app/practice-management/billing-manager-v1.blade.php

@@ -0,0 +1,291 @@
+@extends ('layouts/template')
+
+@section('content')
+
+    <div class="p-3 mcp-theme-1" id="practice-billing-manager">
+
+        <div class="card">
+
+            <div class="card-header px-3 py-2 d-flex align-items-center">
+                <strong class="mr-4 font-size-14">
+                    <i class="fas fa-user-injured"></i>
+                    Billing Manager
+                    @if(request()->input('date'))
+                        - Notes on {{friendlier_date(request()->input('date'))}}
+                    @endif
+                </strong>
+                @if(!request()->input('popupmode'))
+                <select class="ml-auto max-width-300px form-control form-control-sm"
+                        onchange="fastLoad('/practice-management/billing-manager/' + this.value, true, false, false)">
+                    <option value="" {{ $proUid === '' ? 'selected' : '' }}>All Pros</option>
+                    @foreach($allPros as $_pro)
+                        <option value="{{$_pro->uid}}" {{ $proUid === $_pro->uid ? 'selected' : '' }}>{{$_pro->displayName()}}</option>
+                    @endforeach
+                </select>
+                @endif
+            </div>
+            @if(!request()->input('popupmode'))
+            <div class="bg-aliceblue border-bottom px-3 py-2 d-flex align-items-center">
+                <div class="d-inline-flex align-items-center">
+                    <span class="border-bottom c-pointer" title="Filter notes with/without bills on them">Bills Created</span>
+                    <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['bills_created'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
+                            data-filter="bills_created">
+                        <option value="">All</option>
+                        <option value="yes" {{$filters['bills_created'] === 'yes' ? 'selected' : ''}}>Yes</option>
+                        <option value="no" {{$filters['bills_created'] === 'no' ? 'selected' : ''}}>No</option>
+                    </select>
+                </div>
+                <div class="d-inline-flex align-items-center ml-3">
+                    <span class="border-bottom c-pointer" title="Filter notes with/without billing marked as done">Billing Marked As Done</span>
+                    <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['is_billing_marked_done'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
+                            data-filter="is_billing_marked_done">
+                        <option value="">All</option>
+                        <option value="yes" {{$filters['is_billing_marked_done'] === 'yes' ? 'selected' : ''}}>Yes</option>
+                        <option value="no" {{$filters['is_billing_marked_done'] === 'no' ? 'selected' : ''}}>No</option>
+                    </select>
+                </div>
+                <div class="d-inline-flex align-items-center ml-3">
+                    <span class="border-bottom c-pointer" title="Filter notes with/without any bills that are neither cancelled nor verified">Bills Resolved</span>
+                    <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['bills_resolved'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
+                            data-filter="bills_resolved">
+                        <option value="">All</option>
+                        <option value="yes" {{$filters['bills_resolved'] === 'yes' ? 'selected' : ''}}>Yes</option>
+                        <option value="no" {{$filters['bills_resolved'] === 'no' ? 'selected' : ''}}>No</option>
+                    </select>
+                </div>
+                <div class="d-inline-flex align-items-center ml-3">
+                    <span class="border-bottom c-pointer" title="Filter notes with/without billing closed">Bills Closed</span>
+                    <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['bills_closed'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
+                            data-filter="bills_closed">
+                        <option value="">All</option>
+                        <option value="yes" {{$filters['bills_closed'] === 'yes' ? 'selected' : ''}}>Yes</option>
+                        <option value="no" {{$filters['bills_closed'] === 'no' ? 'selected' : ''}}>No</option>
+                    </select>
+                </div>
+                <div class="d-inline-flex align-items-center ml-3">
+                    <span class="border-bottom c-pointer" title="Filter notes with/without claims on them">Claims Created</span>
+                    <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['claims_created'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
+                            data-filter="claims_created">
+                        <option value="">All</option>
+                        <option value="yes" {{$filters['claims_created'] === 'yes' ? 'selected' : ''}}>Yes</option>
+                        <option value="no" {{$filters['claims_created'] === 'no' ? 'selected' : ''}}>No</option>
+                    </select>
+                </div>
+                <div class="d-inline-flex align-items-center ml-3">
+                    <span class="border-bottom c-pointer" title="Filter notes with/without claiming closed">Claims Closed</span>
+                    <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['claims_closed'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
+                            data-filter="claims_closed">
+                        <option value="">All</option>
+                        <option value="yes" {{$filters['claims_closed'] === 'yes' ? 'selected' : ''}}>Yes</option>
+                        <option value="no" {{$filters['claims_closed'] === 'no' ? 'selected' : ''}}>No</option>
+                    </select>
+                </div>
+                <a href="/practice-management/billing-manager" class="ml-auto">Clear Filters</a>
+            </div>
+            @endif
+            <div class="card-body p-0">
+                <table class="table table-sm table-condensed p-0 m-0">
+                    <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">Note Eff. Date</th>
+                        <th class="border-0">HCP</th>
+                        <th class="border-0">Signed?</th>
+                        <th class="border-0">Bills</th>
+                        @if($performer->pro->pro_type == 'ADMIN')
+                            <th class="border-0">Assessments</th>
+                        @endif
+                        @if($performer->pro->pro_type == 'ADMIN')
+                            <th class="border-0">Claims</th>
+                        @endif
+                        <th class="px-3 border-0">Created</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach ($notes as $note)
+                        <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
+                            <td class="">
+                                <a {{ request()->input('popupmode') ? 'native target="_blank"' : '' }} href="/patients/view/{{ $note->client->uid }}">{{ $note->client->displayName() }}</a>
+                            </td>
+                            <td class="">
+                                <div class="font-weight-bold">{{ friendly_date_time($note->effective_dateest, false) }}</div>
+                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}?popupmode=1"
+                                   native target="_blank"
+                                   class="note-popup-trigger d-block text-nowrap mt-1">
+                                    <i class="fa fa-eye"></i>
+                                    View
+                                </a>
+                                <a {{ request()->input('popupmode') ? 'native target="_blank"' : '' }} href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}"
+                                   class="d-block text-nowrap mt-1">
+                                    <i class="fa fa-external-link-alt"></i>
+                                    Open
+                                </a>
+                                <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
+                            </td>
+                            <td>{{$note->hcpPro->displayName()}}</td>
+                            <td>{{$note->is_signed_by_hcp?'Yes':'No'}}</td>
+                            <td>
+                                <table class="table table-sm table-condensed table-stripe">
+                                    <thead>
+                                    <tr>
+                                        <th>Service</th>
+                                        <th># of units</th>
+                                        <th>Signed?</th>
+                                        <th>Cancelled?</th>
+                                        <th>HCP ex. amount</th>
+                                    </tr>
+                                    </thead>
+                                    <tbody>
+                                    @foreach($note->bills as $bill)
+                                        <tr>
+                                            <td>{{$bill->code}}</td>
+                                            @if($bill->code == 'Treatment Services')
+                                                <td>{{floor($bill->number_of_units*60)}}m</td>
+                                            @else
+                                                <td>{{$bill->number_of_units}}</td>
+                                            @endif
+                                            <td>{{$bill->is_signed_by_hcp?'Yes':'No'}}</td>
+                                            <td>{{ $bill->is_cancelled ?'Yes':'No'}}</td>
+                                            <td>{{ $bill->hcp_expected_payment_amount }}</td>
+                                        </tr>
+                                    @endforeach
+                                    </tbody>
+                                </table>
+                            </td>
+                            @if($performer->pro->pro_type == 'ADMIN')
+                                <td>
+                                    <table class="table table-sm table-condensed table-stripe">
+                                        <thead>
+                                        <tr>
+                                            <th>Code</th>
+                                            <th>Description</th>
+                                        </tr>
+                                        </thead>
+                                        <tbody>
+                                        @foreach($note->reasons as $reason)
+                                            <tr>
+                                                <td>{{$reason->code}}</td>
+                                                <td>{{$reason->description}}</td>
+                                            </tr>
+                                        @endforeach
+                                        </tbody>
+                                    </table>
+                                </td>
+                            @endif
+                            @if($performer->pro->pro_type == 'ADMIN')
+                                <td>
+                                    <table class="table table-sm table-condensed table-stripe">
+                                        <thead>
+                                        <tr>
+                                            <th>Identifier</th>
+                                            <th>Submitted?</th>
+                                        </tr>
+                                        </thead>
+                                        <tbody>
+                                        @foreach($note->claims as $claim)
+                                            <tr>
+                                                <td>{{$claim->iid}}</td>
+                                                <td>{{$claim->was_submitted?'Yes':'No'}}</td>
+                                            </tr>
+                                            <tr>
+                                                <td colspan="2">
+                                                    <strong>Claim Lines</strong>
+                                                    <table class="table table-sm table-condensed table-striped">
+                                                        <tr>
+                                                            <th>CPT</th>
+                                                            <th>ICDs</th>
+                                                            <th>Date of Service</th>
+                                                        </tr>
+                                                        @foreach($claim->lines as $claimLine)
+                                                            <tr>
+                                                                <td>{{$claimLine->cpt}}</td>
+                                                                <td>{{$claimLine->icds()}}</td>
+                                                                <td>{{$claimLine->date_of_service}}</td>
+                                                            </tr>
+                                                        @endforeach
+                                                    </table>
+                                                </td>
+                                            </tr>
+                                        @endforeach
+                                        </tbody>
+                                    </table>
+                                </td>
+                            @endif
+                            <td class="px-3">
+                                {{ friendly_date_time($note->created_at, true) }}
+                            </td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+                <div>
+                    {{$notes->withQueryString()->links()}}
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <div class="stag-popup stag-popup-lg mcp-theme-1" stag-popup-key="note-popup">
+        <form method="POST" action="" class="p-0">
+            <h3 class="stag-popup-title mb-0 mt-3 mx-3 pb-0 border-bottom-0">
+                <span>Note Details</span>
+                <a href="#" class="ml-auto text-secondary"
+                   onclick="return closeStagPopup()"><i class="fa fa-times-circle"></i></a>
+            </h3>
+            <div class="pb-3 note-popup-content">
+                <div class="px-3 pt-3 text-secondary font-italic">Loading ...</div>
+            </div>
+        </form>
+    </div>
+
+    <script>
+        (function() {
+
+            function applyFilters() {
+                let params = {}, queryLine = [];
+                $('[data-filter]').each(function() {
+                    if($.trim($(this).val())) {
+                        params[$(this).attr('data-filter')] = $.trim($(this).val());
+                    }
+                });
+                for(let x in params) {
+                    if(params.hasOwnProperty(x)) {
+                        queryLine.push(x + '=' + encodeURIComponent(params[x]));
+                    }
+                }
+                queryLine = queryLine.join('&');
+
+                fastLoad('/practice-management/billing-manager?' + queryLine);
+            }
+
+            function init() {
+                $('select[data-filter]')
+                    .off('change')
+                    .on('change', applyFilters);
+                $('.note-popup-trigger')
+                    .off('click')
+                    .on('click', function() {
+                        showMask();
+                        window.noMc = true;
+                        $.get(this.href, (_data) => {
+                            $('.note-popup-content').html(_data);
+                            // not readonly anymore
+                            // $('.note-popup-content')
+                            //     .find('a, button, input, select')
+                            //         .attr('disabled', 'disabled')
+                            //         .attr('tabindex', '-1')
+                            //         .css('pointer-events', 'none');
+                            showStagPopup('note-popup');
+                            // run note single initer and allow edits
+                            runMCInitializer('note-single');
+                            hideMask();
+                        });
+                        return false;
+                    });
+            }
+
+            addMCInitializer('practice-billing-manager', init, '#practice-billing-manager')
+
+        }).call(window);
+    </script>
+@endsection

+ 172 - 86
resources/views/app/practice-management/billing-manager.blade.php

@@ -7,10 +7,14 @@
         <div class="card">
 
             <div class="card-header px-3 py-2 d-flex align-items-center">
-                <strong class="mr-4">
+                <strong class="mr-4 font-size-14">
                     <i class="fas fa-user-injured"></i>
                     Billing Manager
+                    @if(request()->input('date'))
+                        - Notes on {{friendlier_date(request()->input('date'))}}
+                    @endif
                 </strong>
+                @if(!request()->input('popupmode'))
                 <select class="ml-auto max-width-300px form-control form-control-sm"
                         onchange="fastLoad('/practice-management/billing-manager/' + this.value, true, false, false)">
                     <option value="" {{ $proUid === '' ? 'selected' : '' }}>All Pros</option>
@@ -18,10 +22,12 @@
                         <option value="{{$_pro->uid}}" {{ $proUid === $_pro->uid ? 'selected' : '' }}>{{$_pro->displayName()}}</option>
                     @endforeach
                 </select>
+                @endif
             </div>
+            @if(!request()->input('popupmode'))
             <div class="bg-aliceblue border-bottom px-3 py-2 d-flex align-items-center">
                 <div class="d-inline-flex align-items-center">
-                    <span>Bills Created</span>
+                    <span class="border-bottom c-pointer" title="Filter notes with/without bills on them">Bills Created</span>
                     <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['bills_created'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
                             data-filter="bills_created">
                         <option value="">All</option>
@@ -30,7 +36,7 @@
                     </select>
                 </div>
                 <div class="d-inline-flex align-items-center ml-3">
-                    <span>Billing Marked As Done</span>
+                    <span class="border-bottom c-pointer" title="Filter notes with/without billing marked as done">Billing Marked As Done</span>
                     <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['is_billing_marked_done'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
                             data-filter="is_billing_marked_done">
                         <option value="">All</option>
@@ -39,7 +45,7 @@
                     </select>
                 </div>
                 <div class="d-inline-flex align-items-center ml-3">
-                    <span>Bills Resolved</span>
+                    <span class="border-bottom c-pointer" title="Filter notes with/without any bills that are neither cancelled nor verified">Bills Resolved</span>
                     <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['bills_resolved'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
                             data-filter="bills_resolved">
                         <option value="">All</option>
@@ -48,7 +54,7 @@
                     </select>
                 </div>
                 <div class="d-inline-flex align-items-center ml-3">
-                    <span>Bills Closed</span>
+                    <span class="border-bottom c-pointer" title="Filter notes with/without billing closed">Bills Closed</span>
                     <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['bills_closed'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
                             data-filter="bills_closed">
                         <option value="">All</option>
@@ -57,7 +63,7 @@
                     </select>
                 </div>
                 <div class="d-inline-flex align-items-center ml-3">
-                    <span>Claims Created</span>
+                    <span class="border-bottom c-pointer" title="Filter notes with/without claims on them">Claims Created</span>
                     <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['claims_created'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
                             data-filter="claims_created">
                         <option value="">All</option>
@@ -66,7 +72,7 @@
                     </select>
                 </div>
                 <div class="d-inline-flex align-items-center ml-3">
-                    <span>Claims Closed</span>
+                    <span class="border-bottom c-pointer" title="Filter notes with/without claiming closed">Claims Closed</span>
                     <select class="form-control form-control-sm min-width-unset width-70px ml-2 {{ !!$filters['claims_closed'] ? 'border-info font-weight-bold text-info' : 'text-secondary on-hover-opaque' }}"
                             data-filter="claims_closed">
                         <option value="">All</option>
@@ -76,29 +82,30 @@
                 </div>
                 <a href="/practice-management/billing-manager" class="ml-auto">Clear Filters</a>
             </div>
+            @endif
             <div class="card-body p-0">
+                <div class="stag-table-container stag-table-container-lg">
                 <table class="table table-sm table-condensed p-0 m-0">
                     <thead class="bg-light">
                     <tr>
                         <th class="border-0">Patient</th>
                         <th class="border-0">Note Eff. Date</th>
+                        <th class="border-0">Created</th>
                         <th class="border-0">HCP</th>
                         <th class="border-0">Signed?</th>
-                        <th class="border-0">Bills</th>
                         @if($performer->pro->pro_type == 'ADMIN')
                             <th class="border-0">Assessments</th>
                         @endif
                         @if($performer->pro->pro_type == 'ADMIN')
                             <th class="border-0">Claims</th>
                         @endif
-                        <th class="px-3 border-0">Created</th>
                     </tr>
                     </thead>
                     <tbody>
                     @foreach ($notes as $note)
                         <tr class="{{ $note->is_cancelled ? 'cancelled-item always-clickable' : '' }}">
                             <td class="">
-                                <a href="/patients/view/{{ $note->client->uid }}">{{ $note->client->displayName() }}</a>
+                                <a {{ request()->input('popupmode') ? 'native target="_blank"' : '' }} href="/patients/view/{{ $note->client->uid }}">{{ $note->client->displayName() }}</a>
                             </td>
                             <td class="">
                                 <div class="font-weight-bold">{{ friendly_date_time($note->effective_dateest, false) }}</div>
@@ -108,57 +115,25 @@
                                     <i class="fa fa-eye"></i>
                                     View
                                 </a>
-                                <a href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}"
+                                <a {{ request()->input('popupmode') ? 'native target="_blank"' : '' }} href="/patients/view/{{ $note->client->uid }}/notes/view/{{ $note->uid }}"
                                    class="d-block text-nowrap mt-1">
                                     <i class="fa fa-external-link-alt"></i>
                                     Open
                                 </a>
                                 <span class="ml-1">{{ $note->is_cancelled ? '[cancelled]' : '' }}</span>
                             </td>
+                            <td class="">
+                                {{ friendly_date_time($note->created_at, true) }}
+                            </td>
                             <td>{{$note->hcpPro->displayName()}}</td>
                             <td>{{$note->is_signed_by_hcp?'Yes':'No'}}</td>
-                            <td>
-                                <table class="table table-sm table-condensed table-stripe">
-                                    <thead>
-                                    <tr>
-                                        <th>Service</th>
-                                        <th># of units</th>
-                                        <th>Signed?</th>
-                                        <th>Cancelled?</th>
-                                        <th>HCP ex. amount</th>
-                                    </tr>
-                                    </thead>
-                                    <tbody>
-                                    @foreach($note->bills as $bill)
-                                        <tr>
-                                            <td>{{$bill->code}}</td>
-                                            @if($bill->code == 'Treatment Services')
-                                                <td>{{floor($bill->number_of_units*60)}}m</td>
-                                            @else
-                                                <td>{{$bill->number_of_units}}</td>
-                                            @endif
-                                            <td>{{$bill->is_signed_by_hcp?'Yes':'No'}}</td>
-                                            <td>{{ $bill->is_cancelled ?'Yes':'No'}}</td>
-                                            <td>{{ $bill->hcp_expected_payment_amount }}</td>
-                                        </tr>
-                                    @endforeach
-                                    </tbody>
-                                </table>
-                            </td>
                             @if($performer->pro->pro_type == 'ADMIN')
                                 <td>
                                     <table class="table table-sm table-condensed table-stripe">
-                                        <thead>
-                                        <tr>
-                                            <th>Code</th>
-                                            <th>Description</th>
-                                        </tr>
-                                        </thead>
                                         <tbody>
                                         @foreach($note->reasons as $reason)
                                             <tr>
-                                                <td>{{$reason->code}}</td>
-                                                <td>{{$reason->description}}</td>
+                                                <td class="border-0"><span class="border-bottom c-pointer" title="{{$reason->description}}">{{$reason->code}}</span></td>
                                             </tr>
                                         @endforeach
                                         </tbody>
@@ -166,53 +141,164 @@
                                 </td>
                             @endif
                             @if($performer->pro->pro_type == 'ADMIN')
-                                <td>
-                                    <table class="table table-sm table-condensed table-stripe">
-                                        <thead>
-                                        <tr>
-                                            <th>Identifier</th>
-                                            <th>Submitted?</th>
-                                        </tr>
-                                        </thead>
-                                        <tbody>
-                                        @foreach($note->claims as $claim)
+                                <td class="p-0">
+                                    @if($note->claims->count())
+                                        <table class="table table-sm tabe-striped m-0 border-left border-bottom-0">
+                                            <thead class="bg-light">
                                             <tr>
-                                                <td>{{$claim->iid}}</td>
-                                                <td>{{$claim->was_submitted?'Yes':'No'}}</td>
+                                                <th class="border-0 pl-2">IID</th>
+                                                <th class="border-0">Details</th>
+                                                <th class="border-0">Current Version</th>
+                                                <th class="border-0">Status</th>
+                                                <th class="border-0">Submissions</th>
                                             </tr>
-                                            <tr>
-                                                <td colspan="2">
-                                                    <strong>Claim Lines</strong>
-                                                    <table class="table table-sm table-condensed table-striped">
-                                                        <tr>
-                                                            <th>CPT</th>
-                                                            <th>ICDs</th>
-                                                            <th>Date of Service</th>
-                                                        </tr>
-                                                        @foreach($claim->lines as $claimLine)
-                                                            <tr>
-                                                                <td>{{$claimLine->cpt}}</td>
-                                                                <td>{{$claimLine->icds()}}</td>
-                                                                <td>{{$claimLine->date_of_service}}</td>
-                                                            </tr>
-                                                        @endforeach
-                                                    </table>
-                                                </td>
-                                            </tr>
-                                        @endforeach
-                                        </tbody>
-                                    </table>
+                                            </thead>
+                                            <tbody>
+                                            @foreach ($note->claims as $claim)
+                                                @if($claim->status !== 'CANCELLED' || request('claims-filter') === 'all')
+                                                    <tr class="bg-secondary on-hover-opaque">
+                                                        <td colspan="5" class="pt-0 pb-1"></td>
+                                                    </tr>
+                                                    <tr class="{{ $claim->status === 'CANCELLED' ? 'text-secondary bg-light on-hover-opaque' : '' }}">
+                                                    <td class="pl-2">
+                                                        <div>{{ $claim->iid }}</div>
+                                                        @if($claim->status === 'CANCELLED')
+                                                            <div class="text-secondary font-weight-bold text-sm mt-1">[CANCELLED]</div>
+                                                        @endif
+                                                    </td>
+                                                    <td class="p-0 border-left border-right">
+                                                        @if($claim->lines->count())
+                                                            <table class="table table-sm table-condensed border-0 mb-0">
+                                                                <thead>
+                                                                <tr class="bg-light">
+                                                                    <th class="border-0">CPT</th>
+                                                                    <th class="border-0">DOS</th>
+                                                                    <th class="border-0">ICDs</th>
+                                                                </tr>
+                                                                </thead>
+                                                                <tbody class="pb-3">
+                                                                @foreach($claim->lines as $line)
+                                                                    <tr class="claim-line">
+                                                                        <td>{{$line->cpt}}</td>
+                                                                        <td class="text-nowrap">{{friendlier_date($line->date_of_service)}}</td>
+                                                                        <td>
+                                                                            @if(count($line->claimLineIcds))
+                                                                                @foreach($line->claimLineIcds as $icd)
+                                                                                    <div>
+                                                                                        <b class="c-pointer border-secondary border-bottom" title="{{$icd->description}}">{{$icd->code}}</b>
+                                                                                    </div>
+                                                                                @endforeach
+                                                                            @else
+                                                                                <p>No ICDs set</p>
+                                                                            @endif
+                                                                        </td>
+                                                                    </tr>
+                                                                @endforeach
+                                                                </tbody>
+                                                            </table>
+                                                        @else
+                                                            <p>No lines for this claim</p>
+                                                        @endif
+                                                    </td>
+                                                    <td class="border-right">
+                                                        {{$claim->currentVersion ? friendlier_date_time($claim->currentVersion->created_at) : '-'}}
+                                                    </td>
+                                                    <td class="border-right p-0">
+
+                                                        <!-- status -->
+                                                        <div class="p-1 border-bottom">
+                                                            <div>
+                                                                <span class="text-secondary text-sm">Status: </span>{{$claim->status ? $claim->status : '(not set)'}}
+                                                            </div>
+                                                            @if($claim->status_memo)
+                                                                <div class="text-secondary font-italic text-sm">{{$claim->status_memo}}</div>
+                                                            @endif
+                                                        </div>
+
+                                                        <!-- payer, company, location -->
+                                                        <div class="p-1">
+                                                            <div class="mt-1">
+                                                                <span class="text-secondary text-sm">Payer (1°): </span>
+                                                                <b>{{$claim->primaryPayer ? $claim->primaryPayer->name : '-'}}</b>
+                                                            </div>
+
+                                                            <div class="mt-1">
+                                                                <span class="text-secondary text-sm">Payer (2°): </span>
+                                                                <b>-</b>
+                                                            </div>
+
+                                                            <div class="mt-1">
+                                                                <span class="text-secondary text-sm">Company: </span>
+                                                                <b>{{$claim->companyPro && $claim->companyPro->company ? $claim->companyPro->company->name : '-'}}</b>
+                                                            </div>
+
+                                                            <div class="mt-1">
+                                                                <span class="text-secondary text-sm">Location: </span>
+                                                                <b>{{$claim->companyLocation ? $claim->companyLocation->line1 . ', ' . $claim->companyLocation->city : '-'}}</b>
+                                                            </div>
+                                                        </div>
+                                                    </td>
+                                                    <td class="p-0 border-left border-right">
+                                                        <table class="table table-sm table-condensed border-0 mb-0">
+                                                            @if(count($claim->mbClaims))
+                                                                <thead>
+                                                                <tr class="bg-light">
+                                                                    <th class="border-0">Created</th>
+                                                                    <th class="border-0">Status</th>
+                                                                    <th class="border-0">&nbsp;</th>
+                                                                </tr>
+                                                                </thead>
+                                                                <tbody class="pb-3">
+                                                                @foreach($claim->mbClaims as $mbClaim)
+                                                                    <tr>
+                                                                        <td>
+                                                                            @if($mbClaim->claim_version_id !== $claim->current_version_id)
+                                                                                <i class="fa fa-exclamation-triangle text-warning-mellow text-sm" title="This submission was generated using an older version of the claim"></i>
+                                                                            @else
+                                                                                <i class="fa fa-asterisk text-secondary text-sm" title="This submission is up to date"></i>
+                                                                            @endif
+                                                                            {{ friendlier_date_time($mbClaim->created_at) }}
+                                                                        </td>
+                                                                        <td>
+                                                                            {{$mbClaim->status}}
+                                                                            @if($mbClaim->status_memo)
+                                                                                <div class="font-italic text-secondary text-sm">{{$mbClaim->status_memo}}</div>
+                                                                            @endif
+                                                                        </td>
+                                                                        <td class="text-right pr-2">
+                                                                            <a class="ml-1" target="_blank" native href="/api/mbClaim/downloadEDI/{{$mbClaim->uid}}" show start><i class="fa fa-file-download"></i></a>
+                                                                        </td>
+                                                                    </tr>
+                                                                @endforeach
+                                                                </tbody>
+                                                            @else
+                                                                <tbody>
+                                                                <tr>
+                                                                    <td colspan="3">
+                                                                        <p class="p-1 text-secondary m-0">No submissions in this claim</p>
+                                                                    </td>
+                                                                </tr>
+                                                                </tbody>
+                                                            @endif
+                                                        </table>
+                                                    </td>
+                                                    </tr>
+                                                @endif
+                                            @endforeach
+                                            </tbody>
+                                        </table>
+                                    @else
+                                        <p class="p-1 mb-0 text-secondary">No claims in this note</p>
+                                    @endif
                                 </td>
                             @endif
-                            <td class="px-3">
-                                {{ friendly_date_time($note->created_at, true) }}
-                            </td>
                         </tr>
                     @endforeach
                     </tbody>
                 </table>
-                <div>
-                    {{$notes->links()}}
+                </div>
+                <div class="pt-3 pl-3">
+                    {{$notes->withQueryString()->links()}}
                 </div>
             </div>
         </div>

+ 8 - 0
resources/views/app/practice-management/billing-report.blade.php

@@ -26,6 +26,7 @@
                     <th>Claims</th>
                     <th>Bills</th>
                     <th>ICDs</th>
+                    <th>Submissions</th>
                 </tr>
                 </thead>
                 <tbody>
@@ -68,6 +69,13 @@
                         <td class="text-nowrap border-left-0">
                             <pre>{{$row->icds}}</pre>
                         </td>
+                        <td class="text-nowrap border-left-0">
+                            @foreach($row->note->claims as $claim)
+                                @foreach($claim->mbClaims as $mbClaim )
+                                {{$mbClaim->status}} {{$mbClaim->status_memo}}
+                                @endforeach
+                            @endforeach
+                        </td>
                     </tr>
                 @endforeach
                 </tbody>

+ 1 - 117
resources/views/app/practice-management/shipment.blade.php

@@ -191,123 +191,7 @@
                     </table>
                 </div>
 
-                <div class="bg-light border px-2 pt-2">
-
-                    <div class="mb-2 d-flex align-items-baseline">
-                        <label class="text-secondary mb-0 width-90px mr-2">Ship Date</label>
-                        <div moe bottom relative class="d-block">
-                            <a start
-                               show>{{$shipment->ship_date ? friendlier_date($shipment->ship_date) : '(not set)'}}</a>
-                            <form url="/api/shipment/setShipDate">
-                                <input type="hidden" name="uid" value="{{ $shipment->uid }}">
-                                <div class="mb-2">
-                                    <label class="text-secondary mb-1 text-sm">Ship Date *</label>
-                                    <input type="date" class="form-control form-control-sm" required
-                                           name="shipDate" value="{{$shipment->ship_date}}">
-                                </div>
-                                <div class="d-flex align-items-center">
-                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-                    </div>
-
-                    <div class="mb-2 d-flex align-items-baseline">
-                        <label class="text-secondary mb-0 width-90px mr-2">Courier</label>
-                        <div moe bottom relative class="d-block">
-                            <a start show>{{$shipment->courier ? $shipment->courier : '(not set)'}}</a>
-                            <form url="/api/shipment/setCourier">
-                                <input type="hidden" name="uid" value="{{ $shipment->uid }}">
-                                <div class="mb-2">
-                                    <label class="text-secondary mb-1 text-sm">Courier</label>
-                                    <input type="text" class="form-control form-control-sm"
-                                           name="courier" value="{{$shipment->courier}}">
-                                </div>
-                                <div class="d-flex align-items-center">
-                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-                    </div>
-
-                    <div class="mb-2 d-flex align-items-baseline">
-                        <label class="text-secondary mb-0 width-90px mr-2">Label File</label>
-                        @if($shipment->label_system_file_id)
-                            <a class="pdf-viewer-trigger" native target="_blank"
-                               href="/api/shipment/downloadLabel/{{ $shipment->uid }}"
-                               title="View">
-                                <i class="fa fa-file-pdf text-danger on-hover-opaque"></i>
-                                View
-                                {{--{{ $shipment->labelFile->file_name }}--}}
-                            </a>
-                            <span class="mx-2 text-secondary">|</span>
-                        @endif
-                        <div moe bottom relative class="d-block">
-                            <a start show>Upload</a>
-                            <form url="/api/shipment/setLabelSystemFile">
-                                <input type="hidden" name="uid" value="{{ $shipment->uid }}">
-                                <div class="mb-2">
-                                    <label class="text-secondary mb-1 text-sm">Label File</label>
-                                    <input type="file" class="form-control form-control-sm"
-                                           name="labelSystemFile">
-                                </div>
-                                <div class="d-flex align-items-center">
-                                    <button class="btn btn-sm btn-primary mr-2" submit>Upload</button>
-                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-                    </div>
-
-                    <div class="mb-2 d-flex align-items-baseline">
-                        <label class="text-secondary mb-0 width-90px mr-2">Tracking #</label>
-                        <div moe bottom relative class="d-block">
-                            <a start show>{{$shipment->tracking_number ? $shipment->tracking_number : '(not set)'}}</a>
-                            <form url="/api/shipment/setTrackingNumber">
-                                <input type="hidden" name="uid" value="{{ $shipment->uid }}">
-                                <div class="mb-2">
-                                    <label class="text-secondary mb-1 text-sm">Tracking #</label>
-                                    <input type="text" class="form-control form-control-sm"
-                                           name="trackingNumber" value="{{$shipment->tracking_number}}">
-                                </div>
-                                <div class="d-flex align-items-center">
-                                    <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                    <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                </div>
-                            </form>
-                        </div>
-                    </div>
-
-                    <div class="mb-2 d-flex align-items-baseline">
-                        <label class="text-secondary mb-0 width-90px mr-2">Status</label>
-                        <span>{{cleanStatus($shipment->status)}}</span>
-                    </div>
-
-                    @if($shipment->status === 'DELIVERED')
-                        <div class="mb-2 d-flex align-items-baseline">
-                            <label class="text-secondary mb-0 width-90px mr-2">Delivered Date</label>
-                            <div moe bottom relative class="d-block">
-                                <a start
-                                   show>{{$shipment->delivered_date ? friendlier_date($shipment->delivered_date) : '(not set)'}}</a>
-                                <form url="/api/shipment/setDeliveredDate">
-                                    <input type="hidden" name="uid" value="{{ $shipment->uid }}">
-                                    <div class="mb-2">
-                                        <label class="text-secondary mb-1 text-sm">Delivered Date</label>
-                                        <input type="date" class="form-control form-control-sm"
-                                               name="deliveredDate" value="{{$shipment->delivered_date}}">
-                                    </div>
-                                    <div class="d-flex align-items-center">
-                                        <button class="btn btn-sm btn-primary mr-2" submit>Save</button>
-                                        <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
-                                    </div>
-                                </form>
-                            </div>
-                        </div>
-                    @endif
-
-                </div>
+                @include('app.patient.partials.packs')
 
             </div>
         </div>

+ 49 - 0
resources/views/app/practice-management/supply-orders-cancelled-but-unacknowledged.blade.php

@@ -0,0 +1,49 @@
+@extends ('layouts/template')
+
+@section('content')
+
+    <div id="practice-supply-orders" class="p-3 mcp-theme-1">
+        <div class="card">
+
+            <div class="card-header px-3 py-3 d-flex align-items-center bg-white">
+                <strong class="font-size-14">
+                    Supply Orders - Cancelled but unacknowledged
+                </strong>
+            </div>
+            <div class="card-body p-0">
+                <table class="table table-sm table-condensed p-0 m-0" style="table-layout: fixed">
+                    <thead class="bg-light">
+                    <tr>
+                        <th class="border-0">Patient</th>
+                        <th class="border-0">Address</th>
+                        <th class="border-0">Item(s)</th>
+                        <th class="border-0">Shipment</th>
+                    </tr>
+                    </thead>
+                    <tbody>
+                    @foreach ($supplyOrders as $supplyOrder)
+                        <tr data-client-uid="{{$supplyOrder->client->uid}}">
+                            <td class="align-top border-top">
+                                <a href="{{route('patients.view.supply-orders',['patient'=>$supplyOrder->client, 'supplyOrder'=>$supplyOrder, 'filter' => 'all'])}}"> {{$supplyOrder->client->displayName()}}</a>
+                            </td>
+                            <td class="align-top border-top">
+                                {!! $supplyOrder->mailing_address_full ? implode(" ", [$supplyOrder->mailing_address_line1 . ' ' . $supplyOrder->mailing_address_line2, $supplyOrder->mailing_address_city . ' ' . $supplyOrder->mailing_address_state . ' ' . $supplyOrder->mailing_address_zip]) : '-'  !!}
+                            </td>
+                            <td class="align-top border-top">
+                                {{$supplyOrder->product->title}}
+                            </td>
+                            <td class="align-top border-top">
+                                <b>CANCELLED</b>
+                            </td>
+                        </tr>
+                    @endforeach
+                    </tbody>
+                </table>
+                <div>
+                    {{$supplyOrders->links()}}
+                </div>
+            </div>
+        </div>
+    </div>
+
+@endsection

+ 10 - 1
resources/views/app/practice-management/treatment-services-util.blade.php

@@ -34,7 +34,16 @@
                                 {{ $dowMap[date('w', strtotime($x->effective_date))] }}
                             </td>
                             <td>{{$x->total_hrs}}</td>
-                            <td>{{$x->total_bills}}</td>
+                            <td>
+                                <span class="d-inline-block width-50px">{{$x->total_bills}}</span>
+                                <a native target="_blank"
+                                   class="text-sm"
+                                   title="Billing Manager - Notes on {{friendlier_date($x->effective_date)}}"
+                                   href="/practice-management/billing-manager?date={{$x->effective_date}}">
+                                    <i class="fa fa-external-link-alt"></i>
+                                    &nbsp;View
+                                </a>
+                            </td>
                             <td>{{$x->total_pros}}</td>
                         </tr>
                     @endforeach

+ 46 - 3
resources/views/layouts/patient.blade.php

@@ -231,7 +231,7 @@
                         </div>
                     </div>
                 @endif
-                <div class="card mt-3">
+                <div class="card mt-3" id="patient-header">
                     <div class="card-header py-1 hide-inside-ticket-popup">
                         <?php
                         $thumbnail = $patient->profile_picture_base64;
@@ -667,8 +667,7 @@
                                                 <input type="hidden" name="effectiveTime" value="{{date("h:i")}}">
                                                 <input type="hidden" name="title" id="note-create-title" value="">
                                                 <div class="form-group mb-2">
-                                                    <label for="" class="text-secondary text-sm mb-1">Note Template
-                                                        *</label>
+                                                    <label for="" class="text-secondary text-sm mb-1">Note Template *</label>
                                                     <select name="noteTemplateUid" class="form-control form-control-sm"
                                                             onchange="$('#note-create-title').val($(this).find('option:selected').text())"
                                                             required>
@@ -679,6 +678,24 @@
                                                         @endforeach
                                                     </select>
                                                 </div>
+                                                <div class="mb-2">
+                                                    <label for="" class="text-secondary text-sm mb-1">Method *</label>
+                                                    <select name="method" class="form-control form-control-sm note-method-select" required>
+                                                        <option value="AUDIO">Audio</option>
+                                                        <option value="VIDEO">Video</option>
+                                                        <option value="IN_CLINIC">In-Clinic</option>
+                                                        <option value="HOUSE_CALL">House Call</option>
+                                                    </select>
+                                                </div>
+                                                <div class="form-group if-in-clinic">
+                                                    <label for="" class="text-secondary text-sm mb-1">Location</label>
+                                                    <select name="hcpCompanyLocationUid" class="form-control">
+                                                        <option value="-- select --"></option>
+                                                        @foreach($pro->companyLocations() as $location)
+                                                            <option value="{{$location->uid}}">{{$location->line1}} {{$location->city}}</option>
+                                                        @endforeach
+                                                    </select>
+                                                </div>
                                                 <div class="form-group m-0">
                                                     <button submit class="btn btn-primary btn-sm">submit</button>
                                                 </div>
@@ -906,4 +923,30 @@
             </main>
         </div>
     </div>
+    <script>
+        (function() {
+            function init() {
+                $('.note-method-select').change(function() {
+                    let form = $(this).closest('form');
+                    if(this.value === 'IN_CLINIC') {
+                        form.find('.if-in-clinic').show();
+                    }
+                    else {
+                        form.find('.if-in-clinic').hide();
+                    }
+                });
+
+                $('.note-method-select').each(function() {
+                    let form = $(this).closest('form');
+                    if(this.value === 'IN_CLINIC') {
+                        form.find('.if-in-clinic').show();
+                    }
+                    else {
+                        form.find('.if-in-clinic').hide();
+                    }
+                });
+            }
+            addMCInitializer('patient-add-note-popup', init, '#patient-header')
+        }).call(window);
+    </script>
 @endsection

+ 17 - 11
resources/views/layouts/template.blade.php

@@ -142,7 +142,7 @@
             <a href="#" class="mr-2 text-white small" onclick="return fastReload()"><i class="fa fa-sync"></i></a>
             <div class="d-inline-flex pr-2 mcp-theme-1 position-relative">
                 <input id="patient-search" type="search" class="form-control form-control-sm outline-0" autocomplete="off" placeholder="Search Patients">
-                <div class="suggestions-outer position-absolute d-none">
+                <div class="patient-search-results suggestions-outer position-absolute d-none">
 
                 </div>
             </div>
@@ -240,26 +240,27 @@
                 var term = $.trim($('#patient-search').val());
                 if (!!term && lastTerm !== term) {
                     $.get('/patients-suggest?term=' + term, function(_data) {
-                        $('.suggestions-outer').html(_data).removeClass('d-none');
+                        $('.patient-search-results.suggestions-outer').html(_data).removeClass('d-none');
                     });
                     lastTerm = term;
                 } else {
-                    $('.suggestions-outer').addClass('d-none');
+                    $('.patient-search-results.suggestions-outer').addClass('d-none');
                 }
             }, 250);
             $('#patient-search')
+                .off('keydown')
                 .on('keydown', function(e) {
-                    var activeItem = $('.suggestions-outer .suggest-item.active');
+                    var activeItem = $('.patient-search-results.suggestions-outer .suggest-item.active');
                     switch (e.which) {
                         case 27:
-                            $('.suggestions-outer').addClass('d-none');
+                            $('.patient-search-results.suggestions-outer').addClass('d-none');
                             return false;
                         case 38:
                             if (activeItem.prev().length) {
                                 activeItem.prev()
                                     .addClass('active')
                                     .siblings().removeClass('active');
-                                activeItem = $('.suggestions-outer .suggest-item.active');
+                                activeItem = $('.patient-search-results.suggestions-outer .suggest-item.active');
                                 if (activeItem.length) {
                                     activeItem[0].scrollIntoView();
                                 }
@@ -270,7 +271,7 @@
                                 activeItem.next()
                                     .addClass('active')
                                     .siblings().removeClass('active');
-                                activeItem = $('.suggestions-outer .suggest-item.active');
+                                activeItem = $('.patient-search-results.suggestions-outer .suggest-item.active');
                                 if (activeItem.length) {
                                     activeItem[0].scrollIntoView();
                                 }
@@ -288,21 +289,26 @@
                 })
                 .on('keypress paste', function(e) {
                     window.setTimeout(onQueryChange, 50);
+                })
+                .on('blur', function(e) {
+                    $('.patient-search-results.suggestions-outer').addClass('d-none');
+                    return false;
                 });
+
             function onQueryChange() {
                 var term = $.trim($('#patient-search').val());
                 if (!!term) {
-                    $('.suggestions-outer')
+                    $('.patient-search-results.suggestions-outer')
                         .html('<span class="d-block no-suggest-items">Searching...</span>')
                         .removeClass('d-none');
                     returnedFunction();
                 } else {
-                    $('.suggestions-outer').addClass('d-none');
+                    $('.patient-search-results.suggestions-outer').addClass('d-none');
                 }
             }
-            $(document).on('click', '.suggest-item.patient-suggest[data-target-uid]', function() {
+            $(document).on('mousedown', '.suggest-item.patient-suggest[data-target-uid]', function() {
                 $('#patient-search').val('');
-                $('.suggestions-outer').addClass('d-none');
+                $('.patient-search-results.suggestions-outer').addClass('d-none');
                 fastLoad('/patients/view/' + $(this).attr('data-target-uid'), true, false, false);
                 return false;
             });

+ 6 - 0
routes/web.php

@@ -60,6 +60,7 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('/blank', 'HomeController@blank')->name('blank');
 
     Route::get('/', 'HomeController@dashboard')->name('dashboard');
+    Route::get('/pro-dashboard-measurements-tab/{page?}', 'HomeController@dashboardMeasurementsTab')->name('dashboard-measurements-tab');
 
     Route::get('/new-patient', 'HomeController@newPatient')->name('new-patient');
     Route::get('/new-non-mcn-patient', 'HomeController@newNonMcnPatient')->name('new-non-mcn-patient');
@@ -132,6 +133,8 @@ Route::middleware('pro.auth')->group(function () {
             Route::get('packs-multi-print', 'PracticeManagementController@packsMultiPrint')->name('packs-multi-print');
             Route::get('packs-multi-pdf/{ids?}', 'PracticeManagementController@packsMultiPDF')->name('packs-multi-pdf');
         });
+
+        Route::get('supply-orders/cancelled-but-unacknowledged', 'PracticeManagementController@supplyOrdersCancelledButUnacknowledged')->name('supply-orders-cancelled-but-unacknowledged');
     });
 
     Route::middleware('pro.auth.admin')->group(function(){
@@ -218,6 +221,9 @@ Route::middleware('pro.auth')->group(function () {
 
     });
 
+    //mb claim single view
+    Route::get('mb-claims/view/{mbClaim}', 'PatientController@mbClaim')->name('mb-claim');
+
     // pro dashboard events (ajax)
     Route::get('pro-dashboard-events/{from}/{to}', 'HomeController@dashboardAppointments')->name('pro-dashboard-events');