Jelajahi Sumber

Merge branch 'dev' into dev-vj

Vijayakrishnan 3 tahun lalu
induk
melakukan
45c87909cb
30 mengubah file dengan 1216 tambahan dan 347 penghapusan
  1. 0 41
      app/Http/Controllers/AdminController.php
  2. 391 7
      app/Http/Controllers/HomeController.php
  3. 153 154
      resources/views/app/dashboard-admin.blade.php
  4. 533 0
      resources/views/app/dashboard-hcp.blade.php
  5. 2 2
      resources/views/app/dna/dashboard/reports_pending_ack.blade.php
  6. 1 1
      resources/views/app/dna/dashboard/supply_orders_pending_my_ack.blade.php
  7. 1 14
      resources/views/app/dna/patients-table.blade.php
  8. 1 1
      resources/views/app/generic-bills/add-bill-form/Note.blade.php
  9. 1 1
      resources/views/app/generic-bills/add-bill-form/default.blade.php
  10. 1 1
      resources/views/app/generic-bills/create_generic-bill.blade.php
  11. 2 2
      resources/views/app/generic-bills/inline.blade.php
  12. 2 2
      resources/views/app/generic-bills/modal.blade.php
  13. 1 1
      resources/views/app/log-in-as.blade.php
  14. 1 1
      resources/views/app/mcp/dashboard/calls_memos.blade.php
  15. 2 15
      resources/views/app/mcp/new_patients_awaiting_visit.blade.php
  16. 3 16
      resources/views/app/mcp/patients-table.blade.php
  17. 4 2
      resources/views/app/new-patient.blade.php
  18. 2 0
      resources/views/app/patient/coverage_column_renderer.blade.php
  19. 2 2
      resources/views/app/patient/primary-coverage.blade.php
  20. 2 2
      resources/views/app/patient/tickets/erx.blade.php
  21. 2 2
      resources/views/app/patient/tickets/imaging.blade.php
  22. 2 2
      resources/views/app/patient/tickets/lab.blade.php
  23. 2 2
      resources/views/app/patient/tickets/other.blade.php
  24. 1 15
      resources/views/app/patients.blade.php
  25. 1 1
      resources/views/app/practice-management/bills-under-processing.blade.php
  26. 39 35
      resources/views/app/practice-management/pro-availability.blade.php
  27. 1 1
      resources/views/app/practice-management/processing-bill-matrix.blade.php
  28. 1 1
      resources/views/layouts/patient.blade.php
  29. 19 23
      resources/views/layouts/template.blade.php
  30. 43 0
      routes/web.php

+ 0 - 41
app/Http/Controllers/AdminController.php

@@ -86,47 +86,6 @@ class AdminController extends Controller
         return view('app.mcp.patients', compact('patients', 'filters'));
     }
 
-    private function filterSimpleQuery(Request $request, $query, $columnName, $valueName) {
-        if($request->input($valueName)) {
-            $query->where($columnName, $request->input($valueName));
-        }
-    }
-    private function filterMultiQuery(Request $request, $query, $columnName, $keyName, $valueName1, $valueName2) {
-        switch($request->input($keyName)) {
-            case 'EXACTLY':
-                if($request->input($valueName1)) {
-                    $query->where($columnName, $request->input($valueName1));
-                }
-                break;
-            case 'LESS_THAN':
-                if($request->input($valueName1)) {
-                    $query->where($columnName, '<', $request->input($valueName1));
-                }
-                break;
-            case 'GREATER_THAN':
-                if($request->input($valueName1)) {
-                    $query->where($columnName, '>', $request->input($valueName1));
-                }
-                break;
-            case 'BETWEEN':
-                if($request->input($valueName1) && $request->input($valueName2)) {
-                    $query
-                        ->where($columnName, '>=', $request->input($valueName1))
-                        ->where($columnName, '<=', $request->input($valueName2));
-                }
-                break;
-            case 'NOT_BETWEEN':
-                if($request->input($valueName1) && $request->input($valueName2)) {
-                    $query
-                        ->where(function ($q) use ($request, $columnName, $valueName1, $valueName2) {
-                            $q->where($columnName, '<', $request->input($valueName1))
-                                ->orWhere($columnName, '>', $request->input($valueName2));
-                        });
-                }
-                break;
-        }
-    }
-
     public function notes(Request $request)
     {
         $notes = Note::paginate(5);

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

@@ -189,7 +189,7 @@ class HomeController extends Controller
         }
     }
 
-    private function dashboard_MCP(Request $request){
+    public function dashboard_MCP(Request $request){
 
 
         $keyNumbers = [];
@@ -571,7 +571,388 @@ WHERE cl.shadow_pro_id IS NULL
             'mcpClientMemos', 'mcpClientMemosCount', 'naClientMemos', 'incomingSmsMessagesPendingReply'));
     }
 
-    private function dashboard_DNA(Request $request){
+    public function dashboard_HCP(Request $request){
+        //TODO provide hcp specific data. Currently is based on MCP context
+        $keyNumbers = [];
+
+        // Patients // SELECT * FROM client WHERE mcp_pro_id = :me.id;
+        // New Patients Awaiting Visit // SELECT * FROM client WHERE mcp_pro_id = :me.id AND hasMcpDoneOnboardingVisit != 'YES';
+        // Notes Pending Signature // SELECT * FROM note WHERE hcp_pro_id = :me.id AND is_cancelled IS NOT TRUE AND has_hcp_signed IS NOT TRUE;
+        // Notes Pending Billing // SELECT * FROM note WHERE hcp_pro_id = :me.id AND is_cancelled IS NOT TRUE AND has_hcp_signed IS TRUE AND is_billing_marked_done IS FALSE;
+        // Reports Pending Signature // SELECT * FROM incoming_report WHERE hcp_pro_id = :me.id AND isEntryError IS NOT TRUE AND hasHcpProSigned IS NOT TRUE;
+        // Patients w/o Appointments // SELECT * FROM client WHERE mcp_pro_id = :me.id AND client.next_mcp_appointment_date < today();
+        // Patients Overdue for Visit // SELECT * FROM client WHERE mcp_pro_id = :me.id AND client.next_expected_mcp_visit_date < today();
+        // Cancelled Appts. Pending Review // SELECT * FROM appointment WHERE hcp_pro_id = :me.id AND status = 'REJECTED' AND wasAcknowledgedByAppointmentPro IS NOT TRUE;
+        // Cancelled Bills Pending Review // SELECT * FROM bill WHERE bill_service_type = 'NOTE' AND is_cancelled IS TRUE AND isCancellationAcknowledged IS FALSE;
+        // Cancelled Supply Orders Pending Review // SELECT * FROM supply_order WHERE signed_by_pro_id = :me.id AND is_cancelled IS TRUE AND isCancellationAcknowledged IS NOT TRUE;
+        // ERx & Orders Pending Signature // SELECT * FROM erx WHERE hcp_pro_id = :me.id AND pro_declared_status <> 'CANCELLED' AND hasHcpProSigned IS NOT TRUE;
+        // Supply Orders Pending Signature // SELECT supply_order.id FROM supply_order WHERE signed_by_pro_id IS NOT TRUE AND is_cancelled IS NOT TRUE AND created_by_pro_id = :me.id;
+
+        $performer = $this->performer();
+        $pro = $performer->pro;
+        $performerProID = $performer->pro->id;
+
+        $keyNumbers  = [];
+
+        $queryClients = $this->performer()->pro->getAccessibleClientsQuery();
+
+        $pendingNotesToSign = Note
+            ::where(function ($query) use ($performerProID) {
+                $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false)->where('is_core_note', false);
+            })
+            ->orWhere(function ($query) use ($performerProID) {
+                $query->where('ally_pro_id', $performerProID)->where('is_signed_by_ally', false)->where('is_cancelled', false)->where('is_core_note', false);
+            })
+            ->count();
+        $keyNumbers['pendingNotesToSign'] = $pendingNotesToSign;
+
+        // notes pending mcp sign (applicable to dnas only)
+        $pendingNotesToSignMCP = Note
+            ::where(function ($query) use ($performerProID) {
+                $query->where('ally_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_cancelled', false)->where('is_core_note', false);
+            })
+            ->count();
+        $keyNumbers['$pendingNotesToSignMCP'] = $pendingNotesToSignMCP;
+
+        $pendingNotesToSignAllySigned = Note::where(function ($query) use ($performerProID) {
+            $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false)->where('is_signed_by_ally', true)->where('is_cancelled', false)->where('is_core_note', false);;
+        })->count();
+        $keyNumbers['pendingNotesToSignAllySigned'] = $pendingNotesToSignAllySigned;
+
+
+        $signedNotesWithoutBills = Note::where(function ($query) use ($performerProID) {
+            $query->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', true)->where('is_cancelled', false);
+        })->whereDoesntHave('bills')->count();
+
+        $keyNumbers['signedNotesWithoutBills'] = $signedNotesWithoutBills;
+
+        // open tickets
+        $keyNumbers['numOpenTickets'] = Ticket::where('is_open', true)
+            ->where(function ($q) use ($performerProID) {
+                $q->where('assigned_pro_id', $performerProID)
+                    ->orWhere('manager_pro_id', $performerProID)
+                    ->orWhere('ordering_pro_id', $performerProID)
+                    ->orWhere('initiating_pro_id', $performerProID);
+            })
+            ->count();
+
+        // unacknowledged cancelled bills for authed pro
+        $keyNumbers['unacknowledgedCancelledBills'] = Bill::where('hcp_pro_id', $performerProID)
+            ->where('is_cancelled', true)
+            ->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();
+
+        // unsigned supply orders created by authed pro
+        $keyNumbers['unsignedSupplyOrders'] = SupplyOrder
+            ::where('is_cancelled', false)
+            ->where('is_signed_by_pro', false)
+            ->whereRaw('created_by_session_id IN (SELECT id FROM app_session WHERE pro_id = ?)', [$performerProID])
+            ->count();
+
+        // patientsHavingBirthdayToday
+        $queryClients = $this->performer()->pro->getAccessibleClientsQuery();
+        $keyNumbers['patientsHavingBirthdayToday'] = $queryClients
+            ->whereRaw('EXTRACT(DAY from dob) = ?', [date('d')])
+            ->whereRaw('EXTRACT(MONTH from dob) = ?', [date('m')])
+            ->count();
+
+        $reimbursement = [];
+        $reimbursement["currentBalance"] =  $performer->pro->balance;
+        $reimbursement["nextPaymentDate"] = '--';
+        $lastPayment = ProTransaction::where('pro_id', $performerProID)->where('plus_or_minus', 'PLUS')->orderBy('created_at', 'DESC')->first();
+        if ($lastPayment) {
+            $reimbursement["lastPayment"] =  $lastPayment->amount;
+            $reimbursement["lastPaymentDate"] = $lastPayment->created_at;
+        } else {
+            $reimbursement["lastPayment"] = '--';
+            $reimbursement["lastPaymentDate"] = '--';
+        }
+
+        //if today is < 15th, next payment is 15th, else nextPayment is
+        $today = strtotime(date('Y-m-d'));
+        $todayDate = date('j', $today);
+
+        $todayMonth =  date('m', $today);
+        $todayYear = date('Y', $today);
+        if ($todayDate < 15) {
+            $nextPaymentDate = new DateTime();
+            $nextPaymentDate->setDate($todayYear, $todayMonth, 15);
+            $reimbursement['nextPaymentDate'] = $nextPaymentDate->format('m/d/Y');
+        } else {
+            $nextPaymentDate = new \DateTime();
+            $lastDayOfMonth = date('t', $today);
+            $nextPaymentDate->setDate($todayYear, $todayMonth, $lastDayOfMonth);
+            $reimbursement['nextPaymentDate'] = $nextPaymentDate->format('m/d/Y');
+        }
+
+        //expectedPay
+        $expectedForHcp = DB::select(DB::raw("SELECT coalesce(SUM(hcp_expected_payment_amount),0) as expected_pay FROM bill WHERE hcp_pro_id = :performerProID  AND has_hcp_been_paid = false AND is_signed_by_hcp IS TRUE AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
+        $expectedForCm = DB::select(DB::raw("SELECT coalesce(SUM(cm_expected_payment_amount),0) as expected_pay  FROM bill WHERE cm_pro_id = :performerProID  AND has_cm_been_paid = false AND is_signed_by_cm IS TRUE AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
+        $expectedForRme = DB::select(DB::raw("SELECT coalesce(SUM(rme_expected_payment_amount),0) as expected_pay  FROM bill WHERE rme_pro_id = :performerProID  AND has_rme_been_paid = false AND is_signed_by_rme IS TRUE AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
+        $expectedForRmm = DB::select(DB::raw("SELECT coalesce(SUM(rmm_expected_payment_amount),0) as expected_pay  FROM bill WHERE rmm_pro_id = :performerProID  AND has_rmm_been_paid = false AND is_signed_by_rmm IS TRUE AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
+        $expectedForNa = DB::select(DB::raw("SELECT coalesce(SUM(generic_pro_expected_payment_amount),0) as expected_pay  FROM bill WHERE generic_pro_id = :performerProID  AND has_generic_pro_been_paid = false AND is_signed_by_generic_pro IS TRUE AND is_cancelled = false"), ['performerProID' => $performerProID])[0]->expected_pay;
+
+        $totalExpectedAmount =  $expectedForHcp + $expectedForCm + $expectedForRme + $expectedForRmm + $expectedForNa;
+        $reimbursement['nextPaymentAmount'] =  $totalExpectedAmount;
+
+        $milliseconds = strtotime(date('Y-m-d')) . '000';
+
+        // bills & claims
+        $businessNumbers = [];
+
+        // Notes with bills to resolve
+        $businessNumbers['notesWithBillsToResolve'] = Note::where('is_cancelled', '!=', true)
+            ->where('is_bill_closed', '!=', true)
+            ->whereRaw('(SELECT count(id) FROM bill WHERE note_id = note.id AND is_cancelled = false AND is_verified = false) > 0')
+            ->count();
+
+        // Notes pending bill closure
+        $businessNumbers['notesPendingBillingClosure'] = Note::where('is_cancelled', '!=', true)
+            ->where('is_bill_closed', '!=', true)
+            ->whereRaw('(SELECT count(id) FROM bill WHERE note_id = note.id AND (is_cancelled = true OR is_verified = true)) = 0')
+            ->count();
+
+        // incoming reports not signed
+        $incomingReports = IncomingReport::where('hcp_pro_id', $performerProID)
+            ->where('has_hcp_pro_signed', false)
+            ->where('is_entry_error', false)
+            ->orderBy('created_at', 'ASC')
+            ->get();
+        // erx, labs & imaging that are not closed
+        $tickets = Ticket::where('ordering_pro_id', $performerProID)
+            ->where('is_entry_error', false)
+            ->where('is_open', true)
+            ->orderBy('created_at', 'ASC')
+            ->get();
+        $supplyOrders = SupplyOrder::where('is_cleared_for_shipment', false)
+            ->where('is_cancelled', false)
+            ->whereRaw('created_by_session_id IN (SELECT id FROM app_session where pro_id = ?)', [$performer->pro->id])
+            ->orderBy('created_at', 'ASC')
+            ->get();
+
+        $numERx = Ticket::where('ordering_pro_id', $performerProID)
+            ->where('category', 'erx')
+            ->where('is_entry_error', false)
+            ->where('is_open', true)
+            ->count();
+        $numLabs = Ticket::where('ordering_pro_id', $performerProID)
+            ->where('category', 'lab')
+            ->where('is_entry_error', false)
+            ->where('is_open', true)
+            ->count();
+        $numImaging = Ticket::where('ordering_pro_id', $performerProID)
+            ->where('category', 'imaging')
+            ->where('is_entry_error', false)
+            ->where('is_open', true)
+            ->count();
+        $numSupplyOrders = SupplyOrder::where('is_cleared_for_shipment', false)
+            ->where('is_cancelled', false)
+            ->whereRaw('created_by_session_id IN (SELECT id FROM app_session where pro_id = ?)', [$performer->pro->id])
+            ->count();
+
+        $newMCPAssociations = ClientProChange
+            ::where('new_pro_id', $performerProID)
+            ->where('responsibility_type', 'MCP')
+            ->whereNull('current_client_pro_change_decision_id')
+            ->get();
+
+        $newNAAssociations = ClientProChange
+            ::where('new_pro_id', $performerProID)
+            ->where('responsibility_type', 'DEFAULT_NA')
+            ->whereNull('current_client_pro_change_decision_id')
+            ->get();
+
+        // unstamped client memos
+        // for mcp
+        $mcpClientMemos = DB::select(
+            DB::raw("
+SELECT c.uid as client_uid, c.name_first, c.name_last,
+       cm.uid, cm.content, cm.created_at
+FROM client c join client_memo cm on c.id = cm.client_id
+WHERE
+      c.mcp_pro_id = {$performerProID} AND
+      cm.mcp_stamp_id IS NULL
+      AND (is_admin_only IS FALSE OR is_admin_only IS NULL)
+ORDER BY cm.created_at DESC
+OFFSET 0 LIMIT 10
+            ")
+        );
+        $mcpClientMemosCount = DB::select(
+            DB::raw("
+SELECT count(c.uid)
+FROM client c join client_memo cm on c.id = cm.client_id
+WHERE
+      c.mcp_pro_id = {$performerProID} AND
+      cm.mcp_stamp_id IS NULL
+      AND (is_admin_only IS FALSE OR is_admin_only IS NULL)
+            ")
+        );
+        if($mcpClientMemosCount && count($mcpClientMemosCount)) {
+            $mcpClientMemosCount = $mcpClientMemosCount[0]->count;
+        }
+
+        // for na
+        $naClientMemos = DB::select(
+            DB::raw("
+SELECT c.uid as client_uid, c.name_first, c.name_last,
+       cm.uid, cm.content, cm.created_at
+FROM client c join client_memo cm on c.id = cm.client_id
+WHERE
+      c.default_na_pro_id = {$performerProID} AND
+      cm.default_na_stamp_id IS NULL
+ORDER BY cm.created_at DESC
+            ")
+        );
+
+        $keyNumbers['rmBillsToSign'] = Bill
+            ::where('is_cancelled', false)
+            ->where('cm_or_rm', 'RM')
+            ->where(function ($q) use ($performerProID) {
+                $q
+                    ->where(function ($q2) use ($performerProID) {
+                        $q2->where('hcp_pro_id', $performerProID)->where('is_signed_by_hcp', false);
+                    })
+                    ->orWhere(function ($q2) use ($performerProID) {
+                        $q2->where('rme_pro_id', $performerProID)->where('is_signed_by_rme', false);
+                    })
+                    ->orWhere(function ($q2) use ($performerProID) {
+                        $q2->where('rmm_pro_id', $performerProID)->where('is_signed_by_rmm', false);
+                    })
+                    ->orWhere(function ($q2) use ($performerProID) {
+                        $q2->where('generic_pro_id', $performerProID)->where('is_signed_by_generic_pro', false);
+                    });
+            })
+            ->count();
+
+        $count = DB::select(
+            DB::raw(
+                "
+SELECT count(client.id) as cnt FROM client join care_month on care_month.client_id = client.id
+WHERE ((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.default_na_pro_id = {$performer->pro->id}))
+  AND EXTRACT(MONTH from care_month.start_date) = EXTRACT(MONTH from now())
+  AND EXTRACT(YEAR from care_month.start_date) = EXTRACT(YEAR from now())
+  AND (care_month.number_of_days_with_remote_measurements < 16 OR care_month.number_of_days_with_remote_measurements IS NULL)
+"
+            )
+        );
+        $keyNumbers['rmPatientsWithLT16MD'] = $count[0]->cnt;
+
+        $count = DB::select(
+            DB::raw(
+                "
+SELECT count(client.id) as cnt FROM client join care_month on care_month.client_id = client.id
+WHERE ((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.default_na_pro_id = {$performer->pro->id}))
+  AND EXTRACT(MONTH from care_month.start_date) = EXTRACT(MONTH from now())
+  AND EXTRACT(YEAR from care_month.start_date) = EXTRACT(YEAR from now())
+  AND (care_month.number_of_days_with_remote_measurements >= 16 AND care_month.number_of_days_with_remote_measurements IS NOT NULL)
+"
+            )
+        );
+        $keyNumbers['rmPatientsWithGTE16MD'] = $count[0]->cnt;
+
+        $count = DB::select(
+            DB::raw(
+                "
+SELECT count(client.id) as cnt FROM client join care_month on care_month.client_id = client.id
+WHERE ((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.default_na_pro_id = {$performer->pro->id}))
+  AND EXTRACT(MONTH from care_month.start_date) = EXTRACT(MONTH from now())
+  AND EXTRACT(YEAR from care_month.start_date) = EXTRACT(YEAR from now())
+  AND (care_month.has_anyone_interacted_with_client_about_rm_outside_note = TRUE AND care_month.has_anyone_interacted_with_client_about_rm_outside_note IS NOT NULL)
+"
+            )
+        );
+        $keyNumbers['rmPatientsWithWhomCommDone'] = $count[0]->cnt;
+
+        $count = DB::select(
+            DB::raw(
+                "
+SELECT count(client.id) as cnt FROM client join care_month on care_month.client_id = client.id
+WHERE ((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.default_na_pro_id = {$performer->pro->id}))
+  AND EXTRACT(MONTH from care_month.start_date) = EXTRACT(MONTH from now())
+  AND EXTRACT(YEAR from care_month.start_date) = EXTRACT(YEAR from now())
+  AND (care_month.has_anyone_interacted_with_client_about_rm_outside_note = FALSE OR care_month.has_anyone_interacted_with_client_about_rm_outside_note IS NULL)
+"
+            )
+        );
+        $keyNumbers['rmPatientsWithWhomCommNotDone'] = $count[0]->cnt;
+
+        // num measurements that need stamping
+        $keyNumbers['measurementsToBeStamped'] = $this->performer()->pro->getUnstampedMeasurementsFromCurrentMonth(true, null, null);
+
+        if($performer->pro->pro_type === 'ADMIN') {
+
+            // patients without coverage information
+            $keyNumbers['patientsWithoutCoverageInformation'] = DB::select(DB::raw("
+SELECT count(DISTINCT (cl.id)) as cnt
+FROM client cl
+WHERE cl.shadow_pro_id IS NULL AND cl.latest_client_primary_coverage_id IS NULL -- no coverage record"
+            ))[0]->cnt;
+
+            // patients pending coverage verification
+            $keyNumbers['patientsPendingCoverageVerification'] = DB::select(DB::raw("
+SELECT count(DISTINCT (cl.id)) as cnt
+FROM client cl
+         LEFT JOIN client_primary_coverage cpc ON cl.latest_client_primary_coverage_id = cpc.id
+WHERE cl.shadow_pro_id IS NULL
+    AND (cl.latest_client_primary_coverage_id IS NOT NULL -- coverage exists, but status is null or unknown
+    AND (
+               (cpc.plan_type = 'MEDICARE' AND (cpc.is_partbprimary = 'UNKNOWN' OR cpc.is_partbprimary IS NULL))
+               OR
+               (cpc.plan_type != 'MEDICARE' AND
+                (cpc.manual_determination_category = 'UNKNOWN' OR cpc.manual_determination_category IS NULL))
+           ))"
+            ))[0]->cnt;
+
+        }
+
+        $incomingSmsMessagesPendingReply = DB::select("
+            SELECT cs.* ,c.uid as client_uid, c.name_first as client_name_first, c.name_last as client_name_last FROM client_sms cs LEFT JOIN client c ON c.id = cs.client_id
+            WHERE cs.is_reply_needed = 'YES' AND c.mcp_pro_id = :mcp_pro_id AND incoming_or_outgoing = 'INCOMING'
+            AND (cs.created_at > c.last_sms_sent_to_client_at OR c.last_sms_sent_to_client_at IS NULL)
+            ORDER BY created_at DESC
+        ", ['mcp_pro_id' => $performer->pro->id]);
+
+        $careMonthsWithMeasurementsPendingStamping = CareMonth::select('id')
+            ->where('mcp_pro_id', $this->performer->pro->id)
+            ->where('rm_num_measurements_not_stamped_by_mcp', '>', 0)
+            ->whereNotNull('rm_num_measurements_not_stamped_by_mcp')
+            ->orderBy('created_at', 'DESC')
+            ->get()
+            ->map(function($_x) {
+                return $_x->id;
+            })
+            ->toArray();
+
+        $measurementsPendingStamping = Measurement::whereIn('care_month_id', $careMonthsWithMeasurementsPendingStamping)
+            ->orderBy('created_at', 'DESC')
+            ->whereNotNull('ts')
+            ->whereNotIn('label', ['SBP', 'DBP'])
+            ->where('is_cellular_zero', '<>', true)
+            ->where('is_active', true)
+            ->where('has_been_stamped_by_mcp', false)
+            ->whereNotNull('client_bdt_measurement_id')
+            ->paginate(15);
+
+        return view('app/dashboard-hcp', compact('keyNumbers', 'reimbursement', 'milliseconds',
+            'businessNumbers',
+            'incomingReports', 'tickets', 'supplyOrders',
+            'numERx', 'numLabs', 'numImaging', 'numSupplyOrders',
+            'newMCPAssociations', 'newNAAssociations',
+            'measurementsPendingStamping', 'careMonthsWithMeasurementsPendingStamping',
+            'mcpClientMemos', 'mcpClientMemosCount', 'naClientMemos', 'incomingSmsMessagesPendingReply'));
+    }
+
+    public function dashboard_DNA(Request $request){
         $performer = $this->performer();
         $pro = $performer->pro;
         $performerProID = $performer->pro->id;
@@ -580,7 +961,7 @@ WHERE cl.shadow_pro_id IS NULL
         return view('app/dashboard-dna', compact( 'milliseconds'));
     }
 
-    private function dashboard_ADMIN(Request $request){
+    public function dashboard_ADMIN(Request $request){
         $keyNumbers = [];
 
         // Patients // SELECT * FROM client WHERE mcp_pro_id = :me.id;
@@ -955,15 +1336,18 @@ WHERE cl.shadow_pro_id IS NULL
         $performer = $this->performer();
         $pro = $performer->pro;
 
-        if($pro->is_enrolled_as_mcp){
-            return $this->dashboard_MCP($request);
-        }elseif($pro->pro_type === 'ADMIN'){
+        if($pro->pro_type === 'ADMIN'){
             return $this->dashboard_ADMIN($request);
+        }elseif($pro->is_enrolled_as_mcp && $pro->is_considered_for_mcp_assignment) {
+            return $this->dashboard_MCP($request);
+        }elseif($pro->is_hcp){
+            return $this->dashboard_HCP($request); //TODO for HCP
         }else{
             return $this->dashboard_DNA($request);
         }
     }
 
+
     public function dashboardMeasurementsTab(Request $request, $page = 1) {
 
         $performer = $this->performer();
@@ -1069,7 +1453,7 @@ WHERE measurement.label NOT IN ('SBP', 'DBP')
             $results = $results->where(function($query) use ($performerProID){
                 return $query->where('appointment.pro_id', $performerProID)
                         ->orWhere('c.default_na_pro_id', $performerProID);
-            });          
+            });
         }
 
         $results = $results->get();

+ 153 - 154
resources/views/app/dashboard-admin.blade.php

@@ -187,160 +187,6 @@
                     @endif
                 </div>
                 <div class="col-md-9">
-
-                    <div class="row">
-                        <div class="col-6">
-
-                        <!-- new associations -->
-                            @if(count($newMCPAssociations))
-                                <div class="mb-3 border rounded px-3 py-2 ack-container">
-                                    <p class="pt-1 mb-2"><b>New Patients</b></p>
-                                    @foreach($newMCPAssociations as $assoc)
-                                        <div class="d-flex align-items-start bg-light mb-2 px-2 py-1">
-                                            <div class="flex-grow-1">
-                                                You are now the MCP for
-                                                <a href="/patients/view/{{$assoc->patient->uid}}"
-                                                   class="">{{$assoc->patient->displayName()}}</a>
-                                                <?php $nextAppt = $assoc->patient->nextAppointment(); ?>
-                                                @if($nextAppt)
-                                                    <div class="font-size-11">
-                                                        <span class="text-secondary font-size-11">Appt.</span>
-                                                        {{$nextAppt->pro->displayName()}}
-                                                        <span class="text-secondary font-size-11">on</span>
-                                                        {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
-                                                    </div>
-                                                    @if($nextAppt->status === 'PENDING') {{-- WIP: ALIX overhaul --}}
-                                                        <div
-                                                            class="text-warning-mellow font-weight-bold font-size-11 mt-1">
-                                                            <i class="fa fa-exclamation-triangle"></i>
-                                                            Confirmation pending
-                                                        </div>
-                                                    @endif
-                                                    @if($nextAppt->status === 'CONFIRMED')
-                                                        <div class="text-success font-weight-bold font-size-11 mt-1">
-                                                            <i class="fa fa-check"></i>
-                                                            Confirmed by the patient
-                                                        </div>
-                                                    @endif
-                                                    @if($nextAppt->status === 'CANCELLED')
-                                                        <div class="text-danger font-weight-bold font-size-11 mt-1">
-                                                            <i class="fa fa-stop"></i>
-                                                            Cancelled
-                                                        </div>
-                                                    @endif
-                                                @endif
-                                            </div>
-                                            <a href="#" class="ack-client-pro-change ml-3" data-uid="{{$assoc->uid}}">Ack.</a>
-                                        </div>
-                                    @endforeach
-                                </div>
-                            @endif
-
-                            @if(count($newNAAssociations))
-                                <div class="mb-3 border rounded px-3 py-2 ack-container">
-                                    <p class="pt-1 mb-2"><b>New Patients</b></p>
-                                    @foreach($newNAAssociations as $assoc)
-                                        <div class="d-flex align-items-start bg-light mb-2 px-2 py-1">
-                                            <div class="flex-grow-1">
-                                                You are now the Care Coordinator for
-                                                <a href="/patients/view/{{$assoc->patient->uid}}"
-                                                   class="">{{$assoc->patient->displayName()}}</a>
-                                                <?php $nextAppt = $assoc->patient->nextAppointment(); ?>
-                                                @if($nextAppt)
-                                                    <div class="font-size-11">
-                                                        <span class="text-secondary font-size-11">Appt.</span>
-                                                        {{$nextAppt->pro->displayName()}}
-                                                        <span class="text-secondary font-size-11">on</span>
-                                                        {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
-                                                    </div>
-                                                    @if($nextAppt->status === 'PENDING') {{-- WIP: ALIX overhaul --}}
-                                                        <div
-                                                            class="text-warning-mellow font-weight-bold font-size-11 mt-1">
-                                                            <i class="fa fa-exclamation-triangle"></i>
-                                                            Confirmation pending
-                                                        </div>
-                                                    @endif
-                                                    @if($nextAppt->status === 'CONFIRMED')
-                                                        <div class="text-success font-weight-bold font-size-11 mt-1">
-                                                            <i class="fa fa-check"></i>
-                                                            Confirmed by the patient
-                                                        </div>
-                                                    @endif
-                                                    @if($nextAppt->status === 'CANCELLED')
-                                                        <div class="text-danger font-weight-bold font-size-11 mt-1">
-                                                            <i class="fa fa-stop"></i>
-                                                            Cancelled
-                                                        </div>
-                                                    @endif
-                                                @endif
-                                            </div>
-                                            <a href="#" class="ack-client-pro-change"
-                                               data-uid="{{$assoc->uid}}">Ack.</a>
-                                        </div>
-                                    @endforeach
-                                </div>
-                            @endif
-                        </div>
-                        <div class="col-6">
-                            @if(count($mcpClientMemos))
-                                <div class="mb-3 border rounded px-3 py-2 ack-container">
-                                    <p class="pt-1 mb-2"><b>New Patients Memos (MCP)</b></p>
-                                    <table class="table table-sm table-hover table-bordered">
-                                        <thead>
-                                        <tr>
-                                            <th>Patient</th>
-                                            <th>Memo</th>
-                                            <th>Created</th>
-                                            <th></th>
-                                        </tr>
-                                        </thead>
-                                        <tbody>
-                                        @foreach($mcpClientMemos as $memo)
-                                            <tr>
-                                                <td class="">
-                                                    <a href="/patients/view/{{$memo->client_uid}}">{{$memo->name_first}} {{$memo->name_last}}</a>
-                                                </td>
-                                                <td>{!! $memo->content !!}</td>
-                                                <td class="text-nowrap">{{friendlier_date_time($memo->created_at)}}</td>
-                                                <td><a href="#" class="ack-client-memo"
-                                                       data-uid="{{$memo->uid}}">Ack.</a></td>
-                                            </tr>
-                                        @endforeach
-                                        </tbody>
-                                    </table>
-                                </div>
-                            @endif
-                            @if(count($naClientMemos))
-                                <div class="mb-3 border rounded px-3 py-2 ack-container">
-                                    <p class="pt-1 mb-2"><b>New Patients Memos (NA)</b></p>
-                                    <table class="table table-sm table-hover table-bordered">
-                                        <thead>
-                                        <tr>
-                                            <th>Patient</th>
-                                            <th>Memo</th>
-                                            <th>Created</th>
-                                            <th></th>
-                                        </tr>
-                                        </thead>
-                                        <tbody>
-                                        @foreach($naClientMemos as $memo)
-                                            <tr>
-                                                <td class="">
-                                                    <a href="/patients/view/{{$memo->client_uid}}">{{$memo->name_first}} {{$memo->name_last}}</a>
-                                                </td>
-                                                <td>{!! $memo->content !!}</td>
-                                                <td class="text-nowrap">{{friendlier_date_time($memo->created_at)}}</td>
-                                                <td><a href="#" class="ack-client-memo"
-                                                       data-uid="{{$memo->uid}}">Ack.</a></td>
-                                            </tr>
-                                        @endforeach
-                                        </tbody>
-                                    </table>
-                                </div>
-                            @endif
-                        </div>
-                    </div>
-
                     <ul class="nav nav-tabs">
                         <li class="nav-item">
                             <a native data-tab="appointments" class="nav-link"
@@ -506,6 +352,159 @@
                             @include('app.dashboard.supply_orders')
                         </div>
                     </div>
+
+                    <div class="row mt-3">
+                        <div class="col-6">
+                        <!-- new associations -->
+                            @if(count($newMCPAssociations))
+                                <div class="mb-3 border rounded px-3 py-2 ack-container">
+                                    <p class="pt-1 mb-2"><b>New Patients</b></p>
+                                    @foreach($newMCPAssociations as $assoc)
+                                        <div class="d-flex align-items-start bg-light mb-2 px-2 py-1">
+                                            <div class="flex-grow-1">
+                                                You are now the MCP for
+                                                <a href="/patients/view/{{$assoc->patient->uid}}"
+                                                   class="">{{$assoc->patient->displayName()}}</a>
+                                                <?php $nextAppt = $assoc->patient->nextAppointment(); ?>
+                                                @if($nextAppt)
+                                                    <div class="font-size-11">
+                                                        <span class="text-secondary font-size-11">Appt.</span>
+                                                        {{$nextAppt->pro->displayName()}}
+                                                        <span class="text-secondary font-size-11">on</span>
+                                                        {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
+                                                    </div>
+                                                    @if($nextAppt->status === 'PENDING') {{-- WIP: ALIX overhaul --}}
+                                                        <div
+                                                            class="text-warning-mellow font-weight-bold font-size-11 mt-1">
+                                                            <i class="fa fa-exclamation-triangle"></i>
+                                                            Confirmation pending
+                                                        </div>
+                                                    @endif
+                                                    @if($nextAppt->status === 'CONFIRMED')
+                                                        <div class="text-success font-weight-bold font-size-11 mt-1">
+                                                            <i class="fa fa-check"></i>
+                                                            Confirmed by the patient
+                                                        </div>
+                                                    @endif
+                                                    @if($nextAppt->status === 'CANCELLED')
+                                                        <div class="text-danger font-weight-bold font-size-11 mt-1">
+                                                            <i class="fa fa-stop"></i>
+                                                            Cancelled
+                                                        </div>
+                                                    @endif
+                                                @endif
+                                            </div>
+                                            <a href="#" class="ack-client-pro-change ml-3" data-uid="{{$assoc->uid}}">Ack.</a>
+                                        </div>
+                                    @endforeach
+                                </div>
+                            @endif
+                            
+                            @if(count($newNAAssociations))
+                                <div class="mb-3 border rounded px-3 py-2 ack-container">
+                                    <p class="pt-1 mb-2"><b>New Patients</b></p>
+                                    @foreach($newNAAssociations as $assoc)
+                                        <div class="d-flex align-items-start bg-light mb-2 px-2 py-1">
+                                            <div class="flex-grow-1">
+                                                You are now the Care Coordinator for
+                                                <a href="/patients/view/{{$assoc->patient->uid}}"
+                                                   class="">{{$assoc->patient->displayName()}}</a>
+                                                <?php $nextAppt = $assoc->patient->nextAppointment(); ?>
+                                                @if($nextAppt)
+                                                    <div class="font-size-11">
+                                                        <span class="text-secondary font-size-11">Appt.</span>
+                                                        {{$nextAppt->pro->displayName()}}
+                                                        <span class="text-secondary font-size-11">on</span>
+                                                        {{friendlier_date_time($nextAppt->raw_date . ' ' . $nextAppt->raw_start_time)}}
+                                                    </div>
+                                                    @if($nextAppt->status === 'PENDING') {{-- WIP: ALIX overhaul --}}
+                                                        <div
+                                                            class="text-warning-mellow font-weight-bold font-size-11 mt-1">
+                                                            <i class="fa fa-exclamation-triangle"></i>
+                                                            Confirmation pending
+                                                        </div>
+                                                    @endif
+                                                    @if($nextAppt->status === 'CONFIRMED')
+                                                        <div class="text-success font-weight-bold font-size-11 mt-1">
+                                                            <i class="fa fa-check"></i>
+                                                            Confirmed by the patient
+                                                        </div>
+                                                    @endif
+                                                    @if($nextAppt->status === 'CANCELLED')
+                                                        <div class="text-danger font-weight-bold font-size-11 mt-1">
+                                                            <i class="fa fa-stop"></i>
+                                                            Cancelled
+                                                        </div>
+                                                    @endif
+                                                @endif
+                                            </div>
+                                            <a href="#" class="ack-client-pro-change"
+                                               data-uid="{{$assoc->uid}}">Ack.</a>
+                                        </div>
+                                    @endforeach
+                                </div>
+                            @endif
+                        </div>
+                        <div class="col-6">
+                            @if(count($mcpClientMemos))
+                                <div class="mb-3 border rounded px-3 py-2 ack-container table-responsive">
+                                    <p class="pt-1 mb-2"><b>New Patients Memos (MCP)</b></p>
+                                    <table class="table table-sm table-hover table-striped table-bordered">
+                                        <thead class="bg-light">
+                                        <tr>
+                                            <th class="border-bottom-0">Patient</th>
+                                            <th class="border-bottom-0">Memo</th>
+                                            <th class="border-bottom-0">Created</th>
+                                            <th class="border-bottom-0"></th>
+                                        </tr>
+                                        </thead>
+                                        <tbody>
+                                        @foreach($mcpClientMemos as $memo)
+                                            <tr>
+                                                <td class="">
+                                                    <a href="/patients/view/{{$memo->client_uid}}">{{$memo->name_first}} {{$memo->name_last}}</a>
+                                                </td>
+                                                <td>{!! $memo->content !!}</td>
+                                                <td class="text-nowrap">{{friendlier_date_time($memo->created_at)}}</td>
+                                                <td><a href="#" class="ack-client-memo"
+                                                       data-uid="{{$memo->uid}}">Ack.</a></td>
+                                            </tr>
+                                        @endforeach
+                                        </tbody>
+                                    </table>
+                                </div>
+                            @endif
+                            @if(count($naClientMemos))
+                                <div class="mb-3 border rounded px-3 py-2 ack-container table-responsive">
+                                    <p class="pt-1 mb-2"><b>New Patients Memos (NA)</b></p>
+                                    <table class="table table-sm table-hover table-striped table-bordered">
+                                        <thead class="bg-light">
+                                        <tr>
+                                            <th class="border-bottom-0">Patient</th>
+                                            <th class="border-bottom-0">Memo</th>
+                                            <th class="border-bottom-0">Created</th>
+                                            <th class="border-bottom-0"></th>
+                                        </tr>
+                                        </thead>
+                                        <tbody>
+                                        @foreach($naClientMemos as $memo)
+                                            <tr>
+                                                <td class="">
+                                                    <a href="/patients/view/{{$memo->client_uid}}">{{$memo->name_first}} {{$memo->name_last}}</a>
+                                                </td>
+                                                <td>{!! $memo->content !!}</td>
+                                                <td class="text-nowrap">{{friendlier_date_time($memo->created_at)}}</td>
+                                                <td><a href="#" class="ack-client-memo"
+                                                       data-uid="{{$memo->uid}}">Ack.</a></td>
+                                            </tr>
+                                        @endforeach
+                                        </tbody>
+                                    </table>
+                                </div>
+                            @endif
+                        </div>
+                    </div>
+
                 </div>
             </div>
         </div>

+ 533 - 0
resources/views/app/dashboard-hcp.blade.php

@@ -0,0 +1,533 @@
+@extends ('layouts.template')
+
+@section('content')
+
+    <style>
+        #dashboard-mcp tr.thin th,
+        #dashboard-mcp tr.thin td,
+        #dashboard-mcp .dashboard-stats-table tr td,
+        #dashboard-mcp .dashboard-stats-table tr th {
+            padding: 0.25em;
+            font-weight: normal;
+        }
+
+        #dashboard-mcp table.appointments tr td {
+            vertical-align: middle;
+        }
+    </style>
+
+    <div id="dashboard-mcp">
+    <div class="p-3">
+        <div class="">
+            <div class="row mcp-theme-1" id="pro-dashboard-container">
+                <div class="col-md-3 mcp-theme-1">
+                    <div class="mb-4">
+                        <div class="pro-dashboard-inline-calendar"></div>
+                    </div>
+                    <div class="card mb-4" stag-collapsible-card="mcp-key-numbers">
+                        <div class="card-header pl-2">
+                            <strong>
+                                Key Numbers
+                            </strong>
+                        </div>
+                        <div class="card-body p-0">
+                            <table class="table table-sm mb-0 dashboard-stats-table">
+                                <tbody>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_patients_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.patients') }}">Patients</a>
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_new_patients_awaiting_visit_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.new_patients_awaiting_visit') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="New Patients Awaiting Visit">
+                                            New Patients Awaiting Visit
+                                        </a>
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_notes_pending_signature_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.notes_pending_signature') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Notes Pending Signature">
+                                            Notes Pending Signature
+                                        </a>
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_notes_pending_billing_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.notes_pending_billing') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Notes Pending Billing">
+                                            Notes Pending Billing
+                                        </a>
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_bills_pending_signature_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.bills_pending_signature') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Bills Pending Signature">
+                                            Bills Pending Signature
+                                        </a>
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_incoming_reports_pending_signature_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.reports_pending_signature') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Reports Pending Signature">
+                                            Reports Pending Signature
+                                        </a>
+                                    </th>
+                                </tr>
+
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_patients_without_appointment_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.patients_without_appointments') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Patients w/o Appointments">
+                                            Patients w/o Appointments
+                                        </a>
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_patients_overdue_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.patients_overdue_for_visit') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Patients Overdue for Visit">
+                                            Patients Overdue for Visit
+                                        </a>
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_cancelled_appointments_pending_acknowledgement_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.cancelled_appointments_pending_review') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Cancelled Appts. Pending Review">
+                                            Cancelled Appts. Pending Review
+                                        </a>
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_cancelled_bills_awaiting_review_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.cancelled_bills_pending_review') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Cancelled Bills Pending Review">
+                                            Cancelled Bills Pending Review
+                                        </a>
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_cancelled_supply_orders_awaiting_review_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.cancelled_supply_orders_pending_review') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Cancelled Supply Orders">
+                                            Cancelled Supply Orders
+                                        </a>
+                                    </th>
+                                </tr>
+
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_erx_and_orders_awaiting_signature_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.erx_and_orders_pending_signature') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="ERx & Orders Pending Signature">
+                                            ERx & Orders Pending Signature
+                                        </a>
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_supply_orders_awaiting_signature_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.supply_orders_pending_signature') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Supply Orders Pending Signature">
+                                            Supply Orders Pending Signature
+                                        </a>
+                                    </th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2 text-center">{{$pro->get_supply_orders_awaiting_shipment_count_as_mcp()}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.supply_orders_awaiting_shipment') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           popup-style="tall"
+                                           title="Supply Orders Awaiting Shipment">
+                                            Supply Orders Awaiting Shipment
+                                        </a>
+                                    </th>
+                                </tr>
+                                </tbody>
+                            </table>
+                        </div>
+                    </div>
+                    <div class="card mb-4" stag-collapsible-card="mcp-rm">
+                        <div class="card-header pl-2">
+                            <strong>
+                                Remote Monitoring: {{friendly_month(date('Y-m-d'))}}
+                            </strong>
+                        </div>
+                        <div class="card-body p-0">
+                            <table class="table mb-0 dashboard-stats-table">
+                                <tbody>
+                                <tr class="thin">
+                                    <th class="px-2 text-center">{{$pro->get_measurements_awaiting_review_count_as_mcp() ?? '-'}}</th>
+                                    <th class="pl-2">
+                                        <a href="{{ route('mcp.measurements_pending_stamping') }}"
+                                           native target="_blank"
+                                           open-in-stag-popup
+                                           update-parent
+                                           popup-style="tall"
+                                           title="Measurements Pending Stamping">
+                                            Measurements Pending Stamping
+                                        </a>
+                                    </th>
+                                </tr>
+                                <tr class="thin">
+                                    <th class="px-2 text-center">{{$pro->get_patients_without_remote_measurement_in_48_hours_count_as_mcp() ?? '-'}}</th>
+                                    <th class="pl-2">Patients w/o Measurement in 48 hrs.</th>
+                                </tr>
+                                </tbody>
+                            </table>
+                        </div>
+                    </div>
+                    <div class="card mb-4" stag-collapsible-card="mcp-practice-management" collapsed>
+                        <div class="card-header pl-2">
+                            <strong>
+                                Practice Management
+                            </strong>
+                        </div>
+                        <div class="card-body p-0">
+                            <table class="table mb-0 dashboard-stats-table">
+                                <tbody>
+                                <tr class="thin">
+                                    <th colspan="2" class="font-weight-normal px-2 pl-2">Billing & Reimbursement</th>
+                                </tr>
+                                <tr class="thin">
+                                    <th class="font-weight-normal px-2 pl-4">{{friendly_date_time($reimbursement['nextPaymentDate'], false)}}</th>
+                                    <th class="font-weight-normal pl-2">Next Payment Date</th>
+                                </tr>
+                                <tr class="thin">
+                                    <th class="font-weight-normal px-2 pl-4">
+                                        ${{friendly_money($reimbursement['currentBalance'])}}</th>
+                                    <th class="font-weight-normal pl-2 w-100"><a
+                                            href="/practice-management/financial-transactions">Current balance</a></th>
+                                </tr>
+                                <tr class="thin">
+                                    <th class="font-weight-normal px-2 pl-4">
+                                        ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
+                                    <th class="font-weight-normal pl-2"><a
+                                            href="/practice-management/bills-under-processing">Processing</a></th>
+                                </tr>
+{{--
+                                <tr class="thin">
+                                    <th class="font-weight-normal px-2 pl-5">
+                                        ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
+                                    <th class="font-weight-normal pl-2"><a
+                                            href="/practice-management/bills-under-processing">Treatment Services</a>
+                                    </th>
+                                </tr>
+                                <tr class="thin">
+                                    <th class="font-weight-normal px-2 pl-5">
+                                        ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
+                                    <th class="font-weight-normal pl-2"><a
+                                            href="/practice-management/bills-under-processing">Remote Monitoring</a>
+                                    </th>
+                                </tr>
+                                <tr class="thin">
+                                    <th class="font-weight-normal px-2 pl-5">
+                                        ${{friendly_money($reimbursement['nextPaymentAmount'])}}</th>
+                                    <th class="font-weight-normal pl-2"><a
+                                            href="/practice-management/bills-under-processing">Other Services</a></th>
+                                </tr>
+                                {{--
+                                <tr>
+                                    <th class="px-2">{{$reimbursement['lastPayment']}}</th>
+                                    <th class="pl-2"><a href="/practice-management/financial-transactions">Last payment</a></th>
+                                </tr>
+                                <tr>
+                                    <th class="px-2">{{friendly_date_time($reimbursement['lastPaymentDate'], false)}}</th>
+                                    <th class="pl-2"><a href="/practice-management/financial-transactions">Last payment date</a></th>
+                                </tr>
+                                --}}
+                                </tbody>
+                            </table>
+                        </div>
+                    </div>
+                </div>
+                <div class="col-md-9 pl-1">
+                    <div class="row mcp-theme-1">
+                        <div class="col-md-6 mcp-theme-1">
+                            <div id="mcp-dashboard-appointments" class="mb-4">
+
+                            </div>
+                            <div class="card mb-4">
+                                <div class="card-header pl-2">
+                                    <strong>
+                                        Measurements Pending Stamping
+                                    </strong>
+                                </div>
+                                <div class="card-body p-0">
+                                    @include('app.mcp.dashboard.measurements-pending-stamping')
+                                </div>
+                            </div>
+                        </div>
+                        <div class="col-md-6 mcp-theme-1 pl-1">
+                            <div class="card mb-4">
+                                <div class="card-header pl-2">
+                                    <strong>
+                                        Notifications
+                                    </strong>
+                                </div>
+                                <div class="card-body px-3 py-2">
+                                    @include('app.mcp.dashboard.notifications')
+                                </div>
+                            </div>
+                            <div class="card mb-4">
+                                <div class="card-header pl-2">
+                                    <strong>
+                                        Messages
+                                    </strong>
+                                </div>
+                                <div class="card-body p-0">
+                                    @include('app.mcp.dashboard.messages')
+                                </div>
+                            </div>
+                            <div class="card mb-4">
+                                <div class="card-header pl-2">
+                                    <strong>
+                                        Phone Calls & Memos
+                                    </strong>
+                                </div>
+                                <div class="card-body p-0">
+                                    @include('app.mcp.dashboard.calls_memos')
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+    </div>
+
+    <div class="stag-popup stag-popup-md ticket-popup mcp-theme-1" stag-popup-key="ticket-popup"></div>
+
+    <script>
+        (function () {
+
+            let datesWithEvents = [],
+                selectedDate = '{{ date('Y-m-d') }}',
+                calendarElem = null,
+                currentMonth = null,
+                currentYear = null,
+                appointmentsLoaded = false;
+
+            function formatDate(date) {
+                let d = new Date(date),
+                    month = '' + (d.getMonth() + 1),
+                    day = '' + d.getDate(),
+                    year = d.getFullYear();
+
+                if (month.length < 2)
+                    month = '0' + month;
+                if (day.length < 2)
+                    day = '0' + day;
+
+                return [year, month, day].join('-');
+            }
+
+            function onDateChange(_newDate) {
+                // ajax load appts list as markup directly from server
+                selectedDate = _newDate;
+                $.get('/pro-dashboard-events-display/' + selectedDate + '/' + selectedDate, function (_data) {
+                    let apptscontainer = $('#mcp-dashboard-appointments');
+                    apptscontainer.html(_data);
+                    initFastLoad(apptscontainer);
+                    initMoes();
+                });
+            }
+
+            function loadEventDates(_refDate = false) {
+                let today = new Date(_refDate ? _refDate : '{{date('Y-m-d')}}'),
+                    firstOfMonth = new Date(today.getFullYear(), today.getMonth(), 1),
+                    lastOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 0);
+                selectedDate = null;
+                $('td.day.active').removeClass('active');
+                $.get('/pro-dashboard-event-dates/' +
+                    formatDate(firstOfMonth) + '/' +
+                    formatDate(lastOfMonth), (_data) => {
+                    datesWithEvents = _data;
+                    calendarElem.datepicker('refresh');
+                    currentMonth = firstOfMonth.getMonth();
+                    currentYear = firstOfMonth.getFullYear();
+                    if (!_refDate && $('td.day[data-date="{{$milliseconds}}"]:visible').length) {
+                        $('td.day[data-date="{{$milliseconds}}"]:visible').first().click();
+                    }
+                    appointmentsLoaded = true;
+                }, 'json');
+            }
+
+            function getFormattedCurrentDate() {
+                let date = new Date();
+                let day = date.getDate();
+                day = day < 10 ? '0' + day : day;
+                return date.getFullYear() + '-' + parseInt(date.getMonth() + 1) + '-' + day;
+            }
+
+            function init(_target = null) {
+
+                if(_target && _target !== '.stag-content') return;
+
+                calendarElem = $('.pro-dashboard-inline-calendar');
+                calendarElem.datepicker({
+                    dateFormat: 'yy-mm-dd',
+                    onSelect: function (_date) {
+                        onDateChange(_date);
+                    },
+                    onChangeMonthYear: function (_year, _month) {
+                        let date = _year + '-' + (_month < 10 ? '0' : '') + _month + '-05';
+                        loadEventDates(date);
+                    },
+                    beforeShowDay: function (d) {
+                        if (datesWithEvents && datesWithEvents.indexOf(formatDate(d)) !== -1) {
+                            return [true, 'has-events'];
+                        }
+                        return [true, 'no-events'];
+                    },
+                    defaultDate: 0
+                });
+
+                let date = new Date();
+                let day = date.getDate();
+                day = day < 10 ? '0' + day : day;
+                let mon = parseInt(date.getMonth() + 1);
+                mon = mon < 10 ? '0' + mon : mon;
+                let dateStr = date.getFullYear() + '-' + mon + '-' + day;
+                loadEventDates(dateStr);
+
+                onDateChange(getFormattedCurrentDate());
+                selectedDate = getFormattedCurrentDate();
+
+                $(document)
+                    .off('click', '.ack-client-pro-change')
+                    .on('click', '.ack-client-pro-change', function () {
+                        let trigger = $(this).text('…');
+                        $.post('/api/clientProChange/accept', {
+                            uid: $(this).attr('data-uid')
+                        }, _data => {
+                            if (!hasResponseError(_data)) {
+                                trigger.hide();
+                                let doneElem = $('<i class="text-success fa fa-check"></i>');
+                                doneElem.insertAfter(trigger);
+                                setTimeout(() => {
+                                    let ackContainer = trigger.closest('.ack-container');
+                                    trigger.closest('div').slideUp('fast', function () {
+                                        $(this).remove();
+                                        if (!ackContainer.find('>div').length) {
+                                            ackContainer.remove();
+                                        }
+                                    });
+                                }, 500);
+                            }
+                        }, 'json');
+                        return false;
+                    });
+
+                $(document)
+                    .off('click', '.ack-client-memo')
+                    .on('click', '.ack-client-memo', function () {
+                        let trigger = $(this).text('…');
+                        $.post('/api/clientMemo/stamp', {
+                            uid: $(this).attr('data-uid')
+                        }, _data => {
+                            if (!hasResponseError(_data)) {
+                                trigger.hide();
+                                let doneElem = $('<i class="text-success fa fa-check"></i>');
+                                doneElem.insertAfter(trigger);
+                                setTimeout(() => {
+                                    let tbody = trigger.closest('tbody');
+                                    trigger.closest('tr').remove();
+                                    if (!tbody.find('>tr').length) {
+                                        tbody.closest('.ack-container').remove();
+                                    }
+                                }, 500);
+                            }
+                        }, 'json');
+                        return false;
+                    });
+
+                $(document)
+                    .off('click', '.ack-pro-appt-update')
+                    .on('click', '.ack-pro-appt-update', function () {
+                        let trigger = $(this).text('…');
+                        $.post('/api/appointmentConfirmationDecision/acknowledgeAsAppointmentPro', {
+                            uid: $(this).attr('data-uid')
+                        }, _data => {
+                            if (!hasResponseError(_data)) {
+                                trigger.hide();
+                                let doneElem = $('<i class="text-success fa fa-check"></i>');
+                                doneElem.insertAfter(trigger);
+                                setTimeout(() => {
+                                    let ackContainer = trigger.closest('tbody');
+                                    trigger.closest('tr').slideUp('fast', function () {
+                                        $(this).remove();
+                                        if (!ackContainer.find('>tr').length) {
+                                            ackContainer.remove();
+                                        }
+                                    });
+                                }, 500);
+                            }
+                        }, 'json');
+                        return false;
+                    });
+
+                addMCHook('refreshDashboardAppointments', function() {
+                    onDateChange(selectedDate);
+                });
+            }
+
+            addMCInitializer('pro-dashboard', init, '#pro-dashboard-container');
+        })();
+    </script>
+@endsection

+ 2 - 2
resources/views/app/dna/dashboard/reports_pending_ack.blade.php

@@ -45,7 +45,7 @@
                         <td>
                             @if(!$report->has_na_pro_signed)
                             <div moe relative class="ml-auto">
-                                <form show url="/api/incomingReport/signAsNa">
+                                <form show url="/api/incomingReport/signAsNaPro">
                                     <input type="hidden" name="uid" value="{{ $report->uid }}">
                                     <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
                                 </form>
@@ -57,7 +57,7 @@
 
                     @if(count($reportsPendingAck) === 0)
                     <tr>
-                        <td colspan="5">No records found!</td>
+                        <td colspan="6">No records found!</td>
                     </tr>
                     @endif
                 </tbody>

+ 1 - 1
resources/views/app/dna/dashboard/supply_orders_pending_my_ack.blade.php

@@ -43,7 +43,7 @@ $supplyOrdersPendingMyAck = $performer->pro->supplyOrdersPendingMyAckRecordsAsDn
                         <td>
                             @if(!$supplyOrder->has_na_pro_signed)
                             <div moe relative class="ml-auto">
-                                <form show url="/api/supplyOrder/signAsNa">
+                                <form show url="/api/supplyOrder/signAsNaPro">
                                     <input type="hidden" name="uid" value="{{ $supplyOrder->uid }}">
                                     <button submit class="bg-transparent border-0 p-0 text-primary">Ack.</button>
                                 </form>

+ 1 - 14
resources/views/app/dna/patients-table.blade.php

@@ -39,20 +39,7 @@
 				</div>
 			</td>
 			<td>
-				<?php $coverageStatus = $patient->getPrimaryCoverageStatus(); ?>
-				<div class="text-nowrap">
-					@if($coverageStatus === 'YES')
-					<i class="fa fa-check-circle text-success" data-toggle="tooltip" data-placement="bottom" title="Covered"></i>
-					@elseif($coverageStatus === 'NO')
-					<i class="fa fa-times text-danger" data-toggle="tooltip" data-placement="bottom" title="Not Covered"></i>
-					@else
-					<i class="fa fa-exclamation-triangle text-warning-mellow" data-toggle="tooltip" data-placement="bottom" title="Unknown"></i>
-					@endif
-					<?php $coverage = $patient->getPrimaryCoverage(); ?>
-					@if($coverage)
-					{{$coverage->insuranceDisplayName()}}
-					@endif
-				</div>
+				@include('app.patient.coverage_column_renderer', ['patient'=>$patient])
 			</td>
 			<td>
 				<div class="d-flex flex-column">

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

@@ -22,7 +22,7 @@
                     <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
                     Cannot create bill!
                 </div>
-                No generic rates found for pro.
+                No admin. rates found for pro.
             </div>
         </form>
     @else

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

@@ -22,7 +22,7 @@
                     <i class="fa fa-exclamation-triangle text-warning-mellow mr-2"></i>
                     Cannot create bill!
                 </div>
-                No generic rates found for pro.
+                No admin. rates found for pro.
             </div>
         </form>
     @else

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

@@ -1,6 +1,6 @@
 <span class="mx-2 text-secondary">|</span>
 <div moe wide relative class="">
-    <a class="" href="" show start>Create {{@$label ? $label : 'Generic'}} Bill</a>
+    <a class="" href="" show start>Create {{@$label ? $label : 'Admin.'}} Bill</a>
     @if (!!@$entityType && file_exists(resource_path('views/app/generic-bills/add-bill-form/' . $entityType . '.blade.php')))
         @include('app.generic-bills.add-bill-form.' . $entityType)
     @else

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

@@ -16,13 +16,13 @@ $genericBills = genericBills($pro, @$patient, @$entityType, @$entityUid);
 
 @if(!count($genericBills))
     <div class="{{@$class ? $class : ''}} d-flex align-items-center">
-        <p class="font-weight-bold mb-0 font-size-16">No {{@$label ? $label : 'Generic'}} bills</p>
+        <p class="font-weight-bold mb-0 font-size-16">No {{@$label ? $label : 'Admin.'}} Bills</p>
         @include('app.generic-bills.create_generic-bill')
     </div>
 @else
     <div class="{{@$class ? $class : ''}}">
         <div class="d-flex align-items-center mb-2">
-            <p class="font-weight-bold font-size-16 m-0">{{@$label ? $label : 'Generic'}} Bills</p>
+            <p class="font-weight-bold font-size-16 m-0">{{@$label ? $label : 'Admin.'}} Bills</p>
             @if(!@$noCreate)
                 @include('app.generic-bills.create_generic-bill')
             @endif

+ 2 - 2
resources/views/app/generic-bills/modal.blade.php

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

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

@@ -11,7 +11,7 @@
         </div>
 
         <div class="row">
-            <div class="col-12 col-md-6">
+            <div class="col-12 col-md-7">
 
                 <div class="d-flex align-items-center">
                     {{ $logInAsPros->withQueryString()->links() }}

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

@@ -2,7 +2,7 @@
 @if(!$mcpClientMemos || !count($mcpClientMemos))
 <div class="px-2 py-3">No memos</div>
 @else
-<table class="table table-sm m-0">
+<table class="table table-sm table-striped m-0">
 	<tbody>
 		@foreach($mcpClientMemos as $memo)
 		<tr>

+ 2 - 15
resources/views/app/mcp/new_patients_awaiting_visit.blade.php

@@ -40,24 +40,11 @@
                                 </a>
                             </td>
                             <td>{{implode(' ', [$row->name_first, $row->name_last])}}</td>
-                            <td>{{$row->dob}}</td>
+                            <td>{{friendly_date($row->dob)}}</td>
                             <td>{{$row->sex}}</td>
                             <td>{{$row->usual_bmi}}</td>
                             <td>
-                                <?php $coverageStatus = $row->getPrimaryCoverageStatus(); ?>
-                                <div class="text-nowrap">
-                                @if($coverageStatus === 'YES')
-                                     <i class="fa fa-check-circle text-success" data-toggle="tooltip" data-placement="bottom" title="Covered"></i>
-                                @elseif($coverageStatus === 'NO')
-                                    <i class="fa fa-times text-danger" data-toggle="tooltip" data-placement="bottom" title="Not Covered"></i>
-                                @else
-                                    <i class="fa fa-exclamation-triangle text-warning-mellow" data-toggle="tooltip" data-placement="bottom" title="Unknown"></i>
-                                @endif
-                                <?php $coverage = $row->getPrimaryCoverage(); ?>
-                                @if($coverage)
-                                    {{$coverage->insuranceDisplayName()}}
-                                @endif
-                              </div>
+                                @include('app.patient.coverage_column_renderer', ['patient'=>$row])
                             </td>
                             <td>{{$row->lastMcpAppointment() ? @$row->lastMcpAppointment()->start_date : '-'}}</td>
                             <td>{{$row->nextMcpAppointment() ? @$row->nextMcpAppointment()->start_date : '-'}}</td>

+ 3 - 16
resources/views/app/mcp/patients-table.blade.php

@@ -55,20 +55,7 @@
 					</div>
 				</td>
 				<td>
-					<?php $coverage = $patient->getPrimaryCoverage(); ?>
-					<?php $coverageStatus = $coverage ? $coverage->getStatus() : 'NO' ?>
-					<div class="text-nowrap">
-						@if($coverageStatus === 'YES')
-						<i class="fa fa-check-circle text-success" data-toggle="tooltip" data-placement="bottom" title="Covered"></i>
-						@elseif($coverageStatus === 'NO')
-						<i class="fa fa-times text-danger" data-toggle="tooltip" data-placement="bottom" title="Not Covered"></i>
-						@else
-						<i class="fa fa-exclamation-triangle text-warning-mellow" data-toggle="tooltip" data-placement="bottom" title="Unknown"></i>
-						@endif
-						@if($coverage)
-						{{$coverage->insuranceDisplayName()}}
-						@endif
-					</div>
+					@include('app.patient.coverage_column_renderer', ['patient'=>$patient])
 				</td>
 				<td>
 					{{ friendly_date($patient->most_recent_completed_mcp_note_date) }}
@@ -112,7 +99,7 @@
 
 			@if(count($patients) === 0)
 			<tr>
-				<td colspan="14">No records found!</td>
+				<td colspan="24">No records found!</td>
 			</tr>
 			@endif
 		</tbody>
@@ -121,4 +108,4 @@
 </div>
 <div class="p-3">
 	{{$patients->withQueryString()->links()}}
-</div>
+</div>

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

@@ -102,7 +102,9 @@ $medicaidStates = Config::get('constants.medicaid_states');
 										<label class='control-label'>HCP Pro</label>
 										<?php $teams = $pro->teamsWhereAssistant; ?>
 										<select name="hcpProUid" class="form-control">
+											@if(count($teams) > 1)
 											<option value="">--select--</option>
+											@endif
 											@foreach($teams as $team)
 											<option value="{{$team->mcp->uid}}">{{$team->mcp->displayName()}}</option>
 											@endforeach
@@ -181,7 +183,7 @@ $medicaidStates = Config::get('constants.medicaid_states');
 											</div>
 										</div>
 									</div>
-									<div class="px-4">
+									<div class="px-2">
 										<div class="row" v-show="planType == 'COMMERCIAL'">
 											<div class="form-group col-md-12">
 												<label for="" class="control-label">Commercial Payer</label>
@@ -377,4 +379,4 @@ $medicaidStates = Config::get('constants.medicaid_states');
 	});
 </script>
 
-@endsection
+@endsection

+ 2 - 0
resources/views/app/patient/coverage_column_renderer.blade.php

@@ -10,5 +10,7 @@
 <?php $coverage = $patient->getPrimaryCoverage(); ?>
 @if($coverage)
     <span class="ml-2">{{$coverage->insuranceDisplayName()}}</span>
+@else
+<small class="ml-2 text-muted">(No insurance)</small>
 @endif
 </div>

+ 2 - 2
resources/views/app/patient/primary-coverage.blade.php

@@ -25,8 +25,8 @@
         @php
             $cpc->auto_detail_json = json_decode($cpc->auto_detail_json);
         @endphp
-        <div class="d-flex mb-2">
-            <h1>Is Covered: {{$cpc->is_covered}}</h1>
+        <div class="d-flex align-items-center mb-2">
+            <h1 class="mr-2 mb-0">Is Covered: {{$cpc->is_covered}}</h1>
             @if($cpc->plan_type == 'MEDICARE')
                 @include('app.patient.primary-coverage-refresh', ['endpoint'=>'refreshCoverageForMedicare'])
                 <span class="mx-2 text-secondary text-sm">|</span>

+ 2 - 2
resources/views/app/patient/tickets/erx.blade.php

@@ -251,9 +251,9 @@
                    native target="_blank"
                    open-in-stag-popup
                    popup-style="tall"
-                   title="Generic Bills"
+                   title="Admin. Bills"
                    :href="'/generic-bill-view/Ticket/' + erxPopupItem.uid">
-                    Generic Bills
+                    Admin. Bills
                 </a>
             </div>
 

+ 2 - 2
resources/views/app/patient/tickets/imaging.blade.php

@@ -138,9 +138,9 @@
                    native target="_blank"
                    open-in-stag-popup
                    popup-style="tall"
-                   title="Generic Bills"
+                   title="Admin. Bills"
                    :href="'/generic-bill-view/Ticket/' + imagingPopupItem.uid">
-                    Generic Bills
+                    Admin. Bills
                 </a>
             </div>
 

+ 2 - 2
resources/views/app/patient/tickets/lab.blade.php

@@ -142,9 +142,9 @@
                    native target="_blank"
                    open-in-stag-popup
                    popup-style="tall"
-                   title="Generic Bills"
+                   title="Admin. Bills"
                    :href="'/generic-bill-view/Ticket/' + labPopupItem.uid">
-                    Generic Bills
+                    Admin. Bills
                 </a>
             </div>
 

+ 2 - 2
resources/views/app/patient/tickets/other.blade.php

@@ -104,9 +104,9 @@
                    native target="_blank"
                    open-in-stag-popup
                    popup-style="tall"
-                   title="Generic Bills"
+                   title="Admin. Bills"
                    :href="'/generic-bill-view/Ticket/' + otherPopupMode.uid">
-                    Generic Bills
+                    Admin. Bills
                 </a>
             </div>
 

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

@@ -170,21 +170,7 @@
                         </td>
                         @endif
                         <td>
-                            <?php $coverageStatus = $patient->getPrimaryCoverageStatus(); ?>
-                            @if($coverageStatus === 'YES')
-                                <div class="text-nowrap">Covered <i class="fa fa-check-circle text-success"></i>
-                                </div>
-                            @elseif($coverageStatus === 'NO')
-                                <div class="text-nowrap">Not Covered <i class="fa fa-times text-danger"></i></div>
-                            @else
-                                <div class="text-nowrap">Unknown <i
-                                            class="fa fa-exclamation-triangle text-warning-mellow"></i></div>
-                            @endif
-                            <?php $coverage = $patient->getPrimaryCoverage(); ?>
-                            @if($coverage)
-                                {{$coverage->insuranceDisplayName()}}
-                            @endif
-                            @include('app.patient.coverage-status')
+                            @include('app.patient.coverage_column_renderer', ['patient'=>$patient])
                         </td>
                         <td>
                             {{ $patient->mcp ? $patient->mcp->displayName() : '-' }}

+ 1 - 1
resources/views/app/practice-management/bills-under-processing.blade.php

@@ -64,7 +64,7 @@
                                         Chart
                                     </a>
                                 @else
-                                    Generic
+                                    Admin.
                                 @endif
                             </td>
                             <td>{{friendly_date($row->effective_date)}}</td>

+ 39 - 35
resources/views/app/practice-management/pro-availability.blade.php

@@ -125,7 +125,45 @@
                     <tbody>
                         @foreach($daysOfWeek as $dow)
                         <tr>
-                            <td class="pl-3 align-middle">{{$dow}}</td>
+                            <td class="pl-3 align-middle">
+                              <div class="d-flex">
+                                <div moe wide class="mr-3">
+                                    <a start show title="Update" class="text-success">
+                                        Add
+                                    </a>
+                                    <form url="/api/proGeneralAvailability/createForSingleDay">
+                                        <input type="hidden" name="dayOfWeek" value="{{$dow}}">
+                                        <input type="hidden" name="proUid" value="{{$selectedProUid ? $selectedProUid : $pro->uid}}">
+                                        <div class="form-group">
+                                            <label for="" class="control-label font-weight-bold mb-1">Timezone </label>
+                                            <select name="timezone" class="form-control form-control-sm" required>
+                                                <option value="">-- select --</option>
+                                                <option value="EASTERN">Eastern</option>
+                                                <option value="CENTRAL">Central</option>
+                                                <option value="MOUNTAIN">Mountain</option>
+                                                <option value="PACIFIC">Pacific</option>
+                                                <option value="ALASKA">Alaska</option>
+                                                <option value="HAWAII">Hawaii</option>
+                                                <option value="PUERTO_RICO">Puerto Rico</option>
+                                            </select>
+                                        </div>
+                                        <div class="form-group">
+                                            <label for="" class="control-label font-weight-bold mb-1">Start Time </label>
+                                            <input class="form-control" type="time" name="startTime" value="08:00">
+                                        </div>
+                                        <div class="form-group">
+                                            <label for="" class="control-label font-weight-bold mb-1">End Time </label>
+                                            <input class="form-control" type="time" name="endTime" value="17:00">
+                                        </div>
+                                        <div class="form-group m-0">
+                                            <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
+                                            <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                                {{$dow}}
+                              </div>
+                            </td>
                             <td>
                                 <table class="table table-sm m-0">
                                     @if(count($generalAvailabilities[$dow]))
@@ -136,40 +174,6 @@
                                                 <td class="w-25 border-0">{{$ga->timezone}}</td>
                                                 <td class="border-0">
                                                     <div class="d-flex align-items-center justify-content-end pl-2">
-                                                        <div moe wide class="mr-3">
-                                                            <a start show title="Update" class="text-success">
-                                                                Add
-                                                            </a>
-                                                            <form url="/api/proGeneralAvailability/createForSingleDay">
-                                                                <input type="hidden" name="dayOfWeek" value="{{$dow}}">
-                                                                <input type="hidden" name="proUid" value="{{$selectedProUid ? $selectedProUid : $pro->uid}}">
-                                                                <div class="form-group">
-                                                                    <label for="" class="control-label font-weight-bold mb-1">Timezone </label>
-                                                                    <select name="timezone" class="form-control form-control-sm" required>
-                                                                        <option value="">-- select --</option>
-                                                                        <option value="EASTERN">Eastern</option>
-                                                                        <option value="CENTRAL">Central</option>
-                                                                        <option value="MOUNTAIN">Mountain</option>
-                                                                        <option value="PACIFIC">Pacific</option>
-                                                                        <option value="ALASKA">Alaska</option>
-                                                                        <option value="HAWAII">Hawaii</option>
-                                                                        <option value="PUERTO_RICO">Puerto Rico</option>
-                                                                    </select>
-                                                                </div>
-                                                                <div class="form-group">
-                                                                    <label for="" class="control-label font-weight-bold mb-1">Start Time </label>
-                                                                    <input class="form-control" type="time" name="startTime" value="08:00">
-                                                                </div>
-                                                                <div class="form-group">
-                                                                    <label for="" class="control-label font-weight-bold mb-1">End Time </label>
-                                                                    <input class="form-control" type="time" name="endTime" value="17:00">
-                                                                </div>
-                                                                <div class="form-group m-0">
-                                                                    <button submit class="btn btn-primary btn-sm mr-2">Submit</button>
-                                                                    <button cancel class="btn btn-default border btn-sm mr-2">Cancel</button>
-                                                                </div>
-                                                            </form>
-                                                        </div>
                                                         @if(isset($generalAvailabilities[$dow]))
                                                             <div moe wide class="mr-2">
                                                                 <a start show title="Update">

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

@@ -117,7 +117,7 @@
                                     Chart
                                 </a>
                                 @else
-                                Generic
+                                Admin.
                                 @endif
                             </td>
                             <td>{{friendly_date($row->effective_date)}}</td>

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

@@ -77,7 +77,7 @@ $isVisitNote = ($routeName === 'patients.view.notes.view.dashboard' && @$note &&
 						</li>
 						<li class="nav-item">
 							<a class="nav-link {{ strpos($routeName, 'patients.view.generic-bills') === 0 ? 'active' : '' }}"
-							   href="{{ route('patients.view.generic-bills', ['patient' => $patient]) }}">Generic Bills</a>
+							   href="{{ route('patients.view.generic-bills', ['patient' => $patient]) }}">Admin. Bills</a>
 						</li>
 						<li class="nav-item">
 							<a class="nav-link {{ strpos($routeName, 'patients.view.handouts') === 0 ? 'active' : '' }}"

+ 19 - 23
resources/views/layouts/template.blade.php

@@ -88,7 +88,7 @@
 
 
     <nav class="navbar navbar-expand-md navbar-dark stag-primary-bg py-1 mcp-theme-1 px-2">
-        <a class="navbar-brand" href="{{ route('dashboard') }}">
+        <a class="navbar-brand" href="/">
             <img src="/img/logo_white.svg" alt="Leadership Health">
         </a>
         <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navBar" aria-controls="navBar" aria-expanded="false" aria-label="Toggle navigation">
@@ -98,13 +98,28 @@
         <div class="collapse navbar-collapse" id="navBar">
             <ul class="navbar-nav mr-auto">
 
-                <li class="nav-item"><a class="nav-link" href="{{ route('dashboard') }}"><i class="mr-1 fas fa-home"></i> Home</a> </li>
+                @if($pro->pro_type == 'ADMIN')
+                    <li class="nav-item"><a class="nav-link" href="{{ route('admin.dashboard') }}"><i class="mr-1 fas fa-home"></i> Home</a> </li>
+                    <li class="nav-item"><a class="nav-link" href="{{ route('admin.patients') }}"><i class="mr-1 fas fa-user"></i> Patients</a> </li>
+                @elseif($pro->is_enrolled_as_mcp && $pro->is_considered_for_mcp_assignment)
+                    <li class="nav-item"><a class="nav-link" href="{{ route('mcp.dashboard') }}"><i class="mr-1 fas fa-home"></i> Home</a> </li>
+
+                    <li class="nav-item"><a class="nav-link" href="{{ route('mcp.appointments') }}">
+                            <i class="mr-1 fas fa-calendar-alt"></i> Appointments
+                        </a>
+                    </li>
+                @elseif($pro->is_enrolled_as_hcp)
+                    <li class="nav-item"><a class="nav-link" href="{{ route('hcp.dashboard') }}"><i class="mr-1 fas fa-home"></i> Home</a> </li>
+                @else
+                    <li class="nav-item"><a class="nav-link" href="{{ route('dna.dashboard') }}"><i class="mr-1 fas fa-home"></i> Home</a> </li>
+                @endif
+
 
                 @if($pro)
                     @if($pro->is_enrolled_as_mcp)
                     <li class="nav-item"><a class="nav-link" href="{{ route('mcp.patients') }}"><i class="mr-1 fas fa-user"></i> Patients</a> </li>
                     @elseif($pro->pro_type == 'ADMIN')
-                    <li class="nav-item"><a class="nav-link" href="{{ route('admin.patients') }}"><i class="mr-1 fas fa-user"></i> Patients</a> </li>
+
                     @else
                     <li class="nav-item"><a class="nav-link" href="{{ route('dna.patients') }}"><i class="mr-1 fas fa-user"></i> Patients</a> </li>
                     @endif
@@ -114,32 +129,13 @@
                   <li class="nav-item"><a class="nav-link" href="{{ route('new-patient') }}"><i class="mr-1 fas fa-user-plus"></i> New Patient</a> </li>
                 @endif
 
-                @if($pro->is_enrolled_as_mcp)
-
-{{--                    <li class="nav-item"><a class="nav-link" href="{{ route('mcp.erx_and_orders') }}">--}}
-{{--                            <i class="mr-1 fas fa-file-prescription"></i> ERx & Orders--}}
-{{--                        </a>--}}
-{{--                    </li>--}}
-
-                    <li class="nav-item"><a class="nav-link" href="{{ route('mcp.appointments') }}">
-                            <i class="mr-1 fas fa-calendar-alt"></i> Appointments
-                        </a>
-                    </li>
-
-                @endif
-
                 <li class="nav-item dropdown">
                     <a class="nav-link dropdown-toggle" href="#" id="practice-management" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                         <i class="mr-1 fas fa-tasks"></i> Practice
                     </a>
                     <div class="dropdown-menu mcp-theme-1 no-overflow-menu p-0" aria-labelledby="practice-management">
-
-
-
                         @if($pro->pro_type == 'ADMIN')
-
                             <a class="dropdown-item" href="{{ route('practice-management.rpmMatrix') }}">RPM Matrix</a>
-
                             {{--<a class="dropdown-item" href="{{ route('practice-management.previousBills') }}">Previous Bills</a>--}}
                             <a class="dropdown-item" href="{{ route('practice-management.financialTransactions') }}">Financial Transactions</a>
                             <a class="dropdown-item" href="/practice-management/bills/not-yet-signed">Pending Bills to Sign</a>
@@ -178,7 +174,7 @@
                             <a class="dropdown-item" href="{{ route('practice-management.shipments') }}">Shipments</a>
                             <a class="dropdown-item" href="{{ route('practice-management.packs-multi-print') }}">Print Pack Labels</a>
                             <a class="dropdown-item" href="{{ route('practice-management.handouts') }}">Handouts</a>
-                            <a class="dropdown-item" href="{{ route('practice-management.generic-bills') }}">Generic Bills</a>
+                            <a class="dropdown-item" href="{{ route('practice-management.generic-bills') }}">Admin. Bills</a>
                             <a class="dropdown-item" href="{{ route('practice-management.mc-code-checks') }}">MC Code Checks</a>
                             <a class="dropdown-item" href="{{ route('practice-management.clauses.list') }}">Clauses</a>
                             <a class="dropdown-item" href="{{ route('practice-management.statTrees.list') }}">Stat Trees</a>

+ 43 - 0
routes/web.php

@@ -74,6 +74,8 @@ Route::middleware('pro.auth')->group(function () {
 
     Route::name('mcp.')->prefix('m')->group(function () {
 
+        Route::get('dashboard', 'HomeController@dashboard_MCP')->name('dashboard');
+
         Route::get('patients', 'McpController@patients')->name('patients');
         Route::get('notes', 'McpController@notes')->name('notes');
         Route::get('appointments', 'McpController@appointments')->name('appointments');
@@ -105,8 +107,46 @@ Route::middleware('pro.auth')->group(function () {
 
     });
 
+    Route::name('hcp.')->prefix('h')->group(function () {
+
+        Route::get('dashboard', 'HomeController@dashboard_HCP')->name('dashboard');
+
+        //TODO HCP CONTROLLER
+//        Route::get('patients', 'McpController@patients')->name('patients');
+//        Route::get('notes', 'McpController@notes')->name('notes');
+//        Route::get('appointments', 'McpController@appointments')->name('appointments');
+//        Route::get('bills', 'McpController@bills')->name('bills');
+//        Route::get('erx-and-orders', 'McpController@erx_and_orders')->name('erx_and_orders');
+//        Route::get('reports', 'McpController@reports')->name('reports');
+//        Route::get('supply-orders', 'McpController@supply_orders')->name('supply_orders');
+//        Route::get('client-messages', 'McpController@client_messages')->name('client_messages');
+//        Route::get('clients-bdt-devices', 'McpController@clients_bdt_devices')->name('clients_bdt_devices');
+//        Route::get('patients-accounts-invites', 'McpController@patients_accounts_invites')->name('patients_accounts_invites');
+//        Route::get('memos', 'McpController@memos')->name('memos');
+//
+//
+//        Route::get('new-patients-awaiting-visit', 'McpController@new_patients_awaiting_visit')->name('new_patients_awaiting_visit');
+//        Route::get('notes-pending-signature', 'McpController@notes_pending_signature')->name('notes_pending_signature');
+//        Route::get('notes-pending-billing', 'McpController@notes_pending_billing')->name('notes_pending_billing');
+//        Route::get('bills-pending-signature', 'McpController@bills_pending_signature')->name('bills_pending_signature');
+//        Route::get('reports-pending-signature', 'McpController@reports_pending_signature')->name('reports_pending_signature');
+//        Route::get('patients-without-appointments', 'McpController@patients_without_appointments')->name('patients_without_appointments');
+//        Route::get('patients-overdue-for-visit', 'McpController@patients_overdue_for_visit')->name('patients_overdue_for_visit');
+//        Route::get('cancelled-appointments-pending-review', 'McpController@cancelled_appointments_pending_review')->name('cancelled_appointments_pending_review');
+//        Route::get('cancelled-bills-pending-review', 'McpController@cancelled_bills_pending_review')->name('cancelled_bills_pending_review');
+//        Route::get('cancelled-supply-orders-pending-review', 'McpController@cancelled_supply_orders_pending_review')->name('cancelled_supply_orders_pending_review');
+//        Route::get('erx-and-orders-pending-signature', 'McpController@erx_and_orders_pending_signature')->name('erx_and_orders_pending_signature');
+//        Route::get('supply-orders-pending-signature', 'McpController@supply_orders_pending_signature')->name('supply_orders_pending_signature');
+//        Route::get('supply-orders-awaiting-shipment', 'McpController@supply_orders_awaiting_shipment')->name('supply_orders_awaiting_shipment');
+//
+//        Route::get('measurements-pending-stamping', 'McpController@measurements_pending_stamping')->name('measurements_pending_stamping');
+
+    });
+
     Route::name('dna.')->prefix('n')->group(function () {
 
+        Route::get('dashboard', 'HomeController@dashboard_DNA')->name('dashboard');
+
         Route::get('patients', 'DnaController@patients')->name('patients');
         Route::get('encounters', 'DnaController@encounters')->name('encounters');
         Route::get('notes', 'DnaController@notes')->name('notes');
@@ -149,6 +189,9 @@ Route::middleware('pro.auth')->group(function () {
 
     Route::name('admin.')->prefix('a')->group(function () {
         // TODO
+
+        Route::get('dashboard', 'HomeController@dashboard_ADMIN')->name('dashboard');
+
         Route::get('patients', 'AdminController@patients')->name('patients');
         Route::get('notes', 'AdminController@notes')->name('notes');
         Route::get('appointments', 'AdminController@appointments')->name('appointments');