Bläddra i källkod

Popup matrix: Notes Pending Signature

Vijayakrishnan 3 år sedan
förälder
incheckning
20d456ff51

+ 7 - 2
app/Http/Controllers/McpController.php

@@ -99,8 +99,13 @@ class McpController extends Controller
         return view('app.mcp.new_patients_awaiting_visit', $data);
     }
     public function notes_pending_signature(Request $request){
-        $data = [];
-        // SELECT * FROM note WHERE hcp_pro_id = :me.id AND
+        $data = [
+            'records' => Note::where('hcp_pro_id', $this->performer->pro->id)
+                ->where('is_cancelled', '<>', true)
+                ->where('is_signed_by_hcp', '<>', true)
+                ->orderBy('created_at')
+                ->get()
+        ];
         return view('app.mcp.notes_pending_signature', $data);
     }
     public function notes_pending_billing(Request $request){

+ 12 - 0
app/Models/Note.php

@@ -44,6 +44,18 @@ class Note extends Model
             ->where('status', '<>', 'CANCELLED');
     }
 
+    // Signed/Billed/Verified/Processed/Cancelled
+    public function overallStatus()
+    {
+        $status = 'New';
+        if ($this->is_cancelled) $status = 'Cancelled';
+        else {
+            if ($this->hasTreatmentServicesBillByHCP()) $status = 'Billed';
+            else if ($this->is_signed_by_hcp) $status = 'Signed';
+        }
+        return $status . ' **';
+    }
+
     public function bills()
     {
         return $this->hasMany(Bill::class, 'note_id', 'id')

+ 44 - 15
resources/views/app/mcp/notes_pending_signature.blade.php

@@ -1,19 +1,48 @@
-@extends ('layouts/template')
+<div class="p-3 mcp-theme-1">
+    <div class="card">
 
-@section('content')
-    <div class="p-3 mcp-theme-1" id="patients-list">
-        <div class="card">
-
-            <div class="card-header px-3 py-2 d-flex align-items-center">
-                <strong class="mr-4">
-                    <i class="fas fa-user-injured"></i>
-                    Notes Pending Signature
-                </strong>
-            </div>
-
-            <div class="card-body p-0">
+        <div class="card-header px-3 py-2 d-flex align-items-center border-bottom-0">
+            <strong class="mr-4">
+                <i class="fas fa-user-injured"></i>
+                Notes Pending Signature
+            </strong>
+        </div>
 
-            </div>
+        <div class="card-body p-0 border-top-0 pb-0">
+            <table class="table table-sm table-striped mb-0">
+                <thead>
+                <tr>
+                    <th class="border-bottom-0">Date</th>
+                    <th class="border-bottom-0">Patient</th>
+                    <th class="border-bottom-0">ICD</th>
+                    <th class="border-bottom-0">Status</th>
+                </tr>
+                </thead>
+                <tbody>
+                @foreach($records as $row)
+                    <tr>
+                        <td class="border-bottom-0">
+                            <a href="/patients/view/{{ $row->client->uid }}/notes/view/{{ $row->uid }}" class="font-weight-bold">
+                                {{ friendlier_date($row->effective_dateest) }}
+                            </a>
+                        </td>
+                        <td class="border-bottom-0">{{$row->client->displayName()}}</td>
+                        <td class="border-bottom-0">
+                            @foreach($row->reasons as $reason)
+                                <span class="pr-2">{{$reason->code}}</span>
+                            @endforeach
+                            @if(!!$row->reasons)
+                                -
+                            @endif
+                        </td>
+                        <td class="border-bottom-0">
+                            {{$row->overallStatus()}}
+                        </td>
+                    </tr>
+                @endforeach
+                </tbody>
+            </table>
         </div>
     </div>
-@endsection
+</div>
+