Просмотр исходного кода

Merge branch 'dev' of https://rav.triplestart.com/jmudaka/stagfe2 into dev-peter-session

Peter Muturi 3 лет назад
Родитель
Сommit
be94a9f02f
100 измененных файлов с 2042 добавлено и 647 удалено
  1. BIN
      .env.swp
  2. 71 0
      app/Http/Controllers/AdminController.php
  3. 25 16
      app/Http/Controllers/FDBPGController.php
  4. 8 7
      app/Http/Controllers/PracticeManagementController.php
  5. 22 0
      app/Models/AdministratorBillFlagUpdate.php
  6. 8 0
      app/Models/Bill.php
  7. 21 0
      app/Models/ClientStickyNote.php
  8. 10 1
      app/Models/Note.php
  9. 1 1
      config/app.php
  10. 7 0
      config/stag.php
  11. 21 4
      js-dev/click-to-copy.js
  12. 1 1
      js-dev/stag-suggest.js
  13. 16 3
      public/css/style.css
  14. 2 2
      resources/views/app/admin/notes_pending_summary_suggestion.blade.php
  15. 2 2
      resources/views/app/admin/notes_rejected_summary_suggestion.blade.php
  16. 2 2
      resources/views/app/admin/patients-table.blade.php
  17. 64 0
      resources/views/app/admin/patients_missing_default_settings.blade.php
  18. 145 0
      resources/views/app/admin/patients_missing_defsult_settings_filters.blade.php
  19. 2 2
      resources/views/app/dashboard-mcp.blade.php
  20. 1 1
      resources/views/app/mc.blade.php
  21. 2 2
      resources/views/app/mcp/notes_pending_billing.blade.php
  22. 2 2
      resources/views/app/mcp/notes_pending_signature.blade.php
  23. 2 2
      resources/views/app/mcp/notes_pending_summary_suggestion.blade.php
  24. 2 2
      resources/views/app/mcp/notes_rejected_summary_suggestion.blade.php
  25. 9 7
      resources/views/app/patient/care-month/_matrix.blade.php
  26. 9 7
      resources/views/app/patient/care-month/_work_matrix.blade.php
  27. 80 0
      resources/views/app/patient/care-month/care-month-update-mcp-onboarding-visit-info.blade.php
  28. 1 41
      resources/views/app/patient/care-month/dashboard.blade.php
  29. 2 2
      resources/views/app/patient/care-month/rm-reasons.blade.php
  30. 1 1
      resources/views/app/patient/coverage_column_renderer.blade.php
  31. 68 9
      resources/views/app/patient/medications-reconcile.blade.php
  32. 2 2
      resources/views/app/patient/module-specific-summary-renderers/allergy/plan.blade.php
  33. 2 2
      resources/views/app/patient/module-specific-summary-renderers/behavior/plan.blade.php
  34. 2 2
      resources/views/app/patient/module-specific-summary-renderers/care_team_member/plan.blade.php
  35. 2 2
      resources/views/app/patient/module-specific-summary-renderers/exercise/plan.blade.php
  36. 2 2
      resources/views/app/patient/module-specific-summary-renderers/goal/plan.blade.php
  37. 2 2
      resources/views/app/patient/module-specific-summary-renderers/medication/plan.blade.php
  38. 2 2
      resources/views/app/patient/module-specific-summary-renderers/nutrition/plan.blade.php
  39. 2 2
      resources/views/app/patient/module-specific-summary-renderers/problem/plan.blade.php
  40. 12 1
      resources/views/app/patient/note/_create-claim.blade.php
  41. 4 4
      resources/views/app/patient/note/_create-note-reason.blade.php
  42. 46 10
      resources/views/app/patient/note/dashboard-bu-b4-pure-soap.blade.php
  43. 44 8
      resources/views/app/patient/note/dashboard-univ.blade.php
  44. 54 14
      resources/views/app/patient/note/dashboard.blade.php
  45. 200 0
      resources/views/app/patient/note/flag-bill.blade.php
  46. 3 3
      resources/views/app/patient/note/follow-up-appointment.blade.php
  47. 64 0
      resources/views/app/patient/note/partials/bill-flags-history.blade.php
  48. 2 2
      resources/views/app/patient/note/pdf.blade.php
  49. 2 2
      resources/views/app/patient/note/rm-setup.blade.php
  50. 55 45
      resources/views/app/patient/note/rpm-agreement.blade.php
  51. 1 1
      resources/views/app/patient/note/segment-slim.blade.php
  52. 1 1
      resources/views/app/patient/note/segment/suggestions_and_updates.blade.php
  53. 2 2
      resources/views/app/patient/notes.blade.php
  54. 1 1
      resources/views/app/patient/partials/put-rm-reasons.blade.php
  55. 44 53
      resources/views/app/patient/partials/rm-reasons-display.blade.php
  56. 43 0
      resources/views/app/patient/partials/rm-reasons-display_depricated.blade.php
  57. 10 6
      resources/views/app/patient/partials/rm-setup.blade.php
  58. 42 0
      resources/views/app/patient/partials/sticky-notes-history.blade.php
  59. 14 0
      resources/views/app/patient/partials/update-best-time-to-call.blade.php
  60. 83 0
      resources/views/app/patient/partials/update-mcp-onboarding-visit-info.blade.php
  61. 5 1
      resources/views/app/patient/prescriptions/list.blade.php
  62. 10 5
      resources/views/app/patient/primary-coverage-manual-determination-medicaid-modal.blade.php
  63. 9 4
      resources/views/app/patient/primary-coverage-manual-determination-medicare-modal.blade.php
  64. 46 53
      resources/views/app/patient/problems-center.blade.php
  65. 2 2
      resources/views/app/patient/segment-templates/_child_plan/edit-plan-optimized-flat.php
  66. 2 2
      resources/views/app/patient/segment-templates/_child_plan/edit-plan-optimized.php
  67. 1 1
      resources/views/app/patient/segment-templates/_child_plan/medication/edit-plan-optimized.php
  68. 2 2
      resources/views/app/patient/segment-templates/_child_review/edit-review-optimized-flat.php
  69. 2 2
      resources/views/app/patient/segment-templates/_child_review/edit-review-optimized.php
  70. 1 1
      resources/views/app/patient/segment-templates/_child_review/medication/edit-review-optimized.php
  71. 0 0
      resources/views/app/patient/segment-templates/current_mental-status/edit.blade.php
  72. 0 0
      resources/views/app/patient/segment-templates/current_mental-status/summary.blade.php
  73. 3 3
      resources/views/app/patient/segment-templates/omega_allergies/summary.blade.php
  74. 7 7
      resources/views/app/patient/segment-templates/omega_care_team/summary.blade.php
  75. 2 4
      resources/views/app/patient/segment-templates/omega_goals/summary.blade.php
  76. 1 1
      resources/views/app/patient/segment-templates/omega_history_past_medical/edit.blade.php
  77. 38 9
      resources/views/app/patient/segment-templates/omega_history_past_medical/summary.blade.php
  78. 159 0
      resources/views/app/patient/segment-templates/omega_history_past_medical/summary.blade.php_NEW
  79. 20 17
      resources/views/app/patient/segment-templates/omega_history_social/summary.blade.php
  80. 3 3
      resources/views/app/patient/segment-templates/omega_medications/summary.blade.php
  81. 16 27
      resources/views/app/patient/segment-templates/omega_problems/summary.blade.php
  82. 60 0
      resources/views/app/patient/segment-templates/omega_problems/summary.blade.php__NEW
  83. 1 1
      resources/views/app/patient/segment-templates/omega_subjective_system/summary.blade.php
  84. 1 1
      resources/views/app/patient/segment-templates/past_medical_history/edit.blade.php
  85. 1 1
      resources/views/app/patient/segment-templates/sigma_history_past_medical/edit.blade.php
  86. 68 35
      resources/views/app/patient/segment-templates/typical_day_lifestyle/summary.blade.php
  87. 10 5
      resources/views/app/patient/wizard-partials/add-multiple-pre-existing.blade.php
  88. 58 6
      resources/views/app/patient/wizard-partials/common-script.blade.php
  89. BIN
      resources/views/app/practice-management/.process-claims.blade.php.swp
  90. 1 1
      resources/views/app/practice-management/billing-manager-v1.blade.php
  91. 1 1
      resources/views/app/practice-management/billing-manager.blade.php
  92. 1 1
      resources/views/app/practice-management/notes-processing-center.blade.php
  93. 1 1
      resources/views/app/practice-management/process-claims.blade.php
  94. 11 0
      resources/views/app/practice-management/remote-monitoring-admin-row-markup.blade.php
  95. 2 0
      resources/views/app/practice-management/remote-monitoring-admin.blade.php
  96. 8 0
      resources/views/app/practice-management/visit-templates/index.blade.php
  97. 124 158
      resources/views/layouts/patient-header.blade.php
  98. 13 5
      resources/views/layouts/patient.blade.php
  99. 1 0
      resources/views/layouts/template.blade.php
  100. 1 1
      routes/web.php

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

@@ -463,4 +463,75 @@ class AdminController extends Controller
         return view('app.admin.bdt_devices', compact('bdtDevices', 'filters'));
     }
 
+    public function patientsMissingDefasultSettings(Request $request){
+        $filters = $request->all();
+        $patients = Client::whereNull('shadow_pro_id');
+
+        $patients = $patients->where(function($qry){
+            return $qry->orWhereNull('mcp_pro_id')->orWhereNull('default_mcp_company_pro_id')->orWhereNull('default_mcp_company_pro_payer_id')->orWhereNull('default_mcp_company_location_id');
+        });
+
+        if ($request->input('name')) {
+            $name = trim($request->input('name'));
+            if ($name) {
+                $patients = $patients->where(function ($q) use ($name) {
+                    $q->where('name_first', 'ILIKE', '%' . $name . '%')
+                        ->orWhere('name_last', 'ILIKE', '%' . $name . '%');
+                });
+            }
+        }
+
+        if ($request->input('mcp')) {
+            if($request->input('mcp') == 'NO_MCP'){
+                $patients = $patients->whereNull('mcp_pro_id');
+            }else{
+                $mcp = Pro::where('uid', trim($request->input('mcp')))->first();
+                if ($mcp) {
+                    $patients = $patients->where('mcp_pro_id', $mcp->id);
+                }
+            }
+        }
+
+        if ($request->input('chart_number')) {
+            $patients = $patients->where('chart_number', 'ILIKE' , '%'.$request->input('chart_number').'%');
+        }
+
+        $status = $request->input('status');
+        if($status){
+            if($status == 'ACTIVE'){
+                $patients->where('is_active', true)->where(function($q) use ($status){
+                    return $q->where('client_engagement_status_category', $status)
+                    ->orWhereNull('client_engagement_status_category');
+                });    
+            }else {
+                $patients->where('client_engagement_status_category', $status);
+            }
+
+        }
+
+        $insurance = $request->get('insurance');
+        if($insurance){
+            if($insurance === 'MEDICARE'){
+                $patients = $patients->whereHas('latestClientPrimaryCoverage', function($cpcQuery){
+                    return $cpcQuery->where('is_partbprimary', '=', 'YES');
+                });
+            }else{
+                $patients = $patients->whereDoesntHave('latestClientPrimaryCoverage', function($cpcQuery){
+                    return $cpcQuery->where('is_partbprimary', '=', 'YES');
+                });
+            }
+        }
+        
+        $missing_default_settings = $request->get('missing_default_settings');
+        if($missing_default_settings){
+            if($missing_default_settings === 'NO_MCP') $patients = $patients->whereNull('mcp_pro_id');
+            if($missing_default_settings === 'NO_MCP_COMPANY_PRO') $patients = $patients->whereNull('default_mcp_company_pro_id');
+            if($missing_default_settings === 'NO_MCP_COMPANY_PRO_PAYER') $patients = $patients->whereNull('default_mcp_company_pro_payer_id');
+            if($missing_default_settings === 'NO_MCP_COMPANY_LOCATION') $patients = $patients->whereNull('default_mcp_company_location_id');
+        }
+
+        $patients = $patients->orderBy('created_at', 'DESC')->paginate(50);
+        return view('app.admin.patients_missing_default_settings', compact('patients', 'filters'));
+    }
+
 } 

+ 25 - 16
app/Http/Controllers/FDBPGController.php

@@ -87,15 +87,16 @@ SELECT r_med.medid,
        r_med.med_medid_desc as text,
        r_med.gcn_seqno,
        r_dosage_form.routed_dosage_form_med_id,
-       r_route.routed_med_id
+       r_route.routed_med_id,
+       SIMILARITY(r_med.med_medid_desc, :term) as sim1
 FROM rmiid1_med r_med
          JOIN rmidfid1_routed_dose_form_med r_dosage_form
               ON r_med.routed_dosage_form_med_id = r_dosage_form.routed_dosage_form_med_id
          JOIN rmirmid1_routed_med r_route ON r_dosage_form.routed_med_id = r_route.routed_med_id
 WHERE r_med.med_status_cd = '0'
-  AND r_med.med_medid_desc ILIKE :term
-ORDER BY REPLACE(r_med.med_medid_desc, '-', 'x')",
-            ['term' => $term . '%']
+  AND SIMILARITY(r_med.med_medid_desc, :term) >= " . config('stag.fuzzySearchMinimumSimilarityScore')['medication'] . "
+ORDER BY sim1 DESC",
+            ['term' => $term]
         );
         return json_encode([
             "success" => true,
@@ -229,16 +230,24 @@ where r1.related_dxid = :dxid
         $term = $request->input('term') ? trim($request->input('term')) : '';
         if (empty($term)) return '';
         $matches = DB::connection('pgsql_fdb')->select("
-SELECT DISTINCT ON (r1.search_icd_cd) search_icd_cd as sub_text, r1.icd_cd_type, r2.icd_desc as text, r1.related_dxid as dxid, r1.fml_clin_code, r1.fml_nav_code, r3.dxid_desc56
+SELECT distinct on (sim1) SIMILARITY(r2.icd_desc, :term) as sim1,
+       search_icd_cd                            as sub_text,
+       r1.icd_cd_type,
+       r2.icd_desc                              as text,
+       r1.related_dxid                          as dxid,
+       r1.fml_clin_code,
+       r1.fml_nav_code,
+       r3.dxid_desc56
 FROM RFMLISR1_ICD_SEARCH r1
-JOIN RFMLINM1_ICD_DESC r2 ON r1.search_icd_cd = r2.icd_cd
-LEFT OUTER JOIN RFMLDX0_DXID r3 ON r1.related_dxid = r3.dxid
+         JOIN RFMLINM1_ICD_DESC r2 ON r1.search_icd_cd = r2.icd_cd
+         LEFT OUTER JOIN RFMLDX0_DXID r3 ON r1.related_dxid = r3.dxid
 WHERE r1.icd_cd_type = '05'
-    AND r1.fml_clin_code = '01'
-    AND (r2.icd_desc ILIKE :term OR r1.search_icd_cd ILIKE :term)
-ORDER BY r1.search_icd_cd ASC, r1.fml_nav_code ASC
+  AND r1.fml_clin_code = '01'
+  AND (SIMILARITY(r2.icd_desc, :term) >= " . config('stag.fuzzySearchMinimumSimilarityScore')['problem'] . " OR
+       r1.search_icd_cd ILIKE :term2)
+ORDER BY sim1 DESC
 ",
-            ['term' => '%' . $term . '%']
+            ['term' => $term, 'term2' => $term . '%']
         );
         return response()->json(['success'=>true, 'data'=>$matches]);
     }
@@ -265,13 +274,13 @@ ORDER BY r1.dam_concept_id_desc
         $term = $request->input('term') ? trim($request->input('term')) : '';
         if (empty($term)) return '';
         $matches = DB::connection('pgsql_fdb')->select("
-SELECT r1.dam_concept_id, r1.dam_concept_id_typ, r1.dam_concept_id_desc as text,
-r2.dam_concept_id_typ_desc as sub_text
+SELECT distinct on (sim1) SIMILARITY(r1.dam_concept_id_desc, :term) as sim1,
+       r1.dam_concept_id, r1.dam_concept_id_typ, r1.dam_concept_id_desc as text
 FROM rdamca0_concept r1 join rdamcd0_picklist_con_typ_desc r2 on r1.dam_concept_id_typ = r2.dam_concept_id_typ
-WHERE (r1.dam_concept_id_desc ILIKE :term)
-ORDER BY r1.dam_concept_id_desc
+WHERE SIMILARITY(r1.dam_concept_id_desc, :term) >= " . config('stag.fuzzySearchMinimumSimilarityScore')['allergy'] . "
+ORDER BY sim1 DESC
 ",
-            ['term' => $term . '%']
+            ['term' => $term]
         );
         return json_encode([
             "success" => true,

+ 8 - 7
app/Http/Controllers/PracticeManagementController.php

@@ -1343,7 +1343,8 @@ SELECT client.name_first, client.name_last,
        (client.name_first || ' ' || client.name_last) as client_name,
        (mcp_pro.name_first || ' ' || mcp_pro.name_last) as mcp_pro_name,
        (rmm_pro.name_first || ' ' || rmm_pro.name_last) as rmm_pro_name,
-       client.uid as client_uid, 
+       client.uid as client_uid,
+       client.chart_number, 
        client.dob,
        client.is_enrolled_in_rm,
        client.most_recent_completed_mcp_note_date,
@@ -1373,11 +1374,11 @@ SELECT client.name_first, client.name_last,
        client.rmm_pro_id,
        client.rme_pro_id,
        client.cell_number,
-       client.most_recent_cellular_bp_dbp_mm_hg,
-       client.most_recent_cellular_bp_sbp_mm_hg,
-       client.most_recent_cellular_bp_measurement_at,      
-       client.most_recent_cellular_weight_value,
-       client.most_recent_cellular_weight_measurement_at
+       care_month.most_recent_cellular_bp_dbp_mm_hg,
+       care_month.most_recent_cellular_bp_sbp_mm_hg,
+       care_month.most_recent_cellular_bp_measurement_at,      
+       care_month.most_recent_cellular_weight_value,
+       care_month.most_recent_cellular_weight_measurement_at
 FROM care_month join client on care_month.client_id = client.id join note mrnote on client.most_recent_completed_mcp_note_id = mrnote.id
      left join note mrmnote on mrmnote.id = (
         select max(n.id) from note n 
@@ -1500,7 +1501,7 @@ WHERE
         $c_lt16MeasurementDays = "care_month.number_of_days_with_remote_measurements < 16";
         $c_gte16MeasurementDays = "care_month.number_of_days_with_remote_measurements >= 16";
         $c_subscribedToSMS = "client.send_sms_on_bdt_measurement = TRUE";
-        $c_deviceUsed = "(client.most_recent_cellular_bp_measurement_at IS NOT NULL OR most_recent_cellular_weight_measurement_at IS NOT NULL)";
+        $c_deviceUsed = "(client.most_recent_cellular_bp_measurement_at IS NOT NULL OR client.most_recent_cellular_weight_measurement_at IS NOT NULL)";
         $c_lt20BillingMinutes = "care_month.rm_total_time_in_seconds_by_mcp < 1200";
         $c_gte20BillingMinutes = "care_month.rm_total_time_in_seconds_by_mcp >= 1200";
 

+ 22 - 0
app/Models/AdministratorBillFlagUpdate.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace App\Models;
+
+# use Illuminate\Database\Eloquent\Model;
+
+class AdministratorBillFlagUpdate extends Model
+{
+    protected $table = 'administrator_bill_flag_update';
+
+    public function billl() {
+        return $this->hasOne(Bill::class, 'id', 'bill_id');
+    }
+
+    public function billFlagAcknowledgedByProAdmin() {
+        return $this->hasOne(Pro::class, 'id', 'flagged_by_administrator_pro_id');
+    }
+
+    public function billFlagAcknowledgedByPro() {
+        return $this->hasOne(Pro::class, 'id', 'administrator_flag_acknowledged_by_pro_id');
+    }
+}

+ 8 - 0
app/Models/Bill.php

@@ -44,4 +44,12 @@ class Bill extends Model
     public function genericCompanyPro() {
         return $this->hasOne(CompanyPro::class, 'id', 'generic_company_pro_id');
     }
+
+    public function billFlagAcknowledgedByProAdmin() {
+        return $this->hasOne(Pro::class, 'id', 'flagged_by_administrator_pro_id');
+    }
+
+    public function billFlagAcknowledgedByPro() {
+        return $this->hasOne(Pro::class, 'id', 'administrator_flag_acknowledged_by_pro_id');
+    }
 }

+ 21 - 0
app/Models/ClientStickyNote.php

@@ -0,0 +1,21 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Relations\HasMany;
+use Illuminate\Database\Eloquent\Relations\HasOne;
+
+class ClientStickyNote extends Model
+{
+    protected $table = 'client_sticky_note';
+
+    public function createdBy(): HasOne
+    {
+        return $this->hasOne(AppSession::class, 'id', 'created_by_session_id');
+    }
+
+    public function client(): HasOne
+    {
+        return $this->hasOne(Client::class, 'id', 'client_id');
+    }
+}

+ 10 - 1
app/Models/Note.php

@@ -124,7 +124,16 @@ class Note extends Model
 
     public function reasons()
     {
-        return $this->hasMany(NoteReason::class, 'note_id', 'id');
+        $reasons = [];
+        for ($i = 1; $i <= 4; $i++) {
+            if($this->{'note_reason_icd' . $i}) {
+                $reason = new \stdClass();
+                $reason->code = $this->{'note_reason_icd' . $i};
+                $reason->description = $this->{'note_reason_icd' . $i . 'description'};
+                $reasons[] = $reason;
+            }
+        }
+        return $reasons;
     }
 
     public function claims()

+ 1 - 1
config/app.php

@@ -65,7 +65,7 @@ return [
 
     'hrm2_url' => env('HRM2_URL'),
 
-    'asset_version' => 78,
+    'asset_version' => 80,
 
     'temp_dir' => env('TEMP_DIR'),
 

+ 7 - 0
config/stag.php

@@ -5,6 +5,13 @@ return [
     'adminPortalUrl' => env('ADMIN_PORTAL_URL', 'https://fe.scholar.securecpu.com'),
     'backendUrl' => env('BACKEND_URL','https://scholar.securecpu.com'),
 
+    // tweak these to adjust fuzzy search match strictness
+    'fuzzySearchMinimumSimilarityScore' => [
+        'allergy' => 0.11,
+        'medication' => 0.11,
+        'problem' => 0.11,
+    ],
+
     'segmentRefreshConfig' => [
         'typeToSegments' => [
             'allergy' => [

+ 21 - 4
js-dev/click-to-copy.js

@@ -1,5 +1,5 @@
 (function() {
-    function fallbackCopyTextToClipboard(text) {
+    function fallbackCopyTextToClipboard(text, pasteTo = false) {
         var textArea = document.createElement("textarea");
         textArea.value = text;
 
@@ -17,13 +17,14 @@
             var msg = successful ? 'successful' : 'unsuccessful';
             console.log('Fallback: Copying text command was ' + msg);
             toastr.success('Copied!');
+            pasteToElement(pasteTo, text);
         } catch (err) {
             console.error('Fallback: Oops, unable to copy', err);
         }
 
         document.body.removeChild(textArea);
     }
-    function copyTextToClipboard(text) {
+    function copyTextToClipboard(text, pasteTo = false) {
         if (!navigator.clipboard) {
             fallbackCopyTextToClipboard(text);
             return;
@@ -31,17 +32,33 @@
         navigator.clipboard.writeText(text).then(function() {
             console.log('Async: Copying to clipboard was successful!');
             toastr.success('Copied!');
+            pasteToElement(pasteTo, text);
         }, function(err) {
             console.error('Async: Could not copy text: ', err);
         });
     }
+    function pasteToElement(_elem, _text) {
+        if(_elem && _elem.length) {
+            // if rte
+            if(_elem.is('.ql-container') && _elem[0].__quill) {
+                let qlRoot = _elem[0].__quill.root;
+                if($.trim($(qlRoot.innerHTML).text()) === '') {
+                    _elem[0].__quill.clipboard.dangerouslyPasteHTML(0, _text);
+                    _elem[0].__quill.root.focus();
+                }
+            }
+            else _elem.val(_text);
+        }
+    }
 
     function init() {
         $(document)
             .off('click.click-to-copy', '.click-to-copy')
             .on('click.click-to-copy', '.click-to-copy', function(event) {
-            copyTextToClipboard($(this).text());
-        });
+                let self = $(this);
+                copyTextToClipboard(self.text(),
+                    self.is('[auto-paste]') ? self.closest('form').find(self.attr('auto-paste')) : false);
+            });
         window.copyTextToClipboard = copyTextToClipboard;
     }
 

+ 1 - 1
js-dev/stag-suggest.js

@@ -20,7 +20,7 @@
             let term = elem.val();
             let ep = $(elem).attr('stag-suggest-ep'), extra = $(elem).attr('stag-suggest-extra');
             if(!!ep) { // remote lookup
-                if (!!term) {
+                if (!!term && term.length >= 2) {
 
                     $.get(ep + '?term=' + $.trim(term) + (!!extra ? '&' + extra : ''), function (_data) {
 

+ 16 - 3
public/css/style.css

@@ -430,6 +430,9 @@ body>nav.navbar {
 .mcp-theme-1 .min-width-110px {
     min-width: 110px !important;
 }
+.mcp-theme-1 .max-width-110px {
+    max-width: 110px !important;
+}
 .mcp-theme-1 .min-width-140px {
     min-width: 140px !important;
 }
@@ -2531,9 +2534,6 @@ body.in-iframe .main-row > .sidebar {
     font-weight: bold;
     background: #fff;
 }
-tr.relevant-to-visit td:nth-child(1) {
-    color: #17a2b8;
-}
 .autosave-indicator {
     display: none;
 }
@@ -3365,6 +3365,7 @@ body.forced-masking #mask {
 .stag-sheet tbody tr td {
     padding: 0;
     background: #fff;
+    cursor: text;
 }
 .stag-sheet tbody tr td input,
 .stag-sheet tbody tr td textarea {
@@ -3384,6 +3385,18 @@ body.forced-masking #mask {
 .stag-sheet tbody tr td textarea:focus-visible{
     border: 1px solid steelblue;
 }
+.mcp-theme-1 .stag-sheet .ql-container {
+    border: 0;
+}
+.mcp-theme-1 .stag-sheet .ql-editor[contenteditable] {
+    min-height: 28px;
+    border: 1px solid transparent;
+    padding: 3px;
+}
+.mcp-theme-1 .stag-sheet .ql-editor[contenteditable]:focus {
+    min-height: 28px;
+    border: 1px solid steelblue;
+}
 .note-container .summary-container p {
     margin-top: 0 !important;
     margin-bottom: 0 !important;

+ 2 - 2
resources/views/app/admin/notes_pending_summary_suggestion.blade.php

@@ -28,10 +28,10 @@
                         </td>
                         <td>{{$row->client->displayName()}}</td>
                         <td>
-                            @foreach($row->reasons as $reason)
+                            @foreach($row->reasons() as $reason)
                                 <span class="pr-2">{{$reason->code}}</span>
                             @endforeach
-                            @if(!$row->reasons || !count($row->reasons))
+                            @if(!$row->reasons() || !count($row->reasons()))
                                 -
                             @endif
                         </td>

+ 2 - 2
resources/views/app/admin/notes_rejected_summary_suggestion.blade.php

@@ -28,10 +28,10 @@
                         </td>
                         <td>{{$row->client->displayName()}}</td>
                         <td>
-                            @foreach($row->reasons as $reason)
+                            @foreach($row->reasons() as $reason)
                                 <span class="pr-2">{{$reason->code}}</span>
                             @endforeach
-                            @if(!$row->reasons || !count($row->reasons))
+                            @if(!$row->reasons() || !count($row->reasons()))
                                 -
                             @endif
                         </td>

+ 2 - 2
resources/views/app/admin/patients-table.blade.php

@@ -163,8 +163,8 @@
 													{!! $note->hcpPro && $note->is_signed_by_hcp ? '<b class="text-success">Yes</b>' : 'No' !!}
 												</td>
 												<td class="max-width-200px">
-													@if(count($note->reasons))
-														@foreach ($note->reasons as $reason)
+													@if(count($note->reasons()))
+														@foreach ($note->reasons() as $reason)
 															<div class="mb-1">
 																<span>{{ $reason->code }}</span>
 																<span class="text-secondary text-sm">{{ $reason->description}}</span>

+ 64 - 0
resources/views/app/admin/patients_missing_default_settings.blade.php

@@ -0,0 +1,64 @@
+@extends ('layouts/template')
+
+@section('content')
+<div class="p-3 mcp-theme-1" id="patients-list">
+	<div class="card border-bottom-0">
+
+		<div class="card-header px-3 py-2 d-flex align-items-center">
+			<strong class="mr-4">
+				<i class="fas fa-users"></i>
+				PatientsMissing Default Settings
+			</strong>
+		</div>
+		<div class="p-3">
+			@include('app.admin.patients_missing_defsult_settings_filters')
+		</div>
+		<table class="table table-striped p-0 m-0 table-sm border-top border-bottom ">
+			<thead class="bg-light">
+				<tr>
+					<th class="border-0">Chart #</th>
+					<th class="border-0">Patient</th>
+					<th class="border-0">MCP</th>
+					<th class="border-0">Default MCP Company Pro</th>
+					<th class="border-0">Default MCP Company Pro Payer</th>
+					<th class="border-0">Default MCP Company Location</th>
+
+				</tr>
+			</thead>
+			<tbody>
+				@foreach($patients as $patient)
+				<tr>
+					<td>
+						<a href="{{route('patients.view.settings', $patient)}}">
+							{{$patient->chart_number}}
+						</a>
+					</td>
+					<td>
+						<a href="{{route('patients.view.settings', $patient)}}">
+							{{$patient->displayName()}}
+						</a>
+					</td>
+					<td>{{ $patient->mcp ? $patient->mcp->displayName() : 'NO' }}</td>
+					<td>{{ $patient->defaultMcpCompanyPro ? $patient->defaultMcpCompanyPro->company->name : 'NO' }}</td>
+					<td>{{ $patient->defaultMcpCompanyProPayer ? $patient->defaultMcpCompanyProPayer->payer->name : 'NO' }}</td>
+					<td>{{$patient->default_mcp_company_location_id? implode(" ", [$patient->defaultMcpCompanyLocation->line1, $patient->defaultMcpCompanyLocation->city, $patient->defaultMcpCompanyLocation->state]):'NO'}}</td>
+				</tr>
+				@endforeach
+
+				@if(count($patients) === 0)
+				<tr>
+					<td colspan="6">No records found!</td>
+				</tr>
+				@endif
+			</tbody>
+
+		</table>
+	</div>
+	<div class="p-3">
+		{{$patients->withQueryString()->links()}}
+	</div>
+
+</div>
+</div>
+</div>
+@endsection

+ 145 - 0
resources/views/app/admin/patients_missing_defsult_settings_filters.blade.php

@@ -0,0 +1,145 @@
+<style>
+	#admin-patients-filters label {
+		font-weight: bold;
+	}
+
+	#admin-patients-filters .mw-100px {
+		min-width: 100px;
+	}
+	.filter-container{
+		display: flex;
+		align-items: flex-start;
+		flex-wrap: wrap;
+	}
+	.filter-container >div {
+		width: 165px;
+	}
+	.filter-container >div:not(:last-child) {
+		margin-right: 10px;
+	}
+	.sm-section {
+		width: 150px !important;
+	}
+</style>
+<form id="admin-patients-filters" method="GET" action="{{ route('admin.patientsMissingDefasultSettings') }}" class="filter-container" v-cloak>
+	<div class="sm-section">
+		<div class="">
+			<label>Name:</label>
+			<input name="name" class="form-control input-sm" v-model="filters.name">
+		</div>
+	</div>
+
+	<div class="sm-section">
+		<div class="mcp-filter-container">
+			<label>MCP:</label>
+		</div>
+	</div>
+
+	<!-- STATUS -->
+	<div class="sm-section">
+		<div class="">
+			<label>Status:</label>
+			<select name="status" class="form-control input-sm" v-model="filters.status">
+				<option value="">All</option>
+ 				<option value="ACTIVE">Active</option>
+ 				<option value="DUMMY">Test Record</option>
+ 				<option value="NO_LONGER_INTERESTED">No Longer Interested</option>
+ 				<option value="INACTIVE">Inactive</option>
+ 				<option value="ENTRY_ERROR">Entry Error</option>
+ 				<option value="DUPLICATE">Duplicate</option>
+ 				<option value="DECEASED">Deceased</option>
+ 				<option value="BAD_RECORD">Bad Record</option>
+			</select>
+		</div>
+	</div>
+
+	<div class="sm-section">
+		<div class="">
+			<label>Insurance:</label>
+			<select class="form-control"  name="insurance" v-model="filters.insurance">
+				<option value=""></option>
+				<option value="MEDICARE">Medicare (Part B)</option>
+				<option value="OTHER">Other</option>
+			</select>
+		</div>
+	</div>
+
+	<div class="sm-section">
+		<div class="">
+			<label>Chart #</label>
+			<input class="form-control"  name="chart_number" v-model="filters.chart_number">
+		</div>
+	</div>
+
+	<div class="sm-section" style="width: 185px !important;">
+		<div class="">
+			<label>Missing Default Setting(s):</label>
+			<select class="form-control"  name="missing_default_settings" v-model="filters.missing_default_settings">
+				<option value="">Any</option>
+				<option value="NO_MCP">No MCP</option>
+				<option value="NO_MCP_COMPANY_PRO">No MCP Company Pro</option>
+				<option value="NO_MCP_COMPANY_PRO_PAYER">No MCP Company Pro Payer</option>
+				<option value="NO_MCP_COMPANY_LOCATION">No MCP Company Location</option>
+			</select>
+		</div>
+	</div>
+	
+	<div>
+		<div class="">
+			<label>&nbsp;</label>
+			<div class=" d-flex">
+				<button type="button" v-on:click.prevent="doSubmit()" class="btn btn-primary btn-sm mr-2"><i class="fas fa-filter"></i> Filter</button>
+				<a href="#" v-on:click.prevent="fastLoad('{{route('admin.patientsMissingDefasultSettings')}}')" class="btn btn-link btn-sm text-danger">Clear</a>
+			</div>
+		</div>
+	</div>
+</form>
+
+<?php
+$loadedFilters = $filters;
+$allFilterKeys = [
+	'name',	
+	'status',
+	'insurance',
+	'chart_number',
+	'missing_default_settings'
+];
+for ($i=0; $i < count($allFilterKeys); $i++) {
+	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {
+		$loadedFilters[$allFilterKeys[$i]] = '';
+	}
+}
+?>
+<script>
+	(function() {
+		function init() {
+			new Vue({
+				el: '#admin-patients-filters',
+				delimiters: ['@{{', '}}'],
+				data: {
+					filters: <?= json_encode($loadedFilters) ?>
+				},
+				methods: {
+					init: function() {
+
+					},
+					doSubmit: function() {
+						fastLoad("{{ route('admin.patientsMissingDefasultSettings') }}?" + $('#admin-patients-filters').serialize());
+						return false;
+					}
+				},
+				mounted: function() {
+					console.log(this.filters);
+					this.init();
+
+					let mcpSelect = $('<select name="mcp" class="form-control min-width-unset input-sm" provider-search data-pro-uid="{{request()->input("mcp")}}" provider-type="hcp"><option value="">--select--</option></select>').appendTo('.mcp-filter-container');
+					let naSelect = $('<select name="na" class="form-control min-width-unset input-sm" provider-search data-pro-uid="{{request()->input("na")}}" provider-type="non-hcp"><option value="">--select--</option></select>').appendTo('.na-filter-container');
+					initProSuggest();
+				},
+			});
+
+
+		}
+		addMCInitializer('admin-patients-filters', init, '#admin-patients-filters');
+	})();
+</script>

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

@@ -339,7 +339,7 @@
                             <div id="mcp-dashboard-appointments" class="mb-4">
 
                             </div>
-                            @if($performer->pro->can_view_rm_matrix || $performer->pro->pro_type=='ADMIN')
+                            {{--@if($performer->pro->can_view_rm_matrix || $performer->pro->pro_type=='ADMIN')
                             <div class="card mb-4">
                                 <div class="card-header pl-2">
                                     <strong>
@@ -350,7 +350,7 @@
                                     @include('app.practice-management.remote-monitoring-tree')
                                 </div>
                             </div>
-                            @endif
+                            @endif--}}
                             <div class="card mb-4">
                                 <div class="card-header pl-2">
                                     <strong>

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

@@ -5,7 +5,7 @@
     <meta charset="UTF-8">
     <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
-    <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
+    <script src="/js/jquery-3.5.1.min.js"></script>
     <link href="/css/app.css?v={{config('app.asset_version')}}" rel="stylesheet">
     <link href="/css/style.css?v={{config('app.asset_version')}}" rel="stylesheet">
     <link href="/v-splitter-px/v-splitter.css?v={{config('app.asset_version')}}" rel="stylesheet" >

+ 2 - 2
resources/views/app/mcp/notes_pending_billing.blade.php

@@ -21,10 +21,10 @@
                         </td>
                         <td>{{$row->client->displayName()}}</td>
                         <td>
-                            @foreach($row->reasons as $reason)
+                            @foreach($row->reasons() as $reason)
                                 <span class="pr-2">{{$reason->code}}</span>
                             @endforeach
-                            @if(!$row->reasons || !count($row->reasons))
+                            @if(!$row->reasons() || !count($row->reasons()))
                                 -
                             @endif
                         </td>

+ 2 - 2
resources/views/app/mcp/notes_pending_signature.blade.php

@@ -28,10 +28,10 @@
                         </td>
                         <td>{{$row->client->displayName()}}</td>
                         <td>
-                            @foreach($row->reasons as $reason)
+                            @foreach($row->reasons() as $reason)
                                 <span class="pr-2">{{$reason->code}}</span>
                             @endforeach
-                            @if(!$row->reasons || !count($row->reasons))
+                            @if(!$row->reasons() || !count($row->reasons()))
                                 -
                             @endif
                         </td>

+ 2 - 2
resources/views/app/mcp/notes_pending_summary_suggestion.blade.php

@@ -28,10 +28,10 @@
                         </td>
                         <td>{{$row->client->displayName()}}</td>
                         <td>
-                            @foreach($row->reasons as $reason)
+                            @foreach($row->reasons() as $reason)
                                 <span class="pr-2">{{$reason->code}}</span>
                             @endforeach
-                            @if(!$row->reasons || !count($row->reasons))
+                            @if(!$row->reasons() || !count($row->reasons()))
                                 -
                             @endif
                         </td>

+ 2 - 2
resources/views/app/mcp/notes_rejected_summary_suggestion.blade.php

@@ -28,10 +28,10 @@
                         </td>
                         <td>{{$row->client->displayName()}}</td>
                         <td>
-                            @foreach($row->reasons as $reason)
+                            @foreach($row->reasons() as $reason)
                                 <span class="pr-2">{{$reason->code}}</span>
                             @endforeach
-                            @if(!$row->reasons || !count($row->reasons))
+                            @if(!$row->reasons() || !count($row->reasons()))
                                 -
                             @endif
                         </td>

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

@@ -178,13 +178,15 @@ foreach ($days as $k => $day) {
             @if($mIndex === 0)
                 <td rowspan="{{count($days[$k])}}" class="px-2">
                     @if($performerRole === 'ADMIN')
-                        <div class="my-1">
-                            <span class="text-secondary">MCP Unstamped:</span>
-                            <b class="{{count($unstampedMCP[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedMCP[$k])}}</b>
-                        </div>
-                        <div class="">
-                            <span class="text-secondary">Non-HCP Unstamped:</span>
-                            <b class="{{count($unstampedNonHCP[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedNonHCP[$k])}}</b>
+                        <div class="d-flex align-items-center flex-wrap">
+                            <div class="mr-2">
+                                <span class="text-secondary">MCP Unstamped:</span>
+                                <b class="{{count($unstampedMCP[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedMCP[$k])}}</b>
+                            </div>
+                            <div class="">
+                                <span class="text-secondary">Non-HCP Unstamped:</span>
+                                <b class="{{count($unstampedNonHCP[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedNonHCP[$k])}}</b>
+                            </div>
                         </div>
                     @elseif($performerRole === 'MCP')
                         @if(count($unstampedMCP[$k]))

+ 9 - 7
resources/views/app/patient/care-month/_work_matrix.blade.php

@@ -202,13 +202,15 @@ $days = $daysWithUnstamped;
                 @if($mIndex === 0)
                     <td rowspan="{{count($days[$k])}}" class="px-2">
                         @if($performerRole === 'ADMIN')
-                            <div class="my-1">
-                                <span class="text-secondary">MCP Unstamped:</span>
-                                <b class="{{count($unstampedMCP[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedMCP[$k])}}</b>
-                            </div>
-                            <div class="">
-                                <span class="text-secondary">RMM Unstamped:</span>
-                                <b class="{{count($unstampedRMM[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedRMM[$k])}}</b>
+                            <div class="d-flex align-items-center flex-wrap">
+                                <div>
+                                    <span class="text-secondary">MCP Unstamped:</span>
+                                    <b class="{{count($unstampedMCP[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedMCP[$k])}}</b>
+                                </div>
+                                <div class="">
+                                    <span class="text-secondary">RMM Unstamped:</span>
+                                    <b class="{{count($unstampedRMM[$k]) ? '' : 'text-secondary font-weight-normal'}}">{{count($unstampedRMM[$k])}}</b>
+                                </div>
                             </div>
                             <div class="text-sm text-secondary">Only the MCP or RMM can stamp-all!</div>
                         @elseif($performerRole === 'MCP')

+ 80 - 0
resources/views/app/patient/care-month/care-month-update-mcp-onboarding-visit-info.blade.php

@@ -0,0 +1,80 @@
+<div moe>
+	<a start show>Update</a>
+	<form url="/api/client/updateMcpOnboardingVisitInfo" class="mcp-theme-1">
+		<input type="hidden" name="uid" value="{{$patient->uid}}">
+		<div id="updateMcpOnboardingVisit" v-cloak>
+		<div class="mb-2">
+			<select name="hasMcpDoneOnboardingVisit" class="form-control form-control-sm" onchange="toggleDisabledAsNeeded(this, 'YES', 'if-visit-done')"  v-model="form.hasMcpDoneOnboardingVisit">
+				<option value="">-- Select Status --</option>
+				<option value="YES" {{ $patient->has_mcp_done_onboarding_visit === 'YES' ? 'selected' : '' }}>YES</option>
+				<option value="NO" {{ $patient->has_mcp_done_onboarding_visit === 'NO' ? 'selected' : '' }}>NO</option>
+				<option value="UNKNOWN" {{ $patient->has_mcp_done_onboarding_visit === 'UNKNOWN' ? 'selected' : '' }}>UNKNOWN</option>
+			</select>
+		</div>
+		<div class="mb-2">
+			<input type="date" class="if-visit-done form-control form-control-sm" disabled name="mcpOnboardingVisitDate" max="{{ date('Y-m-d') }}">
+		</div>
+		<div class="mb-2">
+			<select name="mcpOnboardingVisitNoteUid" disabled class="form-control form-control-sm if-visit-done" onchange="toggleVisibilityAsNeeded(this, '', 'if-note-outside-system')">
+				<option value="">-- Visit Note --</option>
+				<?php $notes = \App\Models\Note::where('client_id', $patient->id)->get() ?>
+				@foreach ($notes as $note)
+				@if(!empty($note->title) && $note->client_id === $patient->id && !$note->is_cancelled)
+				<option value="{{$note->uid}}">{{$note->hcpPro->displayName()}} ({{friendly_date_time($note->effective_dateest, false)}})</option>
+				@endif
+				@endforeach
+			</select>
+		</div>
+		<div class="mb-2 if-note-outside-system">
+			<textarea class="form-control form-control-sm" name="reasonOnboardingVisitNoteOutsideSystem" placeholder="Visit note outside the system reason"></textarea>
+		</div>
+		</div>
+		<div>
+			<button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+			<button cancel class="btn btn-sm btn-default border">Cancel</button>
+		</div>
+	</form>
+</div>
+
+
+<script>
+	var updateMcpOnboardingVisit = new Vue({
+		el:'#updateMcpOnboardingVisit',
+		data:{
+			form:{
+				hasMcpDoneOnboardingVisit: '{{ $patient->has_mcp_done_onboarding_visit }}'
+			},
+			showEnterInfoAlert: false
+		},
+		methods:{
+			initValidation: function(){
+				var self= this;
+				var fields = $('[name=mcpOnboardingVisitNoteUid], [name=reasonOnboardingVisitNoteOutsideSystem]');
+				if(self.form.hasMcpDoneOnboardingVisit == 'YES'){					
+					fields.prop('required', true);
+					fields.on('change keyup', function(){
+						fields.prop('required', false);
+						$(this).prop('required', true);
+					});
+					self.showEnterInfoAlert = true;
+				}else{
+					fields.prop('required', false);
+					self.showEnterInfoAlert = false;
+				}
+			},
+			init: function(){
+				this.initValidation();
+			}
+		},
+		mounted: function(){
+			this.init();
+		},
+		updated: function(){
+			var self = this;
+
+			self.$nextTick(function(){
+				self.initValidation();
+			});
+		}
+	});
+</script>

+ 1 - 41
resources/views/app/patient/care-month/dashboard.blade.php

@@ -46,47 +46,7 @@
                             <i class="fa fa-exclamation-triangle"></i>
                             MCP Onboarding Visit Pending
                         </span>
-                        <div moe>
-                            <a start show>Update</a>
-                            <form url="/api/client/updateMcpOnboardingVisitInfo" class="mcp-theme-1">
-                                <input type="hidden" name="uid" value="{{$patient->uid}}">
-                                <div class="mb-2">
-                                    <select name="hasMcpDoneOnboardingVisit"
-                                            class="form-control form-control-sm"
-                                            onchange="toggleDisabledAsNeeded(this, 'YES', 'if-visit-done')">
-                                        <option value="">-- Select Status --</option>
-                                        <option value="YES" {{ $patient->has_mcp_done_onboarding_visit === 'YES' ? 'selected' : '' }}>YES</option>
-                                        <option value="NO" {{ $patient->has_mcp_done_onboarding_visit === 'NO' ? 'selected' : '' }}>NO</option>
-                                        <option value="UNKNOWN" {{ $patient->has_mcp_done_onboarding_visit === 'UNKNOWN' ? 'selected' : '' }}>UNKNOWN</option>
-                                    </select>
-                                </div>
-                                <div class="mb-2">
-                                    <input type="date" class="if-visit-done form-control form-control-sm" disabled name="mcpOnboardingVisitDate" max="{{ date('Y-m-d') }}">
-                                </div>
-                                <div class="mb-2">
-                                    <select name="mcpOnboardingVisitNoteUid" disabled
-                                            class="form-control form-control-sm if-visit-done"
-                                            onchange="toggleVisibilityAsNeeded(this, '', 'if-note-outside-system')">
-                                        <option value="">-- Visit Note --</option>
-                                        <?php $notes = \App\Models\Note::where('client_id', $patient->id)->get() ?>
-                                        @foreach ($notes as $note)
-                                            @if(!empty($note->title) && $note->client_id === $patient->id && !$note->is_cancelled)
-                                                <option value="{{$note->uid}}">{{$note->hcpPro->displayName()}} ({{friendly_date_time($note->effective_dateest, false)}})</option>
-                                            @endif
-                                        @endforeach
-                                    </select>
-                                </div>
-                                <div class="mb-2 if-note-outside-system">
-                                    <textarea class="form-control form-control-sm"
-                                              name="reasonOnboardingVisitNoteOutsideSystem"
-                                              placeholder="Visit note outside the system reason"></textarea>
-                                </div>
-                                <div>
-                                    <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                                    <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                                </div>
-                            </form>
-                        </div>
+                        @include('app.patient.care-month.care-month-update-mcp-onboarding-visit-info')
                     </div>
                 </div>
             </h6>

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

@@ -2,6 +2,6 @@
     <span class="mr-2">RM Reasons:</span>
     @include('app.patient.partials.put-rm-reasons', ['recordType' => 'CARE_MONTH', 'record' => $careMonth])
 </div>
-<div class="">
-@include('app.patient.partials.rm-reasons-display', ['recordType' => 'CARE_MONTH', 'record' => $careMonth])
+<div class="pl-3">
+    @include('app.patient.partials.rm-reasons-display', ['recordType' => 'CARE_MONTH', 'record' => $careMonth])
 </div>

+ 1 - 1
resources/views/app/patient/coverage_column_renderer.blade.php

@@ -7,7 +7,7 @@
     @if($coverageStatus === 'YES')
         <i class="fa fa-check-circle text-success"></i>
     @elseif($coverageStatus === 'NO')
-        @if(!$coverage->manual_determination_category)
+        @if($coverage && !$coverage->manual_determination_category)
             <i class="fas fa-hourglass-half text-warning" title="Pending Validation"></i>
         @else
             <i class="fa fa-times text-danger"></i>

+ 68 - 9
resources/views/app/patient/medications-reconcile.blade.php

@@ -65,16 +65,14 @@ $medications = $points;
             ?>
             <tr>
                 <td class="bg-light font-weight-bold">
-                    {{$medication->data->name}}
+                    <span class="" if-active>{{$medication->data->name}}</span>
+                    <span class="text-secondary on-hover-opaque d-none" if-historic>{{$medication->data->name}}</span>
                     <div class="d-block font-weight-normal">
                         <div class="d-flex align-items-baseline">
                             <span class="text-secondary mr-1">Active:</span>
-                            @if($medication->is_removed)
-                                <span class="text-secondary">No</span>
-                            @else
-                                <span class="text-success">Yes</span>
-                            @endif
-                            <div moe class="ml-2">
+                            <span class="text-success font-weight-bold" if-active>Yes</span>
+                            <span class="text-warning-mellow font-weight-bold d-none" if-historic>No</span>
+                            <div moe class="ml-2" if-active>
                                 <a href="#" start show>Mark {{$medication->is_removed ? 'Active' : 'Historic'}}</a>
                                 <form url="/api/visitPoint/updateTopLevel" no-auto-focus class="mcp-theme-1">
                                     <p class="mb-2">Mark medication as {{$medication->is_removed ? 'Active' : 'Historic'}}</p>
@@ -82,7 +80,20 @@ $medications = $points;
                                     <input type="hidden" name="noteUid" value="{{$note->uid}}">
                                     <input type="hidden" name="isRemoved" value="{{$medication->is_removed ? '0' : '1'}}">
                                     <div>
-                                        <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+                                        <button type="button" class="btn-mark-historic btn btn-sm btn-primary mr-2">Save</button>
+                                        <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
+                                    </div>
+                                </form>
+                            </div>
+                            <div moe class="ml-2 d-none" if-historic>
+                                <a href="#" start show>Mark as Active</a>
+                                <form url="/api/visitPoint/updateTopLevel" no-auto-focus class="mcp-theme-1">
+                                    <p class="mb-2">Mark medication as Active</p>
+                                    <input type="hidden" name="uid" value="{{$medication->uid}}">
+                                    <input type="hidden" name="noteUid" value="{{$note->uid}}">
+                                    <input type="hidden" name="isRemoved" value="0">
+                                    <div>
+                                        <button type="button" class="btn-mark-active btn btn-sm btn-primary mr-2">Save</button>
                                         <button cancel class="btn btn-sm bg-light btn-default border">Cancel</button>
                                     </div>
                                 </form>
@@ -137,7 +148,20 @@ $medications = $points;
                                 }
                             }
                         }
-                    }
+                    },
+                    formats: [
+                        'bold',
+                        'italic',
+                        'link',
+                        'size',
+                        'strike',
+                        'underline',
+                        'blockquote',
+                        'header',
+                        'indent',
+                        'list',
+                        'align',
+                    ]
                 });
                 quill.root.innerHTML = existingContent;
                 $(quill.container)
@@ -215,6 +239,41 @@ $medications = $points;
                     });
 
                 });
+
+            $('#medications-reconcile-{{$note->id}} .btn-mark-historic')
+                .off('click')
+                .on('click', function() {
+                    showMask();
+                    let form = $(this).closest('form'), row = $(this).closest('tr');
+                    $.post(form.attr('url'), form.serialize(), _data => {
+                        if(!hasResponseError(_data)) {
+                            row.find('[if-active], [if-historic]').addClass('d-none');
+                            row.find('[if-historic]').removeClass('d-none');
+                        }
+                    }, 'json').then(() => {
+                        $('[moe] form').hide();
+                        hideMask();
+                    });
+                    return false;
+                });
+
+            $('#medications-reconcile-{{$note->id}} .btn-mark-active')
+                .off('click')
+                .on('click', function() {
+                    showMask();
+                    let form = $(this).closest('form'), row = $(this).closest('tr');
+                    $.post(form.attr('url'), form.serialize(), _data => {
+                        if(!hasResponseError(_data)) {
+                            row.find('[if-active], [if-historic]').addClass('d-none');
+                            row.find('[if-active]').removeClass('d-none');
+                        }
+                    }, 'json').then(() => {
+                        $('[moe] form').hide();
+                        hideMask();
+                    });
+                    return false;
+                });
+
             __initRTEs($('#medications-reconcile-{{$note->id}} [note-rte]'))
         }
         addMCInitializer('medications-reconcile-{{$note->id}}', init, '#medications-reconcile-{{$note->id}}')

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/allergy/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/behavior/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/care_team_member/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/exercise/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/goal/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/medication/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/nutrition/plan.blade.php

@@ -16,9 +16,9 @@
                 <?php $j = 0; foreach ($points as $point): $j++; ?>
                 <?php $rel = $point->relevanceToNote($note); ?>
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 2 - 2
resources/views/app/patient/module-specific-summary-renderers/problem/plan.blade.php

@@ -17,9 +17,9 @@
                 <?php $rel = $point->relevanceToNote($note); ?>
 		
                 <tr>
-                    <td class="width-30px text-right pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
+                    <td class="width-22px pr-1 pl-0 {{ $rel ? ' text-info':'' }}">
                         @if($rel)
-                            *{{ $j }}.
+                            {{ $j }}.
                         @else
                             {{ $j }}.
                         @endif

+ 12 - 1
resources/views/app/patient/note/_create-claim.blade.php

@@ -5,7 +5,7 @@
     <span class="text-warning-mellow font-weight-bold">
         <i class="fa fa-exclamation-triangle"></i>
         Please sign off on the comprehensive care plan before creating claims.
-    </span>
+    </span> 
 @else
     <span class="mx-2 text-secondary">|</span>
     <a href="#" onclick="return showStagPopup('create-claim')">Create Claim</a>
@@ -126,6 +126,17 @@
         </div>
     </form>
 </div>
+<script>
+    window.noteReasons = [];
+    @if(count($note->reasons()))
+    @foreach($note->reasons() as $reason)
+    window.noteReasons.push({
+        code: '{{$reason->code}}',
+        description: '{{$reason->description}}'
+    });
+    @endforeach
+    @endif
+</script>
 <script>
     window.createClaimApp = new Vue({
         el: '#createClaimApp',

+ 4 - 4
resources/views/app/patient/note/_create-note-reason.blade.php

@@ -1,7 +1,7 @@
 <script>
     window.noteReasons = [];
-    @if(count($note->reasons))
-        @foreach($note->reasons as $reason)
+    @if(count($note->reasons()))
+        @foreach($note->reasons() as $reason)
         window.noteReasons.push({
             code: '{{$reason->code}}',
             description: '{{$reason->description}}'
@@ -22,8 +22,8 @@
                 </tr>
             </thead>
             <tbody>
-                @if(count($note->reasons))
-                @foreach($note->reasons as $reason)
+                @if(count($note->reasons()))
+                @foreach($note->reasons() as $reason)
                 <tr class="data-row">
                     <td><input type="text" class="form-control note-reason-icd" data-index="{{$loop->index}}" id="icd_{{$loop->index}}" name="noteReasonDTOs[{{$loop->index}}].code" value="{{$reason->code}}"></td>
                     <td><input type="text" class="form-control note-reason-description" data-index="{{$loop->index}}" id="description_{{$loop->index}}" name="noteReasonDTOs[{{$loop->index}}].description" value="{{$reason->description}}"></td>

+ 46 - 10
resources/views/app/patient/note/dashboard-bu-b4-pure-soap.blade.php

@@ -1031,20 +1031,56 @@
                     <div class="">
                         <div class="d-flex align-items-center mb-2">
                             <p class="font-weight-bold text-secondary m-0 mr-2">ICDs</p>
-                            @include('app/patient/note/_create-note-reason')
+                            @include('app.patient.partials.put-rm-reasons', ['recordType' => 'NOTE', 'record' => $note])
                         </div>
+                        <?php
+                            $noteICDData = [
+                                'icd_1' => [
+                                    'title' => 'ICD 1',
+                                    'reason' => $note->note_reason_icd1,
+                                    'description' => $note->note_reason_icd1description
+                                ],
+                                'icd_2' => [
+                                    'title' => 'ICD 2',
+                                    'reason' => $note->note_reason_icd2,
+                                    'description' => $note->note_reason_icd2description
+                                ],
+                                'icd_3' => [
+                                    'title' => 'ICD 3',
+                                    'reason' => $note->note_reason_icd3,
+                                    'description' => $note->note_reason_icd3description
+                                ],
+                                'icd_4' => [
+                                    'title' => 'ICD 4',
+                                    'reason' => $note->note_reason_icd4,
+                                    'description' => $note->note_reason_icd4description
+                                ],
+                            ];
+                        ?>
                         <div class="d-flex align-items-start flex-wrap">
-                        @if(count($note->reasons))
-                             @foreach ($note->reasons as $reason)
-                                <span class="badge badge-info p-2 mb-2 mr-2">
-                                    {{ $reason->description}} ({{ $reason->code }})
-                                </span>
-                            @endforeach
-                        @else
-                            <div class="alert alert-info position-static">No note reasons</div>
-                        @endif
+                            <?php $emptyNoteICDs = true; ?>
+                                @foreach ($noteICDData as $noteICDKey => $noteICD)
+                                    <?php 
+                                        $emptyICD = true;
+                                        if(!empty($noteICD['reason']) || !empty($noteICD['description'])){
+                                            $emptyNoteICDs = false;
+                                            $emptyICD = false;
+                                        }
+                                    ?>
+                                    @if(!$emptyICD)
+                                    <span class="badge badge-info px-2 mb-1 mr-2">{{$noteICD['reason']}} @if(!empty($noteICD['description']))({{ $noteICD['description'] }})@endif</span>
+                                    @endif
+                                @endforeach
+                            @if($emptyNoteICDs)
+                                <small class="text-dark">-</small>
+                            @endif
                         </div>
                     </div>
+                    @if(!empty($note->note_reason_memo))
+                        <div style="padding-left: 60px;">
+                            <small><b>Reason:</b> {{ $note->note_reason_memo }}</small>
+                        </div>
+                    @endif
                 </div>
 
                 @if($pro->pro_type === 'ADMIN')

+ 44 - 8
resources/views/app/patient/note/dashboard-univ.blade.php

@@ -864,20 +864,56 @@
                             <div class="">
                                 <div class="d-flex align-items-center mb-2">
                                     <p class="font-weight-bold text-secondary m-0 mr-2">ICDs</p>
-                                    @include('app/patient/note/_create-note-reason')
+                                    @include('app.patient.partials.put-rm-reasons', ['recordType' => 'NOTE', 'record' => $note])
                                 </div>
+                                <?php
+                                    $noteICDData = [
+                                        'icd_1' => [
+                                            'title' => 'ICD 1',
+                                            'reason' => $note->note_reason_icd1,
+                                            'description' => $note->note_reason_icd1description
+                                        ],
+                                        'icd_2' => [
+                                            'title' => 'ICD 2',
+                                            'reason' => $note->note_reason_icd2,
+                                            'description' => $note->note_reason_icd2description
+                                        ],
+                                        'icd_3' => [
+                                            'title' => 'ICD 3',
+                                            'reason' => $note->note_reason_icd3,
+                                            'description' => $note->note_reason_icd3description
+                                        ],
+                                        'icd_4' => [
+                                            'title' => 'ICD 4',
+                                            'reason' => $note->note_reason_icd4,
+                                            'description' => $note->note_reason_icd4description
+                                        ],
+                                    ];
+                                ?>
                                 <div class="d-flex align-items-start flex-wrap">
-                                    @if(count($note->reasons))
-                                        @foreach ($note->reasons as $reason)
-                                            <span class="badge badge-info p-2 mb-2 mr-2">
-                                    {{ $reason->description}} ({{ $reason->code }})
-                                </span>
+                                    <?php $emptyNoteICDs = true; ?>
+                                        @foreach ($noteICDData as $noteICDKey => $noteICD)
+                                            <?php 
+                                                $emptyICD = true;
+                                                if(!empty($noteICD['reason']) || !empty($noteICD['description'])){
+                                                    $emptyNoteICDs = false;
+                                                    $emptyICD = false;
+                                                }
+                                            ?>
+                                            @if(!$emptyICD)
+                                            <span class="badge badge-info px-2 mb-1 mr-2">{{$noteICD['reason']}} @if(!empty($noteICD['description']))({{ $noteICD['description'] }})@endif</span>
+                                            @endif
                                         @endforeach
-                                    @else
-                                        <div class="alert alert-info">No note reasons</div>
+                                    @if($emptyNoteICDs)
+                                        <small class="text-dark">-</small>
                                     @endif
                                 </div>
                             </div>
+                            @if(!empty($note->note_reason_memo))
+                                <div style="padding-left: 60px;">
+                                    <small><b>Reason:</b> {{ $note->note_reason_memo }}</small>
+                                </div>
+                            @endif
                         </div>
                         @if($pro->pro_type === 'ADMIN')
                             <div class="p-3 border-bottom screen-only">

+ 54 - 14
resources/views/app/patient/note/dashboard.blade.php

@@ -1078,24 +1078,60 @@ use App\Models\Handout;
                     </script>
                 </div>
 
-                <div class="p-2 border-bottom" data-non-segment-section="ICDs">
+                <div class="px-2 pt-2 pb-1 border-bottom" data-non-segment-section="ICDs">
                     <div class="d-flex alignt-items-start">
-                        <div class="d-flex {{ count($note->reasons) > 2 ? '':'align-items-center' }} mr-2">
+                        <div class="d-flex mr-2">
                             <p class="font-weight-bold text-secondary m-0 mr-2">ICDs</p>
-                            @include('app/patient/note/_create-note-reason')
+                            @include('app.patient.partials.put-rm-reasons', ['recordType' => 'NOTE', 'record' => $note])
                         </div>
+                        <?php
+                            $noteICDData = [
+                                'icd_1' => [
+                                    'title' => 'ICD 1',
+                                    'reason' => $note->note_reason_icd1,
+                                    'description' => $note->note_reason_icd1description
+                                ],
+                                'icd_2' => [
+                                    'title' => 'ICD 2',
+                                    'reason' => $note->note_reason_icd2,
+                                    'description' => $note->note_reason_icd2description
+                                ],
+                                'icd_3' => [
+                                    'title' => 'ICD 3',
+                                    'reason' => $note->note_reason_icd3,
+                                    'description' => $note->note_reason_icd3description
+                                ],
+                                'icd_4' => [
+                                    'title' => 'ICD 4',
+                                    'reason' => $note->note_reason_icd4,
+                                    'description' => $note->note_reason_icd4description
+                                ],
+                            ];
+                        ?>
                         <div class="d-flex align-items-start flex-wrap">
-                        @if(count($note->reasons))
-                             @foreach ($note->reasons as $reason)
-                                <span class="badge badge-info p-2 mb-1 mr-2">
-                                    {{ $reason->description}} ({{ $reason->code }})
-                                </span>
-                            @endforeach
-                        @else
-                            <div class="alert alert-info position-static">No note reasons</div>
-                        @endif
-                        </div>
+                            <?php $emptyNoteICDs = true; ?>
+                                @foreach ($noteICDData as $noteICDKey => $noteICD)
+                                    <?php 
+                                        $emptyICD = true;
+                                        if(!empty($noteICD['reason']) || !empty($noteICD['description'])){
+                                            $emptyNoteICDs = false;
+                                            $emptyICD = false;
+                                        }
+                                    ?>
+                                    @if(!$emptyICD)
+                                        <span class="badge badge-info px-2 mb-1 mr-2">{{$noteICD['reason']}} @if(!empty($noteICD['description']))({{ $noteICD['description'] }})@endif</span>
+                                    @endif
+                                @endforeach
+                            @if($emptyNoteICDs)
+                                <small class="text-dark">-</small>
+                            @endif
+                        </div>                        
                     </div>
+                    @if(!empty($note->note_reason_memo))
+                        <div style="padding-left: 60px;">
+                            <small><b>Reason:</b> {{ $note->note_reason_memo }}</small>
+                        </div>
+                    @endif
                 </div>
 
                 @if($pro->pro_type === 'ADMIN')
@@ -1488,7 +1524,10 @@ use App\Models\Handout;
                                             </form>
                                         </div>
                                     @endif
-
+                                    <div>
+                                        @include('app.patient.note.flag-bill')
+                                    </div>
+                                    
                                 </td>
                                 <td class="pr-3 screen-only">
                                     @if($bill->has_hcp_been_paid)
@@ -1993,6 +2032,7 @@ use App\Models\Handout;
                                             </span>
                                         @endif
                                     </div>
+                                    @include('app.patient.note.flag-bill')
                                 </td>
                             </tr>
                         @endforeach

+ 200 - 0
resources/views/app/patient/note/flag-bill.blade.php

@@ -0,0 +1,200 @@
+<div <?= $bill->is_flagged_by_administrator && !$bill->is_administrator_flag_cleared ? 'class="alert alert-danger p-1 rounded-0" style="min-width: 380px;"' : '' ?>>
+<?php #dump($bill); ?>
+@if($pro->pro_type === 'ADMIN')
+	@if($bill->is_flagged_by_administrator && !$bill->is_administrator_flag_cleared)
+		<div class="d-flex flex-column">
+			<div class="d-flex align-items-center flex-wrap">
+				<span class="mr-2"><b>Flagged At:</b> {{ friendly_date_time($bill->flagged_administrator_at) }}</span>
+				<small class="text-sm">By: <i class="fas fa-user"></i> {{ $bill->billFlagAcknowledgedByProAdmin->displayName() }}</small>
+			</div>
+			
+			<small class="text-muted"><b><i class="fas fa-comment on-hover-opaque text-primary"></i></b> {{ $bill->administrator_flag_memo }}</small>
+		</div>
+
+		@if($bill->is_administrator_flag_acknowledged && $bill->administrator_flag_acknowledged_at > $bill->flagged_administrator_at)
+			<!-- This is resolved -->
+			<div class="border-top mt-1 pt-1" style="border-color: #f3bcc1!important;">
+				<div class="d-flex flex-column">
+					<div class="d-flex align-items-center flex-wrap">
+						<span class="mr-2"><b>Ack. At:</b> {{ friendly_date_time($bill->administrator_flag_acknowledged_at) }}</span>
+						<small class="text-sm">By: <i class="fas fa-user"></i> {{ $bill->billFlagAcknowledgedByPro->displayName() }}</small>
+					</div>
+					
+					<small class="text-muted"><b><i class="fas fa-comment on-hover-opaque"></i></b> {{ $bill->administrator_flag_acknowledgement_memo }}</small>
+				</div>
+			</div>
+		@endif
+			<!-- Flagged by admin, pending ack. by pro -->
+			<div class="border-top mt-1 pt-1" style="border-color: #f3bcc1!important;">
+				<div class="d-flex">
+					@if($bill->is_administrator_flag_acknowledged)
+						<div moe>
+							<a start show class="text-success"><i class="fas fa-flag  on-hover-opaque"></i> Clear Flag</a>
+							<form url="/api/bill/clearFlag" class="mcp-theme-1">
+								<input type="hidden" name="uid" value="{{$bill->uid}}">
+								<div class="form-group">
+									<label>Memo:</label>
+									<textarea name="memo" rows="2" class="form-control"></textarea>
+								</div>
+								<div>
+									<button submit class="btn btn-sm btn-success mr-1">Clear Flag</button>
+									<button cancel class="btn btn-sm btn-default border">Cancel</button>
+								</div>
+							</form>
+						</div>
+					@else
+						<div moe>
+							<a start show class="text-success"><i class="fas fa-flag  on-hover-opaque"></i> Unflag Bill</a>
+							<form url="/api/bill/undoFlagAsAdministrator" class="mcp-theme-1">
+								<input type="hidden" name="uid" value="{{$bill->uid}}">
+								<div class="form-group">
+									<label>Memo:</label>
+									<textarea name="memo" rows="2" class="form-control"></textarea>
+								</div>
+								<div>
+									<button submit class="btn btn-sm btn-success mr-1">Unflag Bill</button>
+									<button cancel class="btn btn-sm btn-default border">Cancel</button>
+								</div>
+							</form>
+						</div>
+					@endif
+					<span class="mx-1 text-muted">|</span>
+					@if($bill->is_administrator_flag_acknowledged)
+						<div moe>
+							<a start show class="text-danger"><i class="fas fa-flag  on-hover-opaque"></i> Flag Bill Again</a>
+							<form url="/api/bill/flagAsAdministrator" class="mcp-theme-1">
+								<input type="hidden" name="uid" value="{{$bill->uid}}">
+								<div class="form-group">
+									<label>Memo:</label>
+									<textarea name="memo" rows="2" class="form-control" required></textarea>
+								</div>
+								<div>
+									<button submit class="btn btn-sm btn-danger mr-1">Flag Bill</button>
+									<button cancel class="btn btn-sm btn-default border">Cancel</button>
+								</div>
+							</form>
+						</div>
+					@else
+						<div moe>
+							<a start show class="text-primary">Update Memo</a>
+							<form url="/api/bill/updateFlagMemo" class="mcp-theme-1">
+								<input type="hidden" name="uid" value="{{$bill->uid}}">
+								<div class="form-group">
+									<label>Memo:</label>
+									<textarea name="memo" rows="2" class="form-control"><?= $bill->administrator_flag_memo ?></textarea>
+								</div>
+								<div>
+									<button submit class="btn btn-sm btn-primary mr-1">Update</button>
+									<button cancel class="btn btn-sm btn-default border">Cancel</button>
+								</div>
+							</form>
+						</div>
+					@endif
+					<span class="ml-1 text-muted">|</span>
+					@include('app.patient.note.partials.bill-flags-history')
+				</div>
+			</div>
+		
+	@else
+		<!-- Not flagged, show flag popup -->
+		<!-- //api/bill//flagAsAdministrator -->
+		<div class="d-flex align-items-center">
+			<div moe>
+				<a start show class="text-danger"><i class="fas fa-flag  on-hover-opaque"></i> Flag Bill</a>
+				<form url="/api/bill/flagAsAdministrator" class="mcp-theme-1">
+					<input type="hidden" name="uid" value="{{$bill->uid}}">
+					<div class="form-group">
+						<label>Memo:</label>
+						<textarea name="memo" rows="2" class="form-control" required></textarea>
+					</div>
+					<div>
+						<button submit class="btn btn-sm btn-danger mr-1">Flag Bill</button>
+						<button cancel class="btn btn-sm btn-default border">Cancel</button>
+					</div>
+				</form>
+			</div>
+			@include('app.patient.note.partials.bill-flags-history')
+		</div>
+		
+	@endif
+
+@else
+<!-- HCP -->
+	@if($bill->is_flagged_by_administrator && !$bill->is_administrator_flag_cleared)
+		<div class="d-flex flex-column">
+			<div class="d-flex align-items-center flex-wrap">
+				<span class="mr-2"><b>Flagged At:</b> {{ friendly_date_time($bill->flagged_administrator_at) }}</span>
+				<small class="text-sm">By: <i class="fas fa-user"></i> {{ $bill->billFlagAcknowledgedByProAdmin->displayName() }}</small>
+			</div>			
+			<small class="text-muted"><b><i class="fas fa-comment on-hover-opaque text-primary"></i></b> {{ $bill->administrator_flag_memo }}</small>
+		</div>
+
+		@if($bill->is_administrator_flag_acknowledged && $bill->administrator_flag_acknowledged_at > $bill->flagged_administrator_at)
+			<!-- hcp has ack. -->
+			<div class="border-top mt-1 pt-1" style="border-color: #f3bcc1!important;">
+				<div class="d-flex flex-column">
+					<div class="d-flex align-items-center flex-wrap">
+						<span class="mr-2"><b>Ack. At:</b> {{ friendly_date_time($bill->administrator_flag_acknowledged_at) }}</span>
+						<small class="text-sm">By: <i class="fas fa-user"></i> {{ $bill->billFlagAcknowledgedByPro->displayName() }}</small>
+					</div>
+					
+					<small class="text-muted"><b><i class="fas fa-comment on-hover-opaque"></i></b> {{ $bill->administrator_flag_acknowledgement_memo }}</small>
+					
+					<div class="border-top mt-1 pt-1" style="border-color: #f3bcc1!important;">
+						<div moe>
+							<a start show class="text-danger"><i class="fas fa-undo fa-fw  on-hover-opaque"></i> Undo Ack.</a>
+							<form url="/api/bill/undoAcknowledgeAdministratorFlag" class="mcp-theme-1">
+								<input type="hidden" name="uid" value="{{$bill->uid}}">
+								<div class="form-group">
+									<label>Memo:</label>
+									<textarea name="memo" rows="2" class="form-control"></textarea>
+								</div>
+								<div>
+									<button submit class="btn btn-sm btn-danger mr-1">Undo Ack.</button>
+									<button cancel class="btn btn-sm btn-default border">Cancel</button>
+								</div>
+							</form>
+						</div>
+						<span class="mx-1 text-muted">|</span>
+						<div moe>
+							<a start show class="text-primary">Update Memo</a>
+							<form url="/api/bill/updateAcknowledgementMemo" class="mcp-theme-1">
+								<input type="hidden" name="uid" value="{{$bill->uid}}">
+								<div class="form-group">
+									<label>Memo:</label>
+									<textarea name="memo" rows="2" class="form-control"><?= $bill->administrator_flag_acknowledgement_memo ?></textarea>
+								</div>
+								<div>
+									<button submit class="btn btn-sm btn-primary mr-1">Update</button>
+									<button cancel class="btn btn-sm btn-default border">Cancel</button>
+								</div>
+							</form>
+						</div>
+					</div>
+				</div>
+			</div>
+		
+		@else
+			<!-- Needs hcp ack. -->
+			<div class="border-top mt-1 pt-1" style="border-color: #f3bcc1!important;">
+			<div moe>
+				<a start show class="text-primary"><i class="fa fa-check text-sm on-hover-opaque"></i> Ack.</a>
+				<form url="/api/bill/acknowledgeAdministratorFlag" class="mcp-theme-1">
+					<input type="hidden" name="uid" value="{{$bill->uid}}">
+					<div class="form-group">
+						<label>Memo:</label>
+						<textarea name="memo" rows="2" class="form-control" required></textarea>
+					</div>
+					<div>
+						<button submit class="btn btn-sm btn-primary mr-1">Ack. Flag</button>
+						<button cancel class="btn btn-sm btn-default border">Cancel</button>
+					</div>
+				</form>
+			</div>
+			</div>
+
+		@endif
+	@endif
+@endif
+
+</div>

+ 3 - 3
resources/views/app/patient/note/follow-up-appointment.blade.php

@@ -22,13 +22,13 @@
         </div>
     @endif
 
-    <div class="align-items-baseline mb-3 fu-appt-choices {{!is_null($note->is_follow_up_needed) ? 'd-none' : 'd-flex'}}">
+    <div class="align-items-center mb-3 fu-appt-choices {{!is_null($note->is_follow_up_needed) ? 'd-none' : 'd-flex'}}">
         <p class="font-weight-bold text-secondary my-0 mr-3">Would you like to book a follow-up appointment?</p>
-        <label class="d-inline-flex align-items-center mr-3">
+        <label class="d-inline-flex align-items-center mr-3 my-0">
             <input type="radio" name="is_follow_up_needed" value="1">
             <span class="ml-1">Yes</span>
         </label>
-        <label class="d-inline-flex align-items-center mr-3">
+        <label class="d-inline-flex align-items-center mr-3 my-0">
             <input type="radio" name="is_follow_up_needed" value="0">
             <span class="ml-1 mr-3">No</span>
         </label>

+ 64 - 0
resources/views/app/patient/note/partials/bill-flags-history.blade.php

@@ -0,0 +1,64 @@
+<?php
+
+use App\Models\AdministratorBillFlagUpdate;
+
+$recentBillFlags = AdministratorBillFlagUpdate::where('bill_id', $bill->id)->orderBy('created_at', 'DESC')->limit(5)->get();
+?>
+@if(count($recentBillFlags))
+<div moe relative wide center class="ml-2 mr-2">
+	<a start show title="View Bill Flag History"><i class="fas fa-history fa-fw on-hover-opaque"></i></a>
+	<form url="" class="mcp-theme-1">
+		<div>
+			<div class="d-flex align-items-center justify-content-between pb-2 mb-1">
+				<h5 class="mb-0 font-weight-bold">Recent Bill Flags</h5>
+				<button cancel class="btn btn-sm btn-default border">
+					<i class="fas fa-times"></i>
+				</button>
+			</div>
+			<table class="table table-sm table-striped table-bordered">
+				<thead class="bg-light">
+					<tr>
+						<th class="border-bottom-0">Date</th>
+						<th class="border-bottom-0">Admin Flag Memo</th>
+						<th class="border-bottom-0">HCP Ack. Memo</th>
+					</tr>
+				</thead>
+				<tbody>
+					@foreach($recentBillFlags as $bf)
+					<tr>
+						<td>{{ friendly_date_time($bf->created_at) }}</td>
+						<td>
+							<div class="d-flex flex-column">
+								<small class="text-sm text-muted"><?= $bf->administrator_flag_memo ?></small>
+								@if($bf->billFlagAcknowledgedByProAdmin)
+								<div class="d-flex align-items-center">
+									<span class="text-sm">By: {{ $bf->billFlagAcknowledgedByProAdmin->displayName() }}</span>
+									<span class="text-sm ml-2">At: {{ friendly_date_time($bf->flagged_administrator_at) }}</span>
+								</div>
+								@endif
+							</div>
+						</td>
+						<td>
+							<div class="d-flex flex-column">
+								<small class="text-sm text-muted"><?= $bf->administrator_flag_acknowledgement_memo ?></small>
+								@if($bf->billFlagAcknowledgedByPro)
+								<div class="d-flex align-items-center">
+									<span class="text-sm">By: {{ $bf->billFlagAcknowledgedByPro->displayName() }}</span>
+									<span class="text-sm ml-2">At: {{ friendly_date_time($bf->administrator_flag_acknowledged_at) }}</span>
+								</div>
+								@endif
+							</div>
+						</td>
+					</tr>
+					@endforeach
+					@if(!count($recentBillFlags))
+						<tr>
+							<td colspan="3">No records found</td>
+						</tr>
+					@endif
+				</tbody>
+			</table>
+		</div>
+	</form>
+</div>
+@endif

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

@@ -354,10 +354,10 @@
     <!-- icds -->
     <div style="padding: 1rem; padding-bottom: 0;">
         <p><b style="font-size: 18px">ICDs</b></p>
-        @if(!count($note->reasons))
+        @if(!count($note->reasons()))
             Unavailable
         @else
-            @foreach ($note->reasons as $reason)
+            @foreach ($note->reasons() as $reason)
                 <div style="margin-bottom: 0.5rem;">
                     {{ $reason->description}} ({{ $reason->code }})
                 </div>

+ 2 - 2
resources/views/app/patient/note/rm-setup.blade.php

@@ -127,10 +127,10 @@
                 <div>
                     <div class="d-flex align-items-center mb-1">
                         <span class="mr-2">RM Reasons:</span>
-                        @include('app.patient.partials.put-rm-reasons', ['recordType' => 'NOTE', 'record' => $note])
+                        @include('app.patient.partials.put-rm-reasons', ['recordType' => 'CLIENT', 'record' => $patient])
                     </div>
                     <div class="">
-                        @include('app.patient.partials.rm-reasons-display', ['recordType' => 'NOTE', 'record' => $note])
+                        @include('app.patient.partials.rm-reasons-display', ['recordType' => 'CLIENT', 'record' => $patient])
                     </div>
                 </div>
                 {{--<div>

+ 55 - 45
resources/views/app/patient/note/rpm-agreement.blade.php

@@ -43,53 +43,62 @@
     <?php $patient = $note->client; ?>
 
     <div class="border rounded p-3 mb-3 max-width-500px" id="rpm-agreement-reasons-{{$note->id}}">
-        <p><b>RPM Reasons</b></p>
+        <div class="d-flex align-items-center mb-2">
+            <p class="mb-0 mr-2"><b>RM Reasons</b></p>
+            <div>@include('app.patient.partials.put-rm-reasons', ['recordType' => 'CLIENT', 'record' => $patient])</div>
+        </div>
         <div class="max-width-500px">
-            @if(!$patient->rmReasons || !count($patient->rmReasons))
-                <span class="text-secondary d-block mb-2">None</span>
-            @else
-                <div>
-                    @foreach($patient->rmReasons as $reason)
-                        <div class="border-bottom pb-1 mb-1 d-flex align-items-start">
-                            <b class="min-width-70px">{{$reason->code}}</b>
-                            <span class="max-width-200px mr-3">{{$reason->description}}</span>
-                            <div moe relative class="ml-auto">
-                                <a start show><i class="fa fa-edit"></i></a>
-                                <form url="/api/clientCmRmReason/updateBasic" class="mcp-theme-1" right target="#rpm-agreement-reasons-{{$note->id}}">
-                                    <input type="hidden" name="uid" value="{{$reason->uid}}">
-                                    <div class="mb-2">
-                                        <label class="text-sm mb-1 text-secondary">Code *</label>
-                                        <input type="text" class="form-control form-control-sm"
-                                               icd-autocomplete-code
-                                               name="code" value="{{$reason->code}}" required>
-                                    </div>
-                                    <div class="mb-2">
-                                        <label class="text-sm mb-1 text-secondary">Description</label>
-                                        <input type="text" class="form-control form-control-sm"
-                                               icd-autocomplete-description
-                                               name="description" value="{{$reason->description}}">
-                                    </div>
-                                    <div>
-                                        <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                                        <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                                    </div>
-                                </form>
-                            </div>
-                            <div moe relative class="ml-2">
-                                <a start show><i class="fa fa-trash-alt text-danger on-hover-opaque"></i></a>
-                                <form url="/api/clientCmRmReason/remove" class="mcp-theme-1" right target="#rpm-agreement-reasons-{{$note->id}}">
-                                    <input type="hidden" name="uid" value="{{$reason->uid}}">
-                                    <p>Remove this RM reason?</p>
-                                    <div>
-                                        <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                                        <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                                    </div>
-                                </form>
+            <div>
+                @include('app.patient.partials.rm-reasons-display', ['recordType' => 'CLIENT', 'record' => $patient])
+            </div>
+            {{--<div>
+                @if(!$patient->rmReasons || !count($patient->rmReasons))
+                    <span class="text-secondary d-block mb-2">None</span>
+                @else
+                    <div>
+                        @foreach($patient->rmReasons as $reason)
+                            <div class="border-bottom pb-1 mb-1 d-flex align-items-start">
+                                <b class="min-width-70px">{{$reason->code}}</b>
+                                <span class="max-width-200px mr-3">{{$reason->description}}</span>
+                                <div moe relative class="ml-auto">
+                                    <a start show><i class="fa fa-edit"></i></a>
+                                    <form url="/api/clientCmRmReason/updateBasic" class="mcp-theme-1" right target="#rpm-agreement-reasons-{{$note->id}}">
+                                        <input type="hidden" name="uid" value="{{$reason->uid}}">
+                                        <div class="mb-2">
+                                            <label class="text-sm mb-1 text-secondary">Code *</label>
+                                            <input type="text" class="form-control form-control-sm"
+                                                icd-autocomplete-code
+                                                name="code" value="{{$reason->code}}" required>
+                                        </div>
+                                        <div class="mb-2">
+                                            <label class="text-sm mb-1 text-secondary">Description</label>
+                                            <input type="text" class="form-control form-control-sm"
+                                                icd-autocomplete-description
+                                                name="description" value="{{$reason->description}}">
+                                        </div>
+                                        <div>
+                                            <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
+                                <div moe relative class="ml-2">
+                                    <a start show><i class="fa fa-trash-alt text-danger on-hover-opaque"></i></a>
+                                    <form url="/api/clientCmRmReason/remove" class="mcp-theme-1" right target="#rpm-agreement-reasons-{{$note->id}}">
+                                        <input type="hidden" name="uid" value="{{$reason->uid}}">
+                                        <p>Remove this RM reason?</p>
+                                        <div>
+                                            <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                                            <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                                        </div>
+                                    </form>
+                                </div>
                             </div>
-                        </div>
-                    @endforeach
-                </div>
-            @endif
+                        @endforeach
+                    </div>
+                @endif
+            </div>--}}
+            {{--
             <div class="d-flex align-items-baseline">
                 <div moe>
                     <a start show>+ Add From Dx</a>
@@ -141,6 +150,7 @@
                     </form>
                 </div>
             </div>
+            --}}
         </div>
     </div>
 

+ 1 - 1
resources/views/app/patient/note/segment-slim.blade.php

@@ -16,7 +16,7 @@ $isOmegaHistorySegment = strpos($iName, 'omega_history_') === 0;
     <!-- title -->
 
             <?php
-            $extraClass = $segment->heading ? 'min-width-110px' : 'min-width-140px pl-2';
+            $extraClass = $segment->heading ? 'min-width-110px max-width-110px' : 'min-width-140px pl-2';
             ?>
 
             @if(!!$segment->display_title)

+ 1 - 1
resources/views/app/patient/note/segment/suggestions_and_updates.blade.php

@@ -106,7 +106,7 @@
                     @if($segment->accepted_suggestion_summary_html)
                         {!! $segment->accepted_suggestion_summary_html !!}
                     @else 
-                        {!! $segment->getRecalculatedHtml($performer)['summaryHtml'] !!}
+                        {!! $segment->getRecalculatedHtml($performer, $performer->session_key)['summaryHtml'] !!}
                     @endif 
                 </textarea>
                 <div class="mb-0 mt-2">

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

@@ -304,8 +304,8 @@
                     {!! $note->hcpPro && $note->is_signed_by_hcp ? '<b class="text-success">Yes</b>' : 'No' !!}
                 </td>
                 <td class="max-width-200px">
-                    @if(count($note->reasons))
-                        @foreach ($note->reasons as $reason)
+                    @if(count($note->reasons()))
+                        @foreach ($note->reasons() as $reason)
                             <span class="d-inline-block mr-2" title="{{ $reason->description}}">{{ $reason->code }}</span>
                         @endforeach
                     @else

+ 1 - 1
resources/views/app/patient/partials/put-rm-reasons.blade.php

@@ -86,7 +86,7 @@ if($recordType === 'NOTE'){
 			</table>
 		</div>
 		<div class="mb-2">
-			<label class="font-weight-bold mb-1">RM Reason Memo:</label>
+			<label class="font-weight-bold mb-1">{{ $recordType !== 'NOTE' ? 'RM' : '' }} Reason Memo:</label>
 			<input type="text" class="form-control form-control-sm" name="reasonMemo" value="{{ $recordType === 'NOTE' ? $record->note_reason_memo : $record->rm_reason_memo }}">
 		</div>
 		<div>

+ 44 - 53
resources/views/app/patient/partials/rm-reasons-display.blade.php

@@ -1,57 +1,48 @@
 <?php
-	$displayData = [
-		'icd_1' => [
-			'title' => 'ICD 1',
-			'reason' => $record->rm_reason_icd1,
-			'description' => $record->rm_reason_icd1description
-		],
-		'icd_2' => [
-			'title' => 'ICD 2',
-			'reason' => $record->rm_reason_icd2,
-			'description' => $record->rm_reason_icd2description
-		],
-		'icd_3' => [
-			'title' => 'ICD 3',
-			'reason' => $record->rm_reason_icd3,
-			'description' => $record->rm_reason_icd3description
-		],
-		'icd_4' => [
-			'title' => 'ICD 4',
-			'reason' => $record->rm_reason_icd4,
-			'description' => $record->rm_reason_icd4description
-		],
-	];
-	if($recordType === 'NOTE'){
-		$displayData['icd_1']['reason'] = $record->note_reason_icd1;
-		$displayData['icd_1']['description'] = $record->note_reason_icd1description;
-		$displayData['icd_2']['reason'] = $record->note_reason_icd2;
-		$displayData['icd_2']['description'] = $record->note_reason_icd2description;
-		$displayData['icd_3']['reason'] = $record->note_reason_icd3;
-		$displayData['icd_3']['description'] = $record->note_reason_icd3description;
-		$displayData['icd_4']['reason'] = $record->note_reason_icd4;
-		$displayData['icd_4']['description'] = $record->note_reason_icd4description;
-	}
+$displayData = [
+	'icd_1' => [
+		'title' => 'ICD 1',
+		'reason' => $record->rm_reason_icd1,
+		'description' => $record->rm_reason_icd1description
+	],
+	'icd_2' => [
+		'title' => 'ICD 2',
+		'reason' => $record->rm_reason_icd2,
+		'description' => $record->rm_reason_icd2description
+	],
+	'icd_3' => [
+		'title' => 'ICD 3',
+		'reason' => $record->rm_reason_icd3,
+		'description' => $record->rm_reason_icd3description
+	],
+	'icd_4' => [
+		'title' => 'ICD 4',
+		'reason' => $record->rm_reason_icd4,
+		'description' => $record->rm_reason_icd4description
+	],
+];
 ?>
-<table class="table table-sm table-striped table-bordered mb-0">
-	<tbody>
+<div>
+	<div class="d-flex flex-wrap">
+		<?php $emptyICDs = true; ?>
 		@foreach($displayData as $rmKey=>$rmData)
-		<tr>
-			<td class="text-nowrap">{{ $rmData['title'] }}</td>
-			<td>
-				<div class="d-flex">
-					<span class="font-weight-bold text-sm mr-2" style="min-width: 60px;">{{ $rmData['reason'] ? $rmData['reason']. ':':'' }}</span>
-					<small class="text-muted text-sm">{{ $rmData['description'] }}</small>
-				</div>
-			</td>
-		</tr>
-		@endforeach
-		<tr>
-			<td class="text-nowrap">Memo</td>
-			@if($recordType == 'NOTE')
-				<td class="text-muted text-sm">{{ $record->note_reason_memo }}</td>
-			@else
-				<td class="text-muted text-sm">{{ $record->rm_reason_memo }}</td>
+			<?php
+			$emptyICD = true;
+			if (!empty($rmData['reason']) || !empty($rmData['description'])) {
+				$emptyICDs = false;
+				$emptyICD = false;
+			}
+			?>
+			@if(!$emptyICD)
+				<span class="mb-1 mr-2"><i class="fas fa-star text-warning"></i> {{$rmData['reason']}} @if(!empty($rmData['description']))({{ $rmData['description'] }})@endif</span>
 			@endif
-		</tr>
-	</tbody>
-</table>
+		@endforeach
+		@if($emptyICDs)
+		<small class="text-dark">-</small>
+		@endif
+	</div>
+	<div class="d-flex">
+			<span class="mr-2"><b>Memo:</b></span>
+			<small class="text-muted">{{ $record->rm_reason_memo }}</small>
+	</div>
+</div>

+ 43 - 0
resources/views/app/patient/partials/rm-reasons-display_depricated.blade.php

@@ -0,0 +1,43 @@
+<?php
+	$displayData = [
+		'icd_1' => [
+			'title' => 'ICD 1',
+			'reason' => $record->rm_reason_icd1,
+			'description' => $record->rm_reason_icd1description
+		],
+		'icd_2' => [
+			'title' => 'ICD 2',
+			'reason' => $record->rm_reason_icd2,
+			'description' => $record->rm_reason_icd2description
+		],
+		'icd_3' => [
+			'title' => 'ICD 3',
+			'reason' => $record->rm_reason_icd3,
+			'description' => $record->rm_reason_icd3description
+		],
+		'icd_4' => [
+			'title' => 'ICD 4',
+			'reason' => $record->rm_reason_icd4,
+			'description' => $record->rm_reason_icd4description
+		],
+	];
+?>
+<table class="table table-sm table-striped table-bordered mb-0">
+	<tbody>
+		@foreach($displayData as $rmKey=>$rmData)
+		<tr>
+			<td class="text-nowrap">{{ $rmData['title'] }}</td>
+			<td>
+				<div class="d-flex">
+					<span class="font-weight-bold text-sm mr-2" style="min-width: 60px;">{{ $rmData['reason'] ? $rmData['reason']. ':':'' }}</span>
+					<small class="text-muted text-sm">{{ $rmData['description'] }}</small>
+				</div>
+			</td>
+		</tr>
+		@endforeach
+		<tr>
+			<td class="text-nowrap">Memo</td>
+			<td class="text-muted text-sm">{{ $record->rm_reason_memo }}</td>
+		</tr>
+	</tbody>
+</table>

+ 10 - 6
resources/views/app/patient/partials/rm-setup.blade.php

@@ -104,13 +104,17 @@
                 </div>
             </div>
         </div>
-        <div class="d-flex align-items-center mb-1">
-            <span class="mr-2">RM Reasons:</span>
-            @include('app.patient.partials.put-rm-reasons', ['recordType' => 'CLIENT', 'record' => $patient])
-        </div>
-        <div class="pl-3" style="max-width: 570px;">
-            @include('app.patient.partials.rm-reasons-display', ['recordType' => 'CLIENT', 'record' => $patient])
+
+        <div class="d-flex align-items-start flex-column mb-1">
+            <div class="mr-2 width-200px">
+                <span class="mr-2">RM Reasons:</span>
+                @include('app.patient.partials.put-rm-reasons', ['recordType' => 'CLIENT', 'record' => $patient])
+            </div>
+            <div class="pl-3">
+                @include('app.patient.partials.rm-reasons-display', ['recordType' => 'CLIENT', 'record' => $patient])
+            </div>
         </div>
+        
         {{--<div class="d-flex align-items-baseline mb-3">
             <span class="width-200px">RM Reasons:</span>
             <div class="ml-3">

+ 42 - 0
resources/views/app/patient/partials/sticky-notes-history.blade.php

@@ -0,0 +1,42 @@
+<?php
+
+use App\Models\ClientStickyNote;
+
+$recentStickyNotes = ClientStickyNote::where('client_id', $patient->id)->orderBy('created_at', 'DESC')->limit(5)->get();
+?>
+<div moe relative wide center class="ml-2">
+	<a start show><i class="fas fa-history fa-fw on-hover-opaque"></i></a>
+	<form url="" class="mcp-theme-1">
+		<div>
+			<div class="d-flex align-items-center justify-content-between pb-2 mb-1">
+				<h5 class="mb-0 font-weight-bold">Recent Sticky Notes</h5>
+				<button cancel class="btn btn-sm btn-default border">
+					<i class="fas fa-times"></i>
+				</button>
+			</div>
+			<table class="table table-sm table-striped table-bordered">
+				<thead class="bg-light">
+					<tr>
+						<th class="border-bottom-0">Date</th>
+						<th class="border-bottom-0">Note</th>
+						<th class="border-bottom-0">Created By</th>
+					</tr>
+				</thead>
+				<tbody>
+					@foreach($recentStickyNotes as $sn)
+					<tr>
+						<td>{{ friendly_date_time($sn->created_at) }}</td>
+						<td style="max-width: 400px;"><?= nl2br($sn->sticky_note) ?></td>
+						<td>{{ $sn->createdBy->pro->displayName() }}</td>
+					</tr>
+					@endforeach
+					@if(!count($recentStickyNotes))
+						<tr>
+							<td colspan="4">No records found</td>
+						</tr>
+					@endif
+				</tbody>
+			</table>
+		</div>
+	</form>
+</div>

+ 14 - 0
resources/views/app/patient/partials/update-best-time-to-call.blade.php

@@ -0,0 +1,14 @@
+<div moe relative>
+	<a start show><i class="fas fa-edit on-hover-opaque"></i></a>
+	<form url="/api/client/updateBestTimeToCall" class="mcp-theme-1" right>
+		<input type="hidden" name="uid" value="{{$patient->uid}}">
+		<div class="mb-2">
+			<label>Best Time To Call</label>
+			<input type="text" class="form-control form-control-sm" name="bestTimeToCall" value="{{ $patient->best_time_to_call }}" />
+		</div>
+		<div>
+			<button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+			<button cancel class="btn btn-sm btn-default border">Cancel</button>
+		</div>
+	</form>
+</div>

+ 83 - 0
resources/views/app/patient/partials/update-mcp-onboarding-visit-info.blade.php

@@ -0,0 +1,83 @@
+<span moe class="hide-inside-popup">
+	<a start show><i class="fa fa-edit on-hover-opaque"></i></a>
+	<form url="/api/client/updateMcpOnboardingVisitInfo" class="mcp-theme-1">
+		<input type="hidden" name="uid" value="{{$patient->uid}}">
+		<div id="updateMcpOnboardingVisit" v-cloak>
+			<div class="mb-2">
+				<select name="hasMcpDoneOnboardingVisit" class="form-control form-control-sm" onchange="toggleDisabledAsNeeded(this, 'YES', 'if-visit-done')" v-model="form.hasMcpDoneOnboardingVisit">
+					<option value="">-- Select Status --</option>
+					<option value="YES" {{ $patient->has_mcp_done_onboarding_visit === 'YES' ? 'selected' : '' }}>YES</option>
+					<option value="NO" {{ $patient->has_mcp_done_onboarding_visit === 'NO' ? 'selected' : '' }}>NO</option>
+					<option value="UNKNOWN" {{ $patient->has_mcp_done_onboarding_visit === 'UNKNOWN' ? 'selected' : '' }}>UNKNOWN</option>
+				</select>
+			</div>
+			<div class="mb-2">
+				<input type="date" class="if-visit-done form-control form-control-sm" disabled name="mcpOnboardingVisitDate" value="{{ date('Y-m-d') }}" max="{{ date('Y-m-d') }}">
+			</div>
+			<div class="mb-2">
+				<select name="mcpOnboardingVisitNoteUid" disabled class="form-control form-control-sm if-visit-done" onchange="if(this.value === '-- create --') createNewNote('{{$patient->uid}}', '{{$pro->uid}}', '{{date('Y-m-d')}}');">
+					<option value="">-- Visit Note --</option>
+					<?php $notes = \App\Models\Note::where('client_id', $patient->id)->get() ?>
+					@foreach ($notes as $note)
+					@if(!empty($note->title) && $note->client_id === $patient->id && !$note->is_cancelled)
+					<option {{ $patient->mcp_onboarding_visit_note_id === $note->id ? 'selected' : '' }} value="{{$note->uid}}">{{$note->hcpPro->displayName()}} ({{friendly_date_time($note->effective_dateest, false)}})</option>
+					@endif
+					@endforeach
+					{{--<option value="-- create --">-- Create Note --</option>--}}
+				</select>
+			</div>
+			<div class="mb-2 if-note-outside-system">
+				<textarea class="form-control form-control-sm" name="reasonOnboardingVisitNoteOutsideSystem" placeholder="Visit note outside the system reason" spellcheck="false" data-gramm="false"></textarea>
+			</div>
+			<div>
+			<small v-if="showEnterInfoAlert" class="d-block text-info text-sm mb-2">*Ensure you select Visit Note or type Reason before submitting.</small>
+			</div>
+		</div>
+		<div>
+			<button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+			<button cancel class="btn btn-sm btn-default border">Cancel</button>
+		</div>
+	</form>
+</span>
+
+<script>
+	var updateMcpOnboardingVisit = new Vue({
+		el:'#updateMcpOnboardingVisit',
+		data:{
+			form:{
+				hasMcpDoneOnboardingVisit: '{{ $patient->has_mcp_done_onboarding_visit }}'
+			},
+			showEnterInfoAlert: false
+		},
+		methods:{
+			initValidation: function(){
+				var self= this;
+				var fields = $('[name=mcpOnboardingVisitNoteUid], [name=reasonOnboardingVisitNoteOutsideSystem]');
+				if(self.form.hasMcpDoneOnboardingVisit == 'YES'){					
+					fields.prop('required', true);
+					fields.on('change keyup', function(){
+						fields.prop('required', false);
+						$(this).prop('required', true);
+					});
+					self.showEnterInfoAlert = true;
+				}else{
+					fields.prop('required', false);
+					self.showEnterInfoAlert = false;
+				}
+			},
+			init: function(){
+				this.initValidation();
+			}
+		},
+		mounted: function(){
+			this.init();
+		},
+		updated: function(){
+			var self = this;
+
+			self.$nextTick(function(){
+				self.initValidation();
+			});
+		}
+	});
+</script>

+ 5 - 1
resources/views/app/patient/prescriptions/list.blade.php

@@ -139,7 +139,7 @@
             </table>
         </div>
         <div v-if="currentPrescription" class="border-top border-right border-bottom align-self-stretch p-3 flex-grow-1 min-width-50">
-            <div class="d-flex align-items-center">
+            <div class="d-flex align-items-baseline">
                 <h3 class="font-size-16 m-0 d-flex align-items-baseline">
                     <i v-if="currentPrescription.has_hcp_pro_signed" title="Signed" class="fa fa-check text-success mr-2"></i>
                     <b class="mr-1 font-size-16">@{{ currentPrescription.erx_category }} ERx <span class="ml-2">@{{ currentPrescription.created_at_friendly }}</span></b>
@@ -147,6 +147,10 @@
                         <div v-if="currentPrescription.note_id === {{$note->id}}" class="text-info mt-1 font-weight-bold text-nowrap ml-2">* From this note</div>
                     @endif
                 </h3>
+                <div v-if="currentPrescription.pro_declared_status == 'CANCELLED'" class="ml-3 bg-danger font-weight-bold text-sm px-2 py-1 rounded text-white">
+                    <i class="fa fa-ban"></i>
+                    CANCELLED
+                </div>
                 <a class="ml-auto" href="#" v-on:click.prevent="setCurrentPrescription(null);">
                     <i class="fa fa-times-circle on-hover-opaque"></i>
                 </a>

+ 10 - 5
resources/views/app/patient/primary-coverage-manual-determination-medicaid-modal.blade.php

@@ -3,12 +3,17 @@
 	$cpc = $patient->latestClientPrimaryCoverage;
 	@endphp
 	<div class="p-3">
-		@if($cpc->mcd_number)
-		<div class="mb-2">
-			<span><b>Medicaid Number:</b> {{$cpc->mcd_number}}</span>
-			<span class="ml-3"><b>Medicaid State:</b> {{$cpc->mcd_payer_id ? $cpc->mcdPayer->name : '-'}}</span>
+		<div class="d-flex flex-wrap">
+			@if($cpc->mcd_number)
+			<div class="mb-2">
+				<span><b>Medicaid Number:</b> {{$cpc->mcd_number}}</span>
+				<span class="ml-3"><b>Medicaid State:</b> {{$cpc->mcd_payer_id ? $cpc->mcdPayer->name : '-'}}</span>
+			</div>
+			@endif
+			<div class="mb-2 mr-2">
+				<span><b>Is Covered:</b> {{$cpc->is_covered}}</span>
+			</div>
 		</div>
-		@endif
 		<form @submit.prevent="submitForm" method="post" class="mcp-theme-1">
 			<input type="hidden" name="clientPrimaryCoverageUid" value="{{$cpc->uid}}" class="form-control input-sm" />
 			<div class="row">

+ 9 - 4
resources/views/app/patient/primary-coverage-manual-determination-medicare-modal.blade.php

@@ -3,11 +3,16 @@
 	$cpc = $patient->latestClientPrimaryCoverage;
 	@endphp
 	<div class="p-3">
-		@if($cpc->mcr_number)
-		<div class="mb-2">
-			<b>Medicare Number:</b> {{$cpc->mcr_number}}
+		<div class="d-flex flex-wrap">
+			@if($cpc->mcr_number)
+			<div class="mb-2">
+				<b>Medicare Number:</b> {{$cpc->mcr_number}}
+			</div>
+			@endif
+			<div class="mb-2 mr-2">
+				<span><b>Is Covered:</b> {{$cpc->is_covered}}</span>
+			</div>
 		</div>
-		@endif
 		<form @submit.prevent="submitForm" method="post" class="mcp-theme-1">
 			<input type="hidden" name="clientPrimaryCoverageUid" value="{{$cpc->uid}}" class="form-control input-sm" />
 			<div class="row">

+ 46 - 53
resources/views/app/patient/problems-center.blade.php

@@ -31,66 +31,59 @@ if(!@$summaryView) {
     <div class="point-table-container">
 
         @if(!@$summaryView && $patient->core_note_id !== $note->id && $ccSegment)
-        <div class="d-flex align-items-baseline">
-            <div class="mb-2 font-weight-bold font-size-14 text-secondary">Chief Complaint</div>
+        <div class="d-flex align-items-baseline mb-3">
+            <div class="font-weight-bold font-size-14 text-secondary">Chief Complaint</div>
             <span class="mx-2 text-secondary">|</span>
-            <a href="#" class="regenerate-cc">Regenerate with relevant problems</a>
-        </div>
-
-        <?php
-        $ccPoint = Point::where('added_in_note_id', $note->id)->where('category', 'CHIEF_COMPLAINT')->orderBy('id', 'DESC')->first();
-        $parsed = null;
-        if ($ccPoint && !!@$ccPoint->data) {
-            $parsed = json_decode($ccPoint->data);
-        }
-        if(!$parsed || !@$parsed->free_text) {
-            list($problemPoints, $counts) = Point::getPointsOfCategoryExtended($patient, 'PROBLEM', $note);
-            $problemNames = [];
-            foreach ($problemPoints as $problemPoint) {
-                if($problemPoint->relevanceToNote($note)) {
-                    $problemNames[] = $problemPoint->data->name;
-                }
+            <a href="#" class="regenerate-cc mr-2">Regenerate</a>
+            <?php
+            $ccPoint = Point::where('added_in_note_id', $note->id)->where('category', 'CHIEF_COMPLAINT')->orderBy('id', 'DESC')->first();
+            $parsed = null;
+            if ($ccPoint && !!@$ccPoint->data) {
+                $parsed = json_decode($ccPoint->data);
             }
-            $ccProblems = '';
-            for($i = 0; $i < count($problemNames); $i++) {
-                if($i > 0) {
-                    if($i === count($problemNames) - 1) {
-                        $ccProblems .= " and ";
+            if(!$parsed || !@$parsed->free_text) {
+                list($problemPoints, $counts) = Point::getPointsOfCategoryExtended($patient, 'PROBLEM', $note);
+                $problemNames = [];
+                foreach ($problemPoints as $problemPoint) {
+                    if($problemPoint->relevanceToNote($note)) {
+                        $problemNames[] = $problemPoint->data->name;
                     }
-                    else {
-                        $ccProblems .= ", ";
+                }
+                $ccProblems = '';
+                for($i = 0; $i < count($problemNames); $i++) {
+                    if($i > 0) {
+                        if($i === count($problemNames) - 1) {
+                            $ccProblems .= " and ";
+                        }
+                        else {
+                            $ccProblems .= ", ";
+                        }
                     }
+                    $ccProblems .= $problemNames[$i];
                 }
-                $ccProblems .= $problemNames[$i];
+                $defaultCC = "Patient {$patient->name_first} {$patient->name_last} " .
+                    "is a {$patient->age_in_years} year old" .
+                    ($patient->sex ? ($patient->sex === 'F' ? ' female' : ($patient->sex === 'M' ? ' male' : ' ' . $patient->sex)) : '') .
+                    ($ccProblems ? " with a history of {$ccProblems}" : "") .
+                    ($note->new_or_fu_or_na === 'NEW' ? ' presenting for establishing care' : ' presenting for follow-up') .
+                    ".";
+                $parsed = json_decode(json_encode([
+                    "free_text" => $defaultCC
+                ]));
             }
-            $defaultCC = "Patient {$patient->name_first} {$patient->name_last} " .
-                "is a {$patient->age_in_years} year old" .
-                ($patient->sex ? ($patient->sex === 'F' ? ' female' : ($patient->sex === 'M' ? ' male' : ' ' . $patient->sex)) : '') .
-                ($ccProblems ? " with a history of {$ccProblems}" : "") .
-                ($note->new_or_fu_or_na === 'NEW' ? ' presenting for establishing care' : ' presenting for follow-up') .
-                ".";
-            $parsed = json_decode(json_encode([
-                "free_text" => $defaultCC
-            ]));
-        }
-        ?>
-        <div visit-moe class="d-block">
-            <form show="" url="/api/visitPoint/upsertNoteSingleton" class="mcp-theme-1" id="frm-cc-regenerate">
-                <input type="hidden" name="segmentUid" value="{{$ccSegment->uid}}">
-                <input type="hidden" name="category" value="CHIEF_COMPLAINT">
-                <input type="hidden" name="data" value="">
-                <div note-rte slim-rte
-                     class="form-group mb-2 border-left border-right rte-holder cc-generated"
-                     data-field-name="free_text"
-                ><?= $parsed && @$parsed->free_text ? $parsed->free_text : '' ?></div>
-            </form>
+            ?>
+            <div visit-moe class="d-inline-block flex-grow-1">
+                <form show="" url="/api/visitPoint/upsertNoteSingleton" class="mcp-theme-1" id="frm-cc-regenerate">
+                    <input type="hidden" name="segmentUid" value="{{$ccSegment->uid}}">
+                    <input type="hidden" name="category" value="CHIEF_COMPLAINT">
+                    <input type="hidden" name="data" value="">
+                    <div note-rte slim-rte
+                         class="form-group mb-0 border-left border-right rte-holder cc-generated"
+                         data-field-name="free_text"
+                    ><?= $parsed && @$parsed->free_text ? $parsed->free_text : '' ?></div>
+                </form>
+            </div>
         </div>
-
-        <hr class="m-neg-3 mt-3 mb-2">
-        @endif
-
-        @if(!@$summaryView)
-        <div class="mb-2 font-weight-bold font-size-14 text-secondary">Problems</div>
         @endif
 
         <table class="table table-sm table-bordered bg-white mb-2 point-table read">

+ 2 - 2
resources/views/app/patient/segment-templates/_child_plan/edit-plan-optimized-flat.php

@@ -42,7 +42,7 @@ else {
             <div class="d-flex align-items-baseline mb-1">
                 <span class="text-sm text-secondary">Previous Plan / <?= friendlier_date($previousChildPlan->created_at) ?> (click to copy)</span>
             </div>
-            <div class="p-1 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+            <div class="p-1 bg-light border inline-html-container click-to-copy" auto-paste="[data-field-name=value]"><?= $previousValue ?></div>
         </div>
         <?php endif; ?>
 
@@ -52,7 +52,7 @@ else {
                  data-field-name="value"><?= $currentValue ?></div>
         </div>
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 2 - 2
resources/views/app/patient/segment-templates/_child_plan/edit-plan-optimized.php

@@ -42,7 +42,7 @@ else {
             <div class="d-flex align-items-baseline mb-1">
                 <span class="text-sm text-secondary">Previous Plan / <?= friendlier_date($previousChildPlan->created_at) ?> (click to copy)</span>
             </div>
-            <div class="p-1 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+            <div class="p-1 bg-light border inline-html-container click-to-copy" auto-paste="[data-field-name=value]"><?= $previousValue ?></div>
         </div>
         <?php endif; ?>
 
@@ -52,7 +52,7 @@ else {
                  data-field-name="value"><?= $currentValue ?></div>
         </div>
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 1 - 1
resources/views/app/patient/segment-templates/_child_plan/medication/edit-plan-optimized.php

@@ -18,7 +18,7 @@
         </div>
 
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 2 - 2
resources/views/app/patient/segment-templates/_child_review/edit-review-optimized-flat.php

@@ -46,7 +46,7 @@ else {
                 <div class="d-flex align-items-baseline mb-1">
                     <span class="text-sm text-secondary">Previous Subjective / <?= friendlier_date($previousChildReview->created_at) ?> (click to copy)</span>
                 </div>
-                <div class="p-1 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+                <div class="p-1 bg-light border inline-html-container click-to-copy" auto-paste="[data-field-name=value]"><?= $previousValue ?></div>
             </div>
         <?php endif; ?>
 
@@ -56,7 +56,7 @@ else {
                  data-field-name="value"><?= $currentValue ?></div>
         </div>
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 2 - 2
resources/views/app/patient/segment-templates/_child_review/edit-review-optimized.php

@@ -46,7 +46,7 @@ else {
                 <div class="d-flex align-items-baseline mb-1">
                     <span class="text-sm text-secondary">Previous Subjective / <?= friendlier_date($previousChildReview->created_at) ?> (click to copy)</span>
                 </div>
-                <div class="p-1 bg-light border inline-html-container click-to-copy"><?= $previousValue ?></div>
+                <div class="p-1 bg-light border inline-html-container click-to-copy" auto-paste="[data-field-name=value]"><?= $previousValue ?></div>
             </div>
         <?php endif; ?>
 
@@ -56,7 +56,7 @@ else {
                  data-field-name="value"><?= $currentValue ?></div>
         </div>
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 1 - 1
resources/views/app/patient/segment-templates/_child_review/medication/edit-review-optimized.php

@@ -25,7 +25,7 @@
         </div>
 
         <div>
-            <button submit class="btn btn-sm btn-primary mr-2">Save</button>
+            <button submit class="btn btn-sm btn-primary mr-2"><i class="fa fa-save"></i></button>
             <button cancel class="btn btn-sm btn-default border">Cancel</button>
         </div>
     </form>

+ 0 - 0
resources/views/app/patient/segment-templates/psych_intake_current_mental-status/edit.blade.php → resources/views/app/patient/segment-templates/current_mental-status/edit.blade.php


+ 0 - 0
resources/views/app/patient/segment-templates/psych_intake_current_mental-status/summary.blade.php → resources/views/app/patient/segment-templates/current_mental-status/summary.blade.php


+ 3 - 3
resources/views/app/patient/segment-templates/omega_allergies/summary.blade.php

@@ -11,10 +11,10 @@ $plural = 'Allergies';
 ?>
 
 <?php if($tracker && @($tracker->data->no_known_drug_allergies)): ?>
-    <div class="text-secondary mb-2"><span>-</span></div>
+    <div class="text-secondary mb-1">No known drug allergies</div>
 <?php endif; ?>
 <?php if($tracker && @($tracker->data->no_known_allergies_of_any_type)): ?>
-    <div class="text-secondary mb-2"><span>-</span></div>
+    <div class="text-secondary mb-1">No known allergies of any type</div>
 <?php endif; ?>
 
 <?php if(!$tracker || !@($tracker->data->no_known_allergies_of_any_type)): ?>
@@ -25,7 +25,7 @@ $plural = 'Allergies';
     <?php $j = 0; foreach ($points as $point): $j++; ?>
 	<?php $rel = $point->relevanceToNote($note); ?>
         <tr>
-            <td class="width-30px text-right pl-0 pr-1">
+            <td class="width-22px pl-0 pr-1">
                 @if($rel)
                     <?php $numRelevant++; ?>
                 @endif

+ 7 - 7
resources/views/app/patient/segment-templates/omega_care_team/summary.blade.php

@@ -16,7 +16,7 @@ $plural = 'Care team members';
     <?php $j = 0; foreach ($points as $point): $j++; ?>
         <?php $rel = $point->relevanceToNote($note); ?>
         <tr>
-            <td class="width-30px text-right pl-0 pr-1">
+            <td class="width-22px pl-0 pr-1 {{ $rel ? ' text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
                 @endif
@@ -33,14 +33,14 @@ $plural = 'Care team members';
                 if(@($point->data->date)) $parts[] = $point->data->date;
                 $parts = implode(' • ', $parts);
                 ?>
-                <div class="<?= $point->is_removed ? 'strike-through' : '' ?>">
+                <span class="<?= $point->is_removed ? 'strike-through' : '' ?>">
                     <?= $parts ?>
-                    <div>
+                    <span>
                         <?php $review = $point->childReviewAddedInNote($note); ?>
                         <?php if(!!$review && @$review->data->value): ?>
-                        <span class="pr-2"><b>Subj.</b> {!! trim(strip_tags($review->data->value)) !!}</span>
+                        <span class="pl-2"><b>Subj.</b> {!! trim(strip_tags($review->data->value)) !!}</span>
                         <?php endif; ?>
-                        <span class="text-nowrap">
+                        <span class="text-nowrap pl-2">
                         <?php if ($point->is_removed): ?>
                             @if($point->removal_reason_category === 'DURING_VISIT')
                                 <span class="text-sm text-secondary">Removed during visit</span>
@@ -55,8 +55,8 @@ $plural = 'Care team members';
                             <?php endif;?>
                         <?php endif; ?>
                         </span>
-                    </div>
-                </div>
+                    </span>
+                </span>
             </td>
             <td></td>
         </tr>

+ 2 - 4
resources/views/app/patient/segment-templates/omega_goals/summary.blade.php

@@ -16,13 +16,11 @@ $plural = 'Goals';
     <?php $j = 0; foreach ($points as $point): $j++; ?>
         <?php $rel = $point->relevanceToNote($note); ?>
         <tr>
-            <td class="width-30px text-right pl-0 pr-1 {{ $rel ? ' text-info':'' }}">
+            <td class="width-22px pl-0 pr-1 {{ $rel ? ' text-info':'' }}">
                 @if($rel)
                     <?php $numRelevant++; ?>
-                    *{{ $j }}.
-                @else
-                    {{ $j }}.
                 @endif
+                {{ $j }}.
             </td>
             <td class="px-2">
                 <div class="<?= $point->is_removed ? 'strike-through' : '' ?> grow-till-300px">

+ 1 - 1
resources/views/app/patient/segment-templates/omega_history_past_medical/edit.blade.php

@@ -144,7 +144,7 @@ for ($i = 0; $i < count($fields); $i++) {
                                                        open-in-stag-popup
                                                        mc-initer="problems-center-{{$note->id}}"
                                                        title="Problems Center"
-                                                       popup-style="wide overflow-visible"
+                                                       popup-style="overflow-visible"
                                                        href="/problems-center/{{$patient->uid}}/{{$note->uid}}?dx={{urlencode($values[$k])}}">
                                                         <i class="fa fa-plus-circle on-hover-opaque"></i>
                                                     </a>

+ 38 - 9
resources/views/app/patient/segment-templates/omega_history_past_medical/summary.blade.php

@@ -73,16 +73,24 @@ if ($contentData) {
     $blood = implode(" ", $blood);
     if(!empty(trim($blood))) { ?>
         <div class="mb-2">
-            <div>Blood Type &amp; RH: <b><?= $blood ?></b></div>
+            <div><b>Blood Type &amp; RH: </b><?= $blood ?></div>
         </div>
     <?php }
 
+	$commonMap = [];
+
     for ($i = 0; $i < count($fields); $i++):
         foreach($fields[$i] as $head => $values):
             for($k = 0; $k < count($values); $k++):
+		$value = $values[$k];
                 $fName = $head . '_' . sanitize_field_name($values[$k]);
-                if(@$contentData['common'][$fName]): ?>
-                    <div>
+		if(@$contentData['common'][$fName]) {
+			if(!isset($commonMap[$head])) {
+				$commonMap[$head] = [];
+			}
+			$commonMap[$head][] = ['value' => $value, 'fName' => $fName, 'comments' => @$contentData['common'][$fName.'__comments']];
+		?>
+                    <div class="d-none">
                         <?= ucwords($head) ?>
                         <i class="fa fa-arrow-right text-sm text-secondary"></i>
                         <span class="font-weight-bold"><?= $values[$k] ?></span>
@@ -91,11 +99,28 @@ if ($contentData) {
                         <?php endif; ?>
                     </div>
                 <?php
-                endif;
+                }
             endfor;
         endforeach;
     endfor;
 
+	// var_dump(json_encode($commonMap));
+	?> <div> <?php
+	foreach($commonMap as $head => $set):
+		?>
+		<div>
+			<span class="font-weight-bold"><?= ucwords($head) ?></span>
+			<i class="fa fa-arrow-right text-secondary d-none_"></i>
+			<span class="">
+			<?php $out = []; foreach($set as $item) { $out[] = '<span class="__font-weight-bold">' . $item['value'] . '</span>' . ($item['comments'] ? ('<span class="text-sm ml-1 text-secondary">(' . $item['comments'] . ')</span>') : ''); } if(!empty($out)) echo ' • '; echo implode(' • ', $out); ?>
+			</span>
+		</div>
+		<?php
+	endforeach;
+	?>
+
+	<?php
+
     // custom fields
 
     if(isset($contentData['customFields']) && count($contentData['customFields'])):
@@ -103,20 +128,24 @@ if ($contentData) {
         for ($i = 0; $i < count($contentData['customFields']); $i++):
             $item = $contentData['customFields'][$i];
             if($item['value']): ?>
-                <div>
-                    Custom
-                    <i class="fa fa-arrow-right text-sm text-secondary"></i>
-                    <span class="font-weight-bold"><?= $item['label'] ?></span>
+                <span>
+                    <span class="font-weight-bold">Other: </span>
+		    <i class="fa fa-arrow-right d-none"></i>
+                </span>
+		<span>
+		    <span class="__font-weight-bold"><?= $item['label'] ?></span>
                     <?php if($item['comments']): ?>
                         <span class="text-sm ml-1 text-secondary">(<?= $item['comments'] ?>)</span>
                     <?php endif; ?>
-                </div>
+                </span>
             <?php
             endif;
         endfor;
         ?> </div> <?php
     endif;
 
+	echo '</div>';
+
     if(isset($contentData['comments']) && !empty(trim($contentData['comments']))) { ?>
         <div class="mt-2 mb-1">
             <b>Comments: </b><?= $contentData['comments'] ?>

+ 159 - 0
resources/views/app/patient/segment-templates/omega_history_past_medical/summary.blade.php_NEW

@@ -0,0 +1,159 @@
+<?php
+
+use App\Models\Client;
+use App\Models\Point;
+use App\Models\Note;
+/** @var Client $patient */
+/** @var Note $note */
+
+if(!@$note) {
+    $note = $patient->coreNote;
+}
+
+$fields = [
+    [
+        "Head" => ["Trauma"],
+        "Eyes" => ["Blindness", "Cataracts", "Glaucoma", "Wears glasses/contacts"],
+        "Ears" => ["Hearing aids"],
+        "Nose/Sinuses" => ["Allergic Rhinitis", "Sinus infections"],
+        "Mouth/Throat/Teeth" => ["Dentures"],
+        "Cardiovascular" => ["Aneurysm", "Angina", "DVT", "Dysrhythmia", "HTN", "Murmur", "Myocardial infarction", "Other heart disease"],
+    ],
+    [
+        "Respiratory" => ["Asthma", "Bronchitis", "COPD - Bronchitis/Emphysema", "Pleuritis", "Pneumonia"],
+        "Gastrointestinal" => ["Cirrhosis", "GERD", "Gallbladder disease", "Heartburn", "Hemorrhoids", "Hepatitis", "Hiatal hernia", "Jaundice", "Ulcer"],
+        "Genitourinary" => ["Hernia", "Incontinence", "Nephrolithiasis", "Other kidney disease", "STDs", "UTI(s)"],
+    ],
+    [
+        "Musculoskeletal" => ["Arthritis", "Gout", "M/S injury"],
+        "Skin" => ["Dermatitis", "Mole(s)", "Other skin condition(s)", "Psoriasis"],
+        "Neurological" => ["Epilepsy", "Seizures", "Severe headaches, migraines", "Stroke", "TIA"],
+        "Psychiatric" => ["Bipolar disorder", "Depression", "Hallucinations, delusions", "Suicidal ideation", "Suicide attempts"],
+    ],
+    [
+        "Endocrine" => ["Goiter", "Hyperlipidemia", "Hypothyroidism", "Thyroid disease", "Thyroiditis", "Type I DM", "Type II DM"],
+        "Heme/Onc" => ["Anemia", "Cancer"],
+        "Infectious" => ["HIV", "STDs", "Tuberculosis (dz)", "Tuberculosis (exposure)"],
+    ]
+];
+
+$contentData = [
+    "bloodType" => "",
+    "bloodRH" => "",
+    "common" => [],
+    "customFields" => [],
+    "comments" => "",
+];
+$isempty = false;
+
+if(!@$sessionKey) {
+    $sessionKey = request()->cookie('sessionKey');
+}
+
+$point = Point::getOrCreateOnlyTopLevelPointOfCategory($note, 'PAST_MEDICAL_HISTORY', $sessionKey, true);
+
+$contentData = $parsed = false;
+
+$rel = !!$point->relevanceToNote($note);
+
+if ($point->lastChildReview && $point->lastChildReview->data && ($rel || $point->lastChildReview->added_in_note_id === $note->id)) {
+    $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
+    $contentData = $parsed = $point->lastChildReview->data;
+}
+
+if ($contentData) {
+
+    $blood = [];
+    if(isset($contentData['bloodType'])) {
+        $blood[] = $contentData['bloodType'];
+    }
+    if(isset($contentData['bloodRH'])) {
+        $blood[] = $contentData['bloodRH'];
+    }
+    $blood = implode(" ", $blood);
+    if(!empty(trim($blood))) { ?>
+        <div class="mb-2">
+            <div>Blood Type &amp; RH: <b><?= $blood ?></b></div>
+        </div>
+    <?php }
+
+	$commonMap = [];
+
+    for ($i = 0; $i < count($fields); $i++):
+        foreach($fields[$i] as $head => $values):
+            for($k = 0; $k < count($values); $k++):
+		$value = $values[$k];
+                $fName = $head . '_' . sanitize_field_name($values[$k]);
+		if(@$contentData['common'][$fName]) {
+			if(!isset($commonMap[$head])) {
+				$commonMap[$head] = [];
+			}
+			$commonMap[$head][] = ['value' => $value, 'fName' => $fName, 'comments' => @$contentData['common'][$fName.'__comments']];
+		?>
+                    <div class="d-none">
+                        <?= ucwords($head) ?>
+                        <i class="fa fa-arrow-right text-sm text-secondary"></i>
+                        <span class="font-weight-bold"><?= $values[$k] ?></span>
+                        <?php if(@$contentData['common'][$fName . '__comments']): ?>
+                            <span class="text-sm ml-1 text-secondary">(<?= $contentData['common'][$fName . '__comments'] ?>)</span>
+                        <?php endif; ?>
+                    </div>
+                <?php
+                }
+            endfor;
+        endforeach;
+    endfor;
+
+	// var_dump(json_encode($commonMap));
+	?> <table class="table-bordered table-xs table-cage mb-0"> <?php
+	foreach($commonMap as $head => $set):
+		?>
+		<tr>
+			<td class="font-weight-bold"><?= ucwords($head) ?></td>
+			<td class="px-2">
+			<?php $out = []; foreach($set as $item) { $out[] = '<span class="__font-weight-bold">' . $item['value'] . '</span>' . ($item['comments'] ? ('<span class="text-sm ml-1 text-secondary">(' . $item['comments'] . ')</span>') : ''); } echo implode(', ', $out); ?>
+			</td>
+			<td></td>
+		</tr>
+		<?php
+	endforeach;
+	?>
+
+	<?php
+
+    // custom fields
+
+    if(isset($contentData['customFields']) && count($contentData['customFields'])):
+        ?> <tr class=""> <?php
+        for ($i = 0; $i < count($contentData['customFields']); $i++):
+            $item = $contentData['customFields'][$i];
+            if($item['value']): ?>
+                <td>
+                    <span class="font-weight-bold">Other</span>
+                </td>
+		<td>
+		    <span class="__font-weight-bold"><?= $item['label'] ?></span>
+                    <?php if($item['comments']): ?>
+                        <span class="text-sm ml-1 text-secondary">(<?= $item['comments'] ?>)</span>
+                    <?php endif; ?>
+                </td>
+		<td></td>
+            <?php
+            endif;
+        endfor;
+        ?> </tr> <?php
+    endif;
+
+	echo '</table>';
+
+    if(isset($contentData['comments']) && !empty(trim($contentData['comments']))) { ?>
+        <div class="mt-2 mb-1">
+            <b>Comments: </b><?= $contentData['comments'] ?>
+        </div>
+    <?php }
+
+} else {
+    echo '<div class="text-secondary">-</div>';
+}
+?>
+

+ 20 - 17
resources/views/app/patient/segment-templates/omega_history_social/summary.blade.php

@@ -42,24 +42,27 @@ if ($point->lastChildReview && $point->lastChildReview->data && ($rel || $point-
     $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
     $contentData = $parsed = $point->lastChildReview->data;
 
-    for ($i = 0; $i < count($fields); $i++):
-        foreach($fields[$i] as $head => $values):
-            for($k = 0; $k < count($values); $k++):
+    $prevHead = ''; $items = [];
+    for ($i = 0; $i < count($fields); $i++) {
+        foreach($fields[$i] as $head => $values) {
+            $items = [];
+            for($k = 0; $k < count($values); $k++) {
                 $fName = $head . '_' . sanitize_field_name($values[$k]);
-                if(@$contentData['common'][$fName]): ?>
-                    <div>
-                        <?= ucwords($head) ?>
-                        <i class="fa fa-arrow-right text-sm text-secondary"></i>
-                        <span class="font-weight-bold"><?= $values[$k] ?></span>
-                        <?php if(@$contentData['common'][$fName . '__comments']): ?>
-                            <span class="text-sm ml-1 text-secondary">(<?= $contentData['common'][$fName . '__comments'] ?>)</span>
-                        <?php endif; ?>
-                    </div>
-                <?php
-                endif;
-            endfor;
-        endforeach;
-    endfor;
+                if(@$contentData['common'][$fName]) {
+                    $items[] = $values[$k] . (@$contentData['common'][$fName . '__comments'] ? '<span class="text-sm ml-1 text-secondary">(' . $contentData['common'][$fName . '__comments'] . ')</span>' : '');
+                }
+            }
+            if(count($items) && trim(implode('', $items)) !== '') {
+            ?>
+                <div>
+                    <b><?= $head ?></b>
+                    <i class="fa fa-arrow-right text-sm text-secondary"></i>
+                    <?= implode(' • ', $items) ?>
+                </div>
+            <?php
+            }
+        }
+    }
 
     // custom fields
 

+ 3 - 3
resources/views/app/patient/segment-templates/omega_medications/summary.blade.php

@@ -11,7 +11,7 @@ $plural = 'Medications';
 ?>
 
 <?php if($tracker && @($tracker->data->no_known_medications)): ?>
-    <div class="text-secondary"><span>-</span></div>
+    <div class="text-secondary">No known medications</div>
 <?php endif; ?>
 <?php if(!$tracker || !@($tracker->data->no_known_medications)): ?>
 <?php if (!count($points)): ?>
@@ -20,7 +20,7 @@ $plural = 'Medications';
 	<table class="table table-bordered table-xs table-cage mb-0">
 		<thead>
 		<tr>
-			<th class="py-1 px-2 border-top-0 text-right">#</th>
+			<th class="pl-0 pr-1 py-1 border-top-0">#</th>
 			<th class="py-1 px-2 border-top-0">Name</th>
 			<th class="py-1 px-2 border-top-0">Frequency</th>
 			<th class="py-1 px-2 border-top-0">Experience</th>
@@ -36,7 +36,7 @@ $plural = 'Medications';
 		}
 		?>
 	<tr>
-		<td class="width-30px text-right pl-0 pr-1">
+		<td class="width-22px pl-0 pr-1">
 			@if($rel)
 				<?php $numRelevant++; ?>
 			@endif

+ 16 - 27
resources/views/app/patient/segment-templates/omega_problems/summary.blade.php

@@ -12,30 +12,15 @@ $plural = 'Problems';
 <?php if (!count($points)): ?>
     <div class="text-secondary">-</div>
 <?php else: ?>
-    <table class="table table-bordered table-xs table-cage mb-0">
+    <div>
     <?php $j = 0; foreach ($points as $point): $j++; ?>
         <?php $rel = $point->relevanceToNote($note); ?>
-       <tr>
-            <td class="width-30px text-right pl-0 pr-1 {{ $rel ? ' text-info':'' }}">
-                @if($rel)
-                    <?php $numRelevant++; ?>
-                    *{{ $j }}.
-                @else
-                    {{ $j }}.
-                @endif
-            </td>
-            <td class="px-2">
-                <div class=" <?= $point->is_removed ? 'strike-through' : '' ?> grow-till-300px" >
-                    <?= !!@($point->data->name) ? @($point->data->name) : '-' ?>
-                </div>
-            </td>
-           <td class="width-300px">
-               <div class="d-flex align-items-baseline pl-2">
-                   <?php $review = $point->childReviewAddedInNote($note); ?>
-                   <?php if(!!$review && @$review->data->value): ?>
-                   <span class="pr-2">{!! $review->data->value !!}</span>
-                   <?php endif; ?>
-                   <span class="text-nowrap">
+       <div>
+            <span class="">
+                <span class="font-weight-bold" <?= $point->is_removed ? 'strike-through' : '' ?> grow-till-300px" >
+                    <?= !!@($point->data->name) ? @($point->data->name) : '-' ?>:
+                </span>
+		<span class="text-nowrap">
                        <?php if ($point->is_removed): ?>
                        @if($point->removal_reason_category === 'DURING_VISIT')
                            <span class="text-sm text-secondary">Removed during visit</span>
@@ -50,11 +35,15 @@ $plural = 'Problems';
                             <?php endif;?>
                        <?php endif; ?>
                     </span>
-               </div>
-           </td>
-           <td></td>
-        </tr>
+            </span>
+           <div class="ml-3 mb-1">
+                   <?php $review = $point->childReviewAddedInNote($note); ?>
+                   <?php if(!!$review && @$review->data->value): ?>
+                   <span class="pr-2" style="display: inline-block">{!! $review->data->value !!}</span>
+                   <?php endif; ?>
+           </div>
+        </div>
     <?php endforeach; ?>
-    </table>
+    </div>
 <?php endif; ?>
 

+ 60 - 0
resources/views/app/patient/segment-templates/omega_problems/summary.blade.php__NEW

@@ -0,0 +1,60 @@
+<?php
+
+use App\Models\Point;
+
+/** @var \App\Models\Client $patient */
+
+$points = Point::getIntakePointsOfCategory($patient, 'PROBLEM', $note);
+$numRelevant = 0;
+$plural = 'Problems';
+?>
+
+<?php if (!count($points)): ?>
+    <div class="text-secondary">-</div>
+<?php else: ?>
+    <table class="table table-bordered table-xs table-cage mb-0">
+    <?php $j = 0; foreach ($points as $point): $j++; ?>
+        <?php $rel = $point->relevanceToNote($note); ?>
+       <tr>
+            <td class="width-30px text-right pl-0 pr-1 {{ $rel ? ' text-info':'' }}">
+                @if($rel)
+                    <?php $numRelevant++; ?>
+                    *{{ $j }}.
+                @else
+                    {{ $j }}.
+                @endif
+            </td>
+            <td class="px-2">
+                <div class=" <?= $point->is_removed ? 'strike-through' : '' ?> grow-till-300px" >
+                    <?= !!@($point->data->name) ? @($point->data->name) : '-' ?>
+                </div>
+            </td>
+           <td class="width-300px">
+               <div class="d-flex align-items-baseline pl-2">
+                   <?php $review = $point->childReviewAddedInNote($note); ?>
+                   <?php if(!!$review && @$review->data->value): ?>
+                   <span class="pr-2">{!! $review->data->value !!}</span>
+                   <?php endif; ?>
+                   <span class="text-nowrap">
+                       <?php if ($point->is_removed): ?>
+                       @if($point->removal_reason_category === 'DURING_VISIT')
+                           <span class="text-sm text-secondary">Removed during visit</span>
+                       @elseif($point->removal_reason_category === 'ON_INTAKE')
+                           <span class="text-sm text-secondary">Removed on intake</span>
+                       @endif
+                       <?php elseif ($point->added_in_note_id === $note->id): ?>
+                       <?php if ($point->addition_reason_category === 'DURING_VISIT'): ?>
+                                <span class="text-sm text-success">* Added during visit</span>
+                            <?php else: ?>
+                                <span class="text-sm text-info">* Added on intake</span>
+                            <?php endif;?>
+                       <?php endif; ?>
+                    </span>
+               </div>
+           </td>
+           <td></td>
+        </tr>
+    <?php endforeach; ?>
+    </table>
+<?php endif; ?>
+

+ 1 - 1
resources/views/app/patient/segment-templates/omega_subjective_system/summary.blade.php

@@ -28,7 +28,7 @@ $wizardLinks = [
 
 ?>
 
-<div class="mb-2 hide-if-note-signed">
+<div class="my-1 hide-if-note-signed">
     @foreach($wizardLinks as $link)
         @if(@$link['name'])
             <a href="{{$link['href']}}"

+ 1 - 1
resources/views/app/patient/segment-templates/past_medical_history/edit.blade.php

@@ -144,7 +144,7 @@ for ($i = 0; $i < count($fields); $i++) {
                                                        open-in-stag-popup
                                                        mc-initer="problems-center-{{$note->id}}"
                                                        title="Problems Center"
-                                                       popup-style="wide overflow-visible"
+                                                       popup-style="overflow-visible"
                                                        href="/problems-center/{{$patient->uid}}/{{$note->uid}}?dx={{urlencode($values[$k])}}">
                                                         <i class="fa fa-plus-circle on-hover-opaque"></i>
                                                     </a>

+ 1 - 1
resources/views/app/patient/segment-templates/sigma_history_past_medical/edit.blade.php

@@ -144,7 +144,7 @@ for ($i = 0; $i < count($fields); $i++) {
                                                        open-in-stag-popup
                                                        mc-initer="problems-center-{{$note->id}}"
                                                        title="Problems Center"
-                                                       popup-style="wide overflow-visible"
+                                                       popup-style="overflow-visible"
                                                        href="/problems-center/{{$patient->uid}}/{{$note->uid}}?dx={{urlencode($values[$k])}}">
                                                         <i class="fa fa-plus-circle on-hover-opaque"></i>
                                                     </a>

+ 68 - 35
resources/views/app/patient/segment-templates/typical_day_lifestyle/summary.blade.php

@@ -32,11 +32,29 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
     $point->lastChildReview->data = json_decode($point->lastChildReview->data, true);
     $contentData = $point->lastChildReview->data;
 }
+$hasTypicalDayData = false;
+if(@$contentData["lines"] && count($contentData["lines"])) {
+    foreach(@$contentData["lines"] as $line) {
+        if(!!@$line['S'] && (!!@$line['I'] || !!@$line['P'])) {
+            $hasTypicalDayData = true;
+            break;
+        }
+    }
+}
+$hasDailyAggregates = (
+    @$contentData["estimated_daily_calories"]["S"] ||
+    @$contentData["estimated_daily_calories"]["P"] ||
+    @$contentData["estimated_daily_protein_grams"]["S"] ||
+    @$contentData["estimated_daily_protein_grams"]["P"] ||
+    @$contentData["estimated_daily_vegetable_servings"]["S"] ||
+    @$contentData["estimated_daily_vegetable_servings"]["P"] ||
+    @$contentData["estimated_daily_hours_of_sleep"]["S"] ||
+    @$contentData["estimated_daily_hours_of_sleep"]["P"]
+);
 ?>
 <div class="events-none form-read-mode">
-    <p class="mb-2 font-weight-bold">Typical Day</p>
-
-    @if(@$contentData["lines"] && count($contentData["lines"]))
+    @if($hasTypicalDayData)
+        <div class="mb-1 font-weight-bold">Typical Day</div>
         <table class="table table-sm table-bordered mb-3">
             <thead class="bg-light">
             <tr>
@@ -46,6 +64,7 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
             </thead>
             <tbody>
             @foreach(@$contentData["lines"] as $line)
+                @if($line['S'])
                 <tr>
                     <td><pre class="m-0">{{$line['S']}}&nbsp;</pre></td>
                     <td>
@@ -57,42 +76,56 @@ if ($point->lastChildReview && $point->lastChildReview->data) {
                         </div>
                     </td>
                 </tr>
+                @endif
             @endforeach
             </tbody>
         </table>
     @endif
 
-    <p class="mb-2 font-weight-bold">Daily Aggregates</p>
+    @if($hasDailyAggregates)
+        <div class="mb-1 font-weight-bold">Daily Aggregates</div>
+        <table class="table table-sm table-bordered mb-2">
+            <thead class="bg-light">
+            <tr>
+                <th class="border-bottom-0 text-secondary width-200px">Subject</th>
+                <th class="border-bottom-0 text-secondary">Current</th>
+                <th class="border-bottom-0 text-secondary w-50">Target</th>
+            </tr>
+            </thead>
+            <tbody>
+            @if(@$contentData["estimated_daily_calories"]["S"] || @$contentData["estimated_daily_calories"]["P"])
+            <tr>
+                <td class="pl-1 align-middle bg-light">Est. Daily Calories</td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_calories"]["S"]}}</pre></td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_calories"]["P"]}}</pre></td>
+            </tr>
+            @endif
+            @if(@$contentData["estimated_daily_protein_grams"]["S"] || @$contentData["estimated_daily_protein_grams"]["P"])
+            <tr>
+                <td class="pl-1 align-middle bg-light">Est. Daily Protein Grams</td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_protein_grams"]["S"]}}</pre></td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_protein_grams"]["P"]}}</pre></td>
+            </tr>
+            @endif
+            @if(@$contentData["estimated_daily_vegetable_servings"]["S"] || @$contentData["estimated_daily_vegetable_servings"]["P"])
+            <tr>
+                <td class="pl-1 align-middle bg-light">Est. Daily Vegetable Servings</td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_vegetable_servings"]["S"]}}</pre></td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_vegetable_servings"]["P"]}}</pre></td>
+            </tr>
+            @endif
+            @if(@$contentData["estimated_daily_hours_of_sleep"]["S"] || @$contentData["estimated_daily_hours_of_sleep"]["P"])
+            <tr>
+                <td class="pl-1 align-middle bg-light">Est. Daily Hours Of Sleep</td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_hours_of_sleep"]["S"]}}</pre></td>
+                <td><pre class="m-0">{{@$contentData["estimated_daily_hours_of_sleep"]["P"]}}</pre></td>
+            </tr>
+            @endif
+            </tbody>
+        </table>
+    @endif
 
-    <table class="table table-sm table-bordered mb-2">
-        <thead class="bg-light">
-        <tr>
-            <th class="border-bottom-0 text-secondary width-200px">Subject</th>
-            <th class="border-bottom-0 text-secondary">Current</th>
-            <th class="border-bottom-0 text-secondary w-50">Target</th>
-        </tr>
-        </thead>
-        <tbody>
-        <tr>
-            <td class="pl-1 align-middle bg-light">Est. Daily Calories</td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_calories"]["S"]}}</pre></td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_calories"]["P"]}}</pre></td>
-        </tr>
-        <tr>
-            <td class="pl-1 align-middle bg-light">Est. Daily Protein Grams</td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_protein_grams"]["S"]}}</pre></td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_protein_grams"]["P"]}}</pre></td>
-        </tr>
-        <tr>
-            <td class="pl-1 align-middle bg-light">Est. Daily Vegetable Servings</td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_vegetable_servings"]["S"]}}</pre></td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_vegetable_servings"]["P"]}}</pre></td>
-        </tr>
-        <tr>
-            <td class="pl-1 align-middle bg-light">Est. Daily Hours Of Sleep</td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_hours_of_sleep"]["S"]}}</pre></td>
-            <td><pre class="m-0">{{@$contentData["estimated_daily_hours_of_sleep"]["P"]}}</pre></td>
-        </tr>
-        </tbody>
-    </table>
+    @if(!$hasTypicalDayData && !$hasDailyAggregates)
+        -
+    @endif
 </div>

+ 10 - 5
resources/views/app/patient/wizard-partials/add-multiple-pre-existing.blade.php

@@ -69,6 +69,7 @@
                            stag-suggest-bottom-left
                            stag-suggest-text-only
                            stag-suggest-ep="/fdb-dx-suggest-v2/json"
+                           value="{{trim(request()->input('dx')) ? trim(request()->input('dx')) : ''}}"
                            @elseif($label === 'allergy')
                            stag-suggest
                            stag-suggest-bottom-left
@@ -101,16 +102,20 @@
                         <input type="text" key="organization" bucket="data">
                     </td>
                 @endif
-                <td class="p-0">
-                    <textarea rows="1" key="value" bucket="childReviewData"></textarea>
-                </td>
                 @if($label === 'medication')
                     <td class="p-0">
-                        <textarea rows="1" key="experience" bucket="childReviewData"></textarea>
+                        <textarea rows="1" key="value" bucket="childReviewData"></textarea>
+                    </td>
+                    <td class="p-0">
+                        <div note-rte class="rte-holder" key="experience" bucket="childReviewData"></div>
+                    </td>
+                @else
+                    <td class="p-0">
+                        <div note-rte class="rte-holder" key="value" bucket="childReviewData"></div>
                     </td>
                 @endif
                 <td class="p-0">
-                    <textarea rows="1" key="value" bucket="childPlanData"></textarea>
+                    <div note-rte class="rte-holder" key="value" bucket="childPlanData"></div>
                 </td>
                 <td class="p-0">
                     <input type="date" key="start_date" bucket="data">

+ 58 - 6
resources/views/app/patient/wizard-partials/common-script.blade.php

@@ -68,7 +68,20 @@ function __initRTEs(_collection) {
                         }
                     }
                 }
-            }
+            },
+            formats: [
+                'bold',
+                'italic',
+                'link',
+                'size',
+                'strike',
+                'underline',
+                'blockquote',
+                'header',
+                'indent',
+                'list',
+                'align',
+            ]
         });
 
         var toolbar = $(quill.container).prev('.ql-toolbar');
@@ -91,7 +104,8 @@ function __initRTEs(_collection) {
             if(!pElem.length) {
                 pElem = $(el).closest('form');
             }
-            let v = pElem.find('input[name="' + ($(el).attr('data-container-name') ? $(el).attr('data-container-name') : 'data') + '"]').val();
+            let dataElem = pElem.find('input[name="' + ($(el).attr('data-container-name') ? $(el).attr('data-container-name') : 'data') + '"]');
+            let v = dataElem.val();
             if(!!v) {
                 try {
                     v = JSON.parse(v);
@@ -106,7 +120,7 @@ function __initRTEs(_collection) {
                 v = JSON.stringify(dataObject);
             }
 
-            pElem.find('input[name=' + ($(el).attr('data-container-name') ? $(el).attr('data-container-name') : 'data') + ']').val(v);
+            dataElem.val(v);
 
             $(el).trigger('rich-text-input');
         };
@@ -834,12 +848,13 @@ function newRow(_tr) {
     newTr.find('input, textarea').val('');
     newTr.find('textarea').attr('rows', 1).css({minHeight: '', height: ''});
     newTr.find('[stag-suggest-initialized]').removeAttr('stag-suggest-initialized');
+    newTr.find('.stag-suggestions-container').remove();
     return newTr;
 }
 
 function createAndMoveToNextRowInput(_td) {
     let tr = createRowAfter(_td.closest('tr'));
-    tr.find('td:eq(0)').find('input, textarea').first().focus();
+    tr.find('input, textarea').first().focus();
 }
 
 function moveToNextRowInput(_td, _forceCreate = false) {
@@ -868,6 +883,9 @@ function generateData(_parentSegment) {
         $(this).find('input, textarea').each(function() {
             line[$(this).attr('bucket')][$(this).attr('key')] = this.value;
         });
+        $(this).find('[note-rte][key][bucket]').each(function() {
+            line[$(this).attr('bucket')][$(this).attr('key')] = $(this).find('.ql-editor[contenteditable]').first().html();
+        });
         line.data = JSON.stringify(line.data);
         line.childReviewData = JSON.stringify(line.childReviewData);
         line.childPlanData = JSON.stringify(line.childPlanData);
@@ -884,6 +902,7 @@ parentSegment
                 if (!_e.shiftKey || !$(this).is('textarea')) {
                     if($(this).closest('.stag-sheet').is('.allow-row-addition')) {
                         createAndMoveToNextRowInput($(this).closest('td'));
+                        initStagSuggest();
                     }
                     else {
                         moveToNextRowInput($(this).closest('td'), false);
@@ -921,6 +940,16 @@ parentSegment
 
     });
 
+parentSegment
+    .off('click', '.stag-sheet tbody td')
+    .on('click', '.stag-sheet tbody td', function(_e) {
+        let focusable = $(this).find('input, textarea, .ql-editor[contenteditable]').first();
+        if(!focusable.is(':focus')) {
+            focusable.focus();
+            return false;
+        }
+    });
+
 parentSegment
     .off('click.delete-line', '.stag-sheet .delete-line')
     .on('click.delete-line', '.stag-sheet .delete-line', function() {
@@ -945,14 +974,37 @@ parentSegment
 parentSegment
     .off('click.btn-save-lines', '.btn-save-lines')
     .on('click.btn-save-lines', '.btn-save-lines', function() {
+        let numRows = parentSegment.find('.stag-sheet').find('tbody>tr').length;
+        let numEmptyRows = numRows;
+        let emptyRows = [];
+        parentSegment.find('.stag-sheet').find('tbody>tr').each(function() { // loop A
+            let isEmptyRow = true;
+             $(this).find('input, textarea').each(function() { // loop B
+                 if($.trim($(this).val())) {
+                     isEmptyRow = false;
+                     return false; // break from B
+                 }
+             });
+             if(!isEmptyRow) numEmptyRows--;
+             else emptyRows.push(this);
+        });
+        if(numEmptyRows > 0) {
+            if(numEmptyRows === numRows && numRows === 1) return false; // if only 1 row and all empty in that - ignore and stop
+            else { // else clear empty rows
+                for (let i = 0; i < emptyRows.length; i++) {
+                    $(emptyRows[i]).remove();
+                }
+            }
+        }
+
         parentSegment.find('[name="dataJson"]').val(generateData(parentSegment));
         saveVisitForm(this);
         return false;
     });
 
 parentSegment
-    .off('click.switch-to-edit', '.point-table [if-read-mode] .inline-html-container')
-    .on('click.switch-to-edit', '.point-table [if-read-mode] .inline-html-container', function() {
+    .off('click.switch-to-edit', '.point-table [if-read-mode] .inline-html-container:not(.click-to-copy)')
+    .on('click.switch-to-edit', '.point-table [if-read-mode] .inline-html-container:not(.click-to-copy)', function() {
         let trigger = $(this).closest('[if-read-mode]')
             .find('form[url="/api/visitPoint/upsertChildReview"], form[url="/api/visitPoint/upsertChildPlan"]')
             .first().closest('[moe], [visit-moe]')

BIN
resources/views/app/practice-management/.process-claims.blade.php.swp


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

@@ -162,7 +162,7 @@
                                         </tr>
                                         </thead>
                                         <tbody>
-                                        @foreach($note->reasons as $reason)
+                                        @foreach($note->reasons() as $reason)
                                             <tr>
                                                 <td>{{$reason->code}}</td>
                                                 <td>{{$reason->description}}</td>

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

@@ -130,7 +130,7 @@
                             @if($performer->pro->pro_type == 'ADMIN')
                                 <td>
                                     <div class="d-flex flex-wrap width-100px">
-                                        @foreach($note->reasons as $reason)
+                                        @foreach($note->reasons() as $reason)
                                             <span class="border-bottom c-pointer mr-2 mb-1" title="{{$reason->description}}">{{$reason->code}}</span>
                                         @endforeach
                                     </div>

+ 1 - 1
resources/views/app/practice-management/notes-processing-center.blade.php

@@ -146,7 +146,7 @@
                             </td>
                             <td>
                                 <div class="d-flex flex-wrap width-100px">
-                                    @foreach($note->reasons as $reason)
+                                    @foreach($note->reasons() as $reason)
                                         <span class="border-bottom c-pointer mr-2 mb-1" title="{{$reason->description}}">{{$reason->code}}</span>
                                     @endforeach
                                 </div>

+ 1 - 1
resources/views/app/practice-management/process-claims.blade.php

@@ -53,7 +53,7 @@
                          v-on:click.prevent="setCurrentClaim(claimIndex)">
                         <div class="d-flex align-items-center c-pointer">
 
-                            <b class="p-2 border-right mr-1 bg-aliceblue" :class="claim.status === 'PICKED_UP' ? 'text-dark' : 'text-secondary'">@{{ claim.created }}</b>
+                            <b class="p-2 border-right mr-1 bg-aliceblue" :class="claim.status === 'PICKED_UP' ? 'text-dark' : 'text-secondary'">@{{ claim.claim_date }}</b>
 
                             <div v-if="claim.care_month_uid" class="rounded text-sm px-2 py-1 font-weight-bold bg-secondary text-white mr-1">
                                 <i class="fa fa-clock mr-1"></i>RM

+ 11 - 0
resources/views/app/practice-management/remote-monitoring-admin-row-markup.blade.php

@@ -1,4 +1,15 @@
 <tr data-client-uid="{{$iPatient->client_uid}}" data-care-month-uid="{{$iPatient->care_month_uid}}">
+<td class="pl-2">{{ $loop->index + 1 }}</td>
+    <td class="pl-2">
+        <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}" class="text-nowrap"
+           native target="_blank"
+           open-in-stag-popup
+           update-parent="refresh-rpm-row-{{$trIndex}}"
+           popup-style="tall overflow-visible"
+           mc-initer="care-month-dashboard-{{$iPatient->client_uid}}"
+           title="{{$iPatient->client_name}}"
+        ><span class="sort-data">{{ $iPatient->chart_number }}</span></a>
+    </td>
     <td class="pl-2">
         <a href="/patients/view/{{ $iPatient->client_uid }}/care-months/view/{{$iPatient->care_month_uid}}" class="text-nowrap"
            native target="_blank"

+ 2 - 0
resources/views/app/practice-management/remote-monitoring-admin.blade.php

@@ -84,6 +84,8 @@
                         <table class="table table-sm table-striped table-hover p-0 m-0 border-top" id="table-rm-matrix">
                             <thead class="bg-light">
                             <tr stag-title="Click to sort. Shift+Click to multi-sort.">
+                                <th class="border-0 pl-2">#</th>
+                                <th class="border-0 pl-2">Chart #</th>
                                 <th class="border-0 pl-2">Name</th>
                                 <th class="border-0">DOB</th>
                                 <th class="border-0">RPM?</th>

+ 8 - 0
resources/views/app/practice-management/visit-templates/index.blade.php

@@ -20,6 +20,7 @@
                         <th class="border-0">Title</th>
                         <th class="border-0">Created At</th>
                         <th class="border-0">Status</th>
+                        <th class="border-0">Accessiblity</th>
                         <th class="border-0">&nbsp;</th>
                     </tr>
                 </thead>
@@ -50,6 +51,13 @@
                                 @endif
                             </div>
                         </td>
+                        <td>
+                            @if($template->is_accessible_to_all)
+                                <small class="text-muted"><i class="fas fa-check text-success"></i> Accessible to All</small>
+                            @else
+                                <small class="text-muted"><i class="fas fa-ban"></i> Limited Access</small>
+                            @endif
+                        </td>
                         <td>
                             <div class="d-flex align-items-center">
                                 <div class="mr-2">

+ 124 - 158
resources/views/layouts/patient-header.blade.php

@@ -166,9 +166,116 @@ $addressParts .= implode(", ", $addressPart2);
       </div> -->
       <div class="position-relative ml-2">
         <div class="screen-only">
+          <div>
+            <label>MCP:</label> {{$mcpName}} 
+            @if($patient->has_mcp_done_onboarding_visit === 'YES')
+              <i class="fa fa-check text-sm" title="MCP Onboarding Visit Completed"></i>
+            @endif
+            @if($patient->has_mcp_done_onboarding_visit !== 'YES' && $pro->pro_type == 'ADMIN')
+            <div moe class="ml-2 hide-inside-popup">
+              <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
+              <form url="/api/client/putMcp" class="mcp-theme-1">
+                <input type="hidden" name="uid" value="{{$patient->uid}}">
+                <div class="mb-2">
+                  <label class="text-secondary text-sm">MCP Pro</label>
+                  <select name="mcpProUid" provider-search data-pro-uid="{{ @$patient->mcp->uid }}" class="form-control form-control-sm">
+                    <option value=""> --select--</option>
+                    @foreach($pros as $iPro)
+                    <option value="{{$iPro->uid}}" {{ $patient->mcp && $iPro->uid === $patient->mcp->uid ? 'selected' : '' }}>{{$iPro->displayName()}}</option>
+                    @endforeach
+                  </select>
+                </div>
+                <div>
+                  <button submit class="btn btn-sm btn-primary mr-1">
+                    Submit
+                  </button>
+                  <button cancel class="btn btn-sm btn-default border">
+                    Cancel
+                  </button>
+                </div>
+              </form>
+            </div>
+            @if($patient->mcp)
+            <div moe class="ml-2 hide-inside-popup">
+              <a start show><i class="fa fa-times on-hover-opaque"></i></a>
+              <form url="/api/client/removeMcp" class="mcp-theme-1">
+                <input type="hidden" name="uid" value="{{$patient->uid}}">
+                <div class="mb-2">
+                  <label class="text-secondary text-sm">Remove MCP Pro</label>
+
+                </div>
+                <div>
+                  <button submit class="btn btn-sm btn-primary mr-1">Submit
+                  </button>
+                  <button cancel class="btn btn-sm btn-default border">
+                    Cancel
+                  </button>
+                </div>
+              </form>
+            </div>
+            @endif
+            @endif
+            @if($patient->mcp && $pro->pro_type === 'ADMIN' && $pro->uid !== $patient->mcp->uid)
+            <form action="{{route('process-log-in-as')}}?redir={{request()->url()}}" onsubmit="window.top.localStorage.currentProUid = '{{$patient->mcp->uid}}';" method="POST" target="_top" class="d-inline-block">
+              @csrf
+              <input type="hidden" name="proUid" value="{{$patient->mcp->uid}}">
+              <button class="bg-transparent text-primary border-0 text-sm"><i class="fa fa-user on-hover-opaque"></i></button>
+            </form>
+            @endif
+          </div>
+          <div>
+            <label>CC:</label> {{$patient->defaultNaPro ? $patient->defaultNaPro->displayName() : '-' }}
+            @if($pro->pro_type == 'ADMIN')
+            <div moe class="ml-2 hide-inside-popup">
+              <a start show><i class="fa fa-edit on-hover-opaque text-sm"></i></a>
+              <form url="/api/client/putDefaultNaPro" class="mcp-theme-1">
+                <input type="hidden" name="uid" value="{{$patient->uid}}">
+                <div class="mb-2">
+                  <label class="text-secondary text-sm">Care Coordinator</label>
+                  <select provider-search data-pro-uid="{{ @$patient->defaultNaPro->uid }}" name="defaultNaProUid" class="form-control form-control-sm">
+                    <option value=""> --select--</option>
+                    @foreach($pros as $iPro)
+                    <option value="{{$iPro->uid}}" {{ $patient->pcp && $iPro->uid === $patient->pcp->uid ? 'selected' : '' }}>{{$iPro->displayName()}}</option>
+                    @endforeach
+                  </select>
+                </div>
+                <div>
+                  <button submit class="btn btn-sm btn-primary mr-1">Submit
+                  </button>
+                  <button cancel class="btn btn-sm btn-default border">
+                    Cancel
+                  </button>
+                </div>
+              </form>
+            </div>
+            @if($patient->pcp)
+            <div moe class="ml-2 hide-inside-popup">
+              <a start show><i class="fa fa-times"></i></a>
+              <form url="/api/client/removeDefaultNaPro" class="mcp-theme-1">
+                <input type="hidden" name="uid" value="{{$patient->uid}}">
+                <div class="mb-2">
+                  <label class="text-secondary text-sm">Remove Care Coordinator</label>
+
+                </div>
+                <div>
+                  <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
+                  <button cancel class="btn btn-sm btn-default border">Cancel</button>
+                </div>
+              </form>
+            </div>
+            @endif
+            @endif
+            @if($patient->defaultNaPro && $pro->pro_type === 'ADMIN' && $pro->uid !== $patient->defaultNaPro->uid)
+            <form action="{{route('process-log-in-as')}}?redir={{request()->url()}}" onsubmit="window.top.localStorage.currentProUid = '{{$patient->defaultNaPro->uid}}';" method="POST" target="_top" class="d-inline-block">
+              @csrf
+              <input type="hidden" name="proUid" value="{{$patient->defaultNaPro->uid}}">
+              <button class="bg-transparent text-primary border-0 text-sm"><i class="fa fa-user on-hover-opaque"></i></button>
+            </form>
+            @endif
+          </div>
           <div class="">
             <span>Status:</small>
-            <b>{{$patient->client_engagement_status_category ? ucwords(strtolower(str_replace('_', ' ', $patient->client_engagement_status_category == 'DUMMY' ? 'Test Chart' : $patient->client_engagement_status_category))) : '-'}}</b>
+            {{$patient->client_engagement_status_category ? ucwords(strtolower(str_replace('_', ' ', $patient->client_engagement_status_category == 'DUMMY' ? 'Test Chart' : $patient->client_engagement_status_category))) : '-'}}
 
             @if($pro->pro_type == 'ADMIN')
             <div moe class="ml-2 hide-inside-popup">
@@ -211,49 +318,7 @@ $addressParts .= implode(", ", $addressPart2);
                 <span>MCP Onboarding Visit Pending</span>
               </span>
             </span>
-            <span moe class="hide-inside-popup">
-              <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
-              <form url="/api/client/updateMcpOnboardingVisitInfo" class="mcp-theme-1">
-                <input type="hidden" name="uid" value="{{$patient->uid}}">
-                <div class="mb-2">
-                  <select name="hasMcpDoneOnboardingVisit" class="form-control form-control-sm" onchange="toggleDisabledAsNeeded(this, 'YES', 'if-visit-done')">
-                    <option value="">-- Select Status --</option>
-                    <option value="YES" {{ $patient->has_mcp_done_onboarding_visit === 'YES' ? 'selected' : '' }}>YES</option>
-                    <option value="NO" {{ $patient->has_mcp_done_onboarding_visit === 'NO' ? 'selected' : '' }}>NO</option>
-                    <option value="UNKNOWN" {{ $patient->has_mcp_done_onboarding_visit === 'UNKNOWN' ? 'selected' : '' }}>UNKNOWN</option>
-                  </select>
-                </div>
-                <div class="mb-2">
-                  <input type="date" class="if-visit-done form-control form-control-sm" disabled name="mcpOnboardingVisitDate" value="{{ date('Y-m-d') }}" max="{{ date('Y-m-d') }}">
-                </div>
-                <div class="mb-2">
-                  <select name="mcpOnboardingVisitNoteUid" disabled class="form-control form-control-sm if-visit-done" onchange="if(this.value === '-- create --') createNewNote('{{$patient->uid}}', '{{$pro->uid}}', '{{date('Y-m-d')}}');">
-                    <option value="">-- Visit Note --</option>
-                    <?php $notes = \App\Models\Note::where('client_id', $patient->id)->get() ?>
-                    @foreach ($notes as $note)
-                    @if(!empty($note->title) && $note->client_id === $patient->id && !$note->is_cancelled)
-                    <option {{ $patient->mcp_onboarding_visit_note_id === $note->id ? 'selected' : '' }} value="{{$note->uid}}">{{$note->hcpPro->displayName()}} ({{friendly_date_time($note->effective_dateest, false)}})</option>
-                    @endif
-                    @endforeach
-                    {{--<option value="-- create --">-- Create Note --</option>--}}
-                  </select>
-                </div>
-                <div class="mb-2 if-note-outside-system">
-                  <textarea class="form-control form-control-sm" name="reasonOnboardingVisitNoteOutsideSystem" placeholder="Visit note outside the system reason" spellcheck="false" data-gramm="false"></textarea>
-                </div>
-                <div>
-                  <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-                  <button cancel class="btn btn-sm btn-default border">Cancel</button>
-                </div>
-              </form>
-            </span>
-            @else
-            <span class="text-dark d-inline-flex align-items-center">
-              <span class="mr-2 text-secondary">
-                <i class="fa fa-check text-sm"></i>
-                <span>MCP Onboarding Visit Completed</span>
-              </span>
-            </span>
+            @include('app.patient.partials.update-mcp-onboarding-visit-info')
             @endif
           </div>
         </div>
@@ -280,15 +345,18 @@ $addressParts .= implode(", ", $addressPart2);
         <div class="d-flex">
           <div>DOB: {{friendly_date($patient->dob, false,null, true)}} </div>
           @if($patient->getPrimaryCoverage() && $patient->getPrimaryCoverageStatus() === 'YES')
-          <div class="text-nowrap screen-only ml-2 pl-2 border-left">
-            {{$patient->getPrimaryCoverage()->insuranceDisplayName()}}
-            <span class="on-hover-show d-inline-block on-hover-opaque">
-              <i class="fa fa-check-circle text-success"></i>
-              <div class="on-hover-content py-2 pl-3 text-nowrap">
-                Covered
-              </div>
-            </span>
-          </div>
+            <div class="text-nowrap screen-only ml-2 pl-2 border-left">
+              {{$patient->getPrimaryCoverage()->insuranceDisplayName()}}
+              <span class="on-hover-show d-inline-block on-hover-opaque">
+                <i class="fa fa-check-circle text-success"></i>
+                <div class="on-hover-content py-2 pl-3 text-nowrap">
+                  Covered
+                </div>
+              </span> 
+            </div>
+            @if($performer->pro->pro_type == 'ADMIN')
+              <div class="ml-2">Deductible: {{@$patient->latestClientPrimaryCoverage->auto_medicare_mpb_remaining}} </div>
+            @endif 
           @endif
         </div>
       </div>
@@ -300,61 +368,7 @@ $addressParts .= implode(", ", $addressPart2);
       @include('app.patient.coverage-status')
     </div>
     @endif
-    <div class="bg-light p-2 border">
-      <div>
-        <label>MCP:</label> {{$mcpName}}
-        @if($patient->has_mcp_done_onboarding_visit !== 'YES' && $pro->pro_type == 'ADMIN')
-        <div moe class="ml-2 hide-inside-popup">
-          <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
-          <form url="/api/client/putMcp" class="mcp-theme-1">
-            <input type="hidden" name="uid" value="{{$patient->uid}}">
-            <div class="mb-2">
-              <label class="text-secondary text-sm">MCP Pro</label>
-              <select name="mcpProUid" provider-search data-pro-uid="{{ @$patient->mcp->uid }}" class="form-control form-control-sm">
-                <option value=""> --select--</option>
-                @foreach($pros as $iPro)
-                <option value="{{$iPro->uid}}" {{ $patient->mcp && $iPro->uid === $patient->mcp->uid ? 'selected' : '' }}>{{$iPro->displayName()}}</option>
-                @endforeach
-              </select>
-            </div>
-            <div>
-              <button submit class="btn btn-sm btn-primary mr-1">
-                Submit
-              </button>
-              <button cancel class="btn btn-sm btn-default border">
-                Cancel
-              </button>
-            </div>
-          </form>
-        </div>
-        @if($patient->mcp)
-        <div moe class="ml-2 hide-inside-popup">
-          <a start show><i class="fa fa-times on-hover-opaque"></i></a>
-          <form url="/api/client/removeMcp" class="mcp-theme-1">
-            <input type="hidden" name="uid" value="{{$patient->uid}}">
-            <div class="mb-2">
-              <label class="text-secondary text-sm">Remove MCP Pro</label>
-
-            </div>
-            <div>
-              <button submit class="btn btn-sm btn-primary mr-1">Submit
-              </button>
-              <button cancel class="btn btn-sm btn-default border">
-                Cancel
-              </button>
-            </div>
-          </form>
-        </div>
-        @endif
-        @endif
-        @if($patient->mcp && $pro->pro_type === 'ADMIN' && $pro->uid !== $patient->mcp->uid)
-        <form action="{{route('process-log-in-as')}}?redir={{request()->url()}}" onsubmit="window.top.localStorage.currentProUid = '{{$patient->mcp->uid}}';" method="POST" target="_top" class="d-inline-block">
-          @csrf
-          <input type="hidden" name="proUid" value="{{$patient->mcp->uid}}">
-          <button class="bg-transparent text-primary border-0 text-sm"><i class="fa fa-user on-hover-opaque"></i></button>
-        </form>
-        @endif
-      </div>
+    <div class="bg-light p-2 border d-none">
       @if($patient->mcp && $patient->mcp->id === $pro->id || $pro->pro_type == 'ADMIN')
       <div>
         <label>Status (mcp):</label>
@@ -394,56 +408,7 @@ $addressParts .= implode(", ", $addressPart2);
         </div>
       </div>
       @endif
-      <div>
-        <label>CC:</label> {{$patient->defaultNaPro ? $patient->defaultNaPro->displayName() : '-' }}
-        @if($pro->pro_type == 'ADMIN')
-        <div moe class="ml-2 hide-inside-popup">
-          <a start show><i class="fa fa-edit on-hover-opaque text-sm"></i></a>
-          <form url="/api/client/putDefaultNaPro" class="mcp-theme-1">
-            <input type="hidden" name="uid" value="{{$patient->uid}}">
-            <div class="mb-2">
-              <label class="text-secondary text-sm">Care Coordinator</label>
-              <select provider-search data-pro-uid="{{ @$patient->defaultNaPro->uid }}" name="defaultNaProUid" class="form-control form-control-sm">
-                <option value=""> --select--</option>
-                @foreach($pros as $iPro)
-                <option value="{{$iPro->uid}}" {{ $patient->pcp && $iPro->uid === $patient->pcp->uid ? 'selected' : '' }}>{{$iPro->displayName()}}</option>
-                @endforeach
-              </select>
-            </div>
-            <div>
-              <button submit class="btn btn-sm btn-primary mr-1">Submit
-              </button>
-              <button cancel class="btn btn-sm btn-default border">
-                Cancel
-              </button>
-            </div>
-          </form>
-        </div>
-        @if($patient->pcp)
-        <div moe class="ml-2 hide-inside-popup">
-          <a start show><i class="fa fa-times"></i></a>
-          <form url="/api/client/removeDefaultNaPro" class="mcp-theme-1">
-            <input type="hidden" name="uid" value="{{$patient->uid}}">
-            <div class="mb-2">
-              <label class="text-secondary text-sm">Remove Care Coordinator</label>
-
-            </div>
-            <div>
-              <button submit class="btn btn-sm btn-primary mr-1">Submit</button>
-              <button cancel class="btn btn-sm btn-default border">Cancel</button>
-            </div>
-          </form>
-        </div>
-        @endif
-        @endif
-        @if($patient->defaultNaPro && $pro->pro_type === 'ADMIN' && $pro->uid !== $patient->defaultNaPro->uid)
-        <form action="{{route('process-log-in-as')}}?redir={{request()->url()}}" onsubmit="window.top.localStorage.currentProUid = '{{$patient->defaultNaPro->uid}}';" method="POST" target="_top" class="d-inline-block">
-          @csrf
-          <input type="hidden" name="proUid" value="{{$patient->defaultNaPro->uid}}">
-          <button class="bg-transparent text-primary border-0 text-sm"><i class="fa fa-user on-hover-opaque"></i></button>
-        </form>
-        @endif
-      </div>
+      
       @if($patient->defaultNaPro && $patient->defaultNaPro->id === $pro->id || $pro->pro_type == 'ADMIN')
       <div>
         <label>Status (cc):</label>
@@ -489,6 +454,7 @@ $addressParts .= implode(", ", $addressPart2);
       <div>
         <div class="d-flex">
           <label class="">Sticky Note:</label>
+          @include('app.patient.partials.sticky-notes-history')
           <div moe relative wide class="ml-2 hide-inside-popup">
             <a start show><i class="fa fa-edit on-hover-opaque"></i></a>
             <form url="/api/client/updateStickyNote" class="mcp-theme-1" right>

+ 13 - 5
resources/views/layouts/patient.blade.php

@@ -255,12 +255,12 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 		@endif
 		<main role="main" class="w-100 {{$trimLayout || $isVisitNote ? 'p-0' : ''}}">
 			@if($pro->is_enrolled_as_mcp && !$patient->mcp)
-			<div class="alert alert-info bg-white mt-3 mcp-theme-1 p-3 hide-inside-ticket-popup m-1">
-				<div class="font-size-16">
+			<div class="d-flex align-items-center alert alert-info bg-white mcp-theme-1 p-3 hide-inside-ticket-popup m-1">
+				<div class="font-size-16 mr-3">
 					<i class="fa fa-exclamation-triangle text-warning-mellow"></i>
 					This patient currently does not have an MCP assigned.
 				</div>
-				<div class="mt-3 d-flex align-items-center">
+				<div class="d-flex align-items-center">
 					<button class="btn btn-info" onclick="$('.in-conv-confirmed').removeClass('d-none').addClass('d-inline-flex')">I am currently seeing or talking to this patient</button>
 					<div class="in-conv-confirmed d-none align-items-center">
 						<i class="fa fa-chevron-right mx-3 text-secondary"></i>
@@ -302,8 +302,9 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 					</div>
 				</div>
 				@if($pro->pro_type === 'ADMIN')
-				<div class="screen-only card-header py-2 d-flex align-items-center mcp-theme-1 bg-aliceblue hide-inside-popup">
-					<b class="">Tags ({{count($patient->clientTags)}}):</b>
+				<div class="screen-only card-header py-2 d-flex align-items-start justify-content-between mcp-theme-1 bg-aliceblue hide-inside-popup">
+					<div class="d-flex align-items-center">
+						<b class="">Tags ({{count($patient->clientTags)}}):</b>
 					@foreach($patient->clientTags as $tag)
 					<div class="d-inline-flex align-items-center ml-2 py-1 px-2 rounded bg-aliceblue text-info">
 						<span class="text-sm">{{$tag->tag}}</span>
@@ -334,6 +335,13 @@ $isOldClient = (date_diff(date_create(config('app.point_impl_date')), date_creat
 							</div>
 						</form>
 					</div>
+					</div>
+
+					<div>
+						<span class="mr-2"><b>Best Time to Call:</b> {{ $patient->best_time_to_call ?? '-' }}</span>
+						@include('app.patient.partials.update-best-time-to-call')
+					</div>
+					
 				</div>
 				@endif
 				{{--<div class="text-container border-bottom d-flex align-items-center mcp-theme-1 px-3">

+ 1 - 0
resources/views/layouts/template.blade.php

@@ -193,6 +193,7 @@
                             <a class="dropdown-item" href="{{ route('practice-management.visitTemplates') }}">Visit Templates</a>
                             <a class="dropdown-item" href="{{ route('admin.part_b_patients') }}">Part B Patients</a>
                             <a class="dropdown-item" href="{{ route('admin.bdt_devices') }}">BDT Devices</a>
+                            <a class="dropdown-item" href="{{ route('admin.patientsMissingDefasultSettings') }}">Patients Missing Default Settings</a>
                         @elseif($pro->is_enrolled_as_mcp && $pro->is_considered_for_mcp_assignment)
 
                             <a class="dropdown-item" href="{{ route('practice-management.financialTransactions') }}">Financial Transactions</a>

+ 1 - 1
routes/web.php

@@ -219,7 +219,7 @@ Route::middleware('pro.auth')->group(function () {
         Route::get('reports', 'AdminController@reports')->name('reports');
         Route::get('supply-orders', 'AdminController@supply_orders')->name('supply_orders');
         Route::get('get-create-new-patient-script-template', 'AdminController@getCreateNewPatientScriptTemplate')->name('getCreateNewPatientScriptTemplate');
-    
+        Route::get('patients-missing-defult-settings', 'AdminController@patientsMissingDefasultSettings')->name('patientsMissingDefasultSettings');
        
     });