Browse Source

Client follow up UI

Vijayakrishnan 3 năm trước cách đây
mục cha
commit
eae0e128e5

+ 14 - 0
app/Models/Pro.php

@@ -1369,4 +1369,18 @@ ORDER BY cm.created_at DESC
         return $this->activeClientReviewRequests->where('client_id', $clientID)->where('scoped_month_start_date', date('Y-m-01'))->first();
 
     }
+
+    public function followupsScheduledForToday() {
+        return DB::select(DB::raw("
+SELECT crfu.id AS crfu_id,
+       crfu.next_follow_up_reason,
+       crfu.next_follow_up_memo,
+       c.uid as client_uid,
+       (c.name_first || ' ' || c.name_last) as client_name
+FROM client_rep_follow_up crfu join client c on crfu.id = c.client_rep_follow_up_id
+WHERE crfu.client_rep_pro_id = :pro_id
+  AND crfu.next_follow_up_date = :date
+  ORDER BY crfu.created_at DESC;
+        "), ["pro_id" => $this->id, 'date' => date('Y-m-d')]);
+    }
 }

+ 32 - 2
resources/views/app/dashboard-admin.blade.php

@@ -430,6 +430,36 @@
 
                     <div class="row mt-3">
                         <div class="col-6">
+
+                            <div class="mb-3">
+                                <p class="mb-2 font-weight-bold text-secondary">Follow ups scheduled for today</p>
+                                <?php $fus = $pro->followupsScheduledForToday(); ?>
+                                @if(count($fus))
+                                    <table class="table table-sm table-striped">
+                                        <thead>
+                                        <tr>
+                                            <th>Client</th>
+                                            <th>Reason</th>
+                                            <th>Memo</th>
+                                        </tr>
+                                        </thead>
+                                        <tbody>
+                                        @foreach($fus as $fu)
+                                            <tr>
+                                                <td><a href="/patients/view/{{$fu->client_uid}}">{{$fu->client_name}}</a></td>
+                                                <td>{{$fu->next_follow_up_reason}}</td>
+                                                <td>{{$fu->next_follow_up_memo}}</td>
+                                            </tr>
+                                        @endforeach
+                                        </tbody>
+                                    </table>
+                                @else
+                                    <span class="text-secondary">No follow ups scheduled for today!</span>
+                                @endif
+                            </div>
+                        </div>
+                        <div class="col-6">
+
                             @if(request()->input('mcpas'))
                                 @if(count($newMCPAssociations))
                                     <div class="mb-3 border rounded px-3 py-2 ack-container">
@@ -535,8 +565,8 @@
                                     <a href="/?naas=1" class="d-block">You have <b>{{$newNAAssociations}}</b> new NA association{{$newNAAssociations === 1 ? '' : 's'}}</a>
                                 @endif
                             @endif
-                        </div>
-                        <div class="col-6">
+
+
                             @if(request()->input('mcpcm'))
                                 @if(count($mcpClientMemos))
                                     <div class="mb-3 border rounded px-3 py-2 ack-container table-responsive">

+ 34 - 0
resources/views/app/dashboard-mcp.blade.php

@@ -380,6 +380,40 @@
                 <div class="col-md-9 pl-1">
                     <div class="row mcp-theme-1">
                         <div class="col-md-6 mcp-theme-1">
+
+                            <div class="card mb-4">
+                                <div class="card-header pl-2">
+                                    <strong>
+                                        Follow ups scheduled for today
+                                    </strong>
+                                </div>
+                                <div class="card-body p-0">
+                                    <?php $fus = $pro->followupsScheduledForToday(); ?>
+                                    @if(count($fus))
+                                        <table class="table table-sm table-striped m-0">
+                                            <thead>
+                                            <tr>
+                                                <th>Client</th>
+                                                <th>Reason</th>
+                                                <th>Memo</th>
+                                            </tr>
+                                            </thead>
+                                            <tbody>
+                                            @foreach($fus as $fu)
+                                                <tr>
+                                                    <td><a href="/patients/view/{{$fu->client_uid}}">{{$fu->client_name}}</a></td>
+                                                    <td>{{$fu->next_follow_up_reason}}</td>
+                                                    <td>{{$fu->next_follow_up_memo}}</td>
+                                                </tr>
+                                            @endforeach
+                                            </tbody>
+                                        </table>
+                                    @else
+                                        <span class="text-secondary">No follow ups scheduled for today!</span>
+                                    @endif
+                                </div>
+                            </div>
+
                             <div id="mcp-dashboard-appointments" class="mb-4">
 
                             </div>