Kaynağa Gözat

Client rep follow up - admin dashboard UI updates

Vijayakrishnan 3 yıl önce
ebeveyn
işleme
aeaf8ab8ba

+ 3 - 2
app/Models/Pro.php

@@ -1388,6 +1388,7 @@ ORDER BY cm.created_at DESC
     public function followupsScheduledForToday() {
         return DB::select(DB::raw("
             SELECT crfu.id AS crfu_id,
+                   crfu.uid,
                 crfu.next_follow_up_reason,
                 crfu.next_follow_up_memo,
                 pro.name_first as pro_first_name, 
@@ -1398,8 +1399,8 @@ ORDER BY cm.created_at DESC
             FROM client_rep_follow_up crfu 
             join client c on crfu.id = c.client_rep_follow_up_id
             join pro pro on pro.id = crfu.client_rep_pro_id
-            -- WHERE crfu.client_rep_pro_id = :pro_id 
-            WHERE crfu.next_follow_up_date = :date
+            WHERE crfu.status = 'SCHEDULED' 
+            AND crfu.next_follow_up_date = :date
             ORDER BY crfu.created_at DESC;
         "), ['date' => date('Y-m-d')]);
     }

+ 12 - 28
resources/views/app/dashboard-admin.blade.php

@@ -371,6 +371,7 @@
                         </div>
                     @endif
                 </div>
+                <?php $fus = $pro->followupsScheduledForToday(); ?>
                 <div class="col-md-9">
                     <ul class="nav nav-tabs">
                         <li class="nav-item">
@@ -433,6 +434,14 @@
                                 Supply Orders ({{$numSupplyOrders}})
                             </a>
                         </li>
+                        <li class="nav-item">
+                            <a native data-tab="calls_pending"
+                               class="nav-link {{$fus && count($fus) ? 'text-danger font-weight-bold' : ''}}"
+                               :class="tab == 'calls_pending' ? 'active' : ''" href="#"
+                               v-on:click.prevent="tab='calls_pending'">
+                                Calls Pending ({{count($fus)}})
+                            </a>
+                        </li>
                     </ul>
 
                     <div class="border-left border-right border-bottom p-3">
@@ -631,39 +640,14 @@
                         <div v-show="tab==='supply_orders'">
                             @include('app.dashboard.supply_orders')
                         </div>
+                        <div v-show="tab==='calls_pending'">
+                            @include('app.dashboard.calls_pending')
+                        </div>
                     </div>
 
                     <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>Assigned To</th>
-                                            <th>Reason</th>
-                                            <th>Status</th>
-                                        </tr>
-                                        </thead>
-                                        <tbody>
-                                        @foreach($fus as $fu)
-                                            <tr>
-                                                <td><a href="/patients/view/{{$fu->client_uid}}">{{$fu->client_name}}</a></td>
-                                                <td>{{$fu->pro_first_name}} {{$fu->pro_last_name}}</td>
-                                                <td>{{$fu->next_follow_up_reason}}</td>
-                                                <td>{{$fu->status}}</td>
-                                            </tr>
-                                        @endforeach
-                                        </tbody>
-                                    </table>
-                                @else
-                                    <div class="text-secondary p-2">No follow ups scheduled for today!</div>
-                                @endif
-                            </div>
                         </div>
                         <div class="col-6">
 

+ 60 - 0
resources/views/app/dashboard/calls_pending.blade.php

@@ -0,0 +1,60 @@
+<div class="d-flex align-items-end mb-3">
+    <b class="large">Calls pending for today</b>
+</div>
+<?php
+$nextFUStatus = [
+    "SCHEDULED",
+    "CANCELLED",
+    "COMPLETED",
+];
+?>
+@if(count($fus))
+    <table class="table table-sm table-striped table-bordered">
+        <thead>
+        <tr>
+            <th class="border-0">Client</th>
+            <th class="border-0">Assigned To</th>
+            <th class="border-0">Reason</th>
+            <th class="border-0">Status</th>
+            <th class="border-0"></th>
+        </tr>
+        </thead>
+        <tbody>
+        @foreach($fus as $fu)
+            <tr>
+                <td><a href="/patients/view/{{$fu->client_uid}}">{{$fu->client_name}}</a></td>
+                <td>{{$fu->pro_first_name}} {{$fu->pro_last_name}}</td>
+                <td>{{$fu->next_follow_up_reason}}</td>
+                <td>{{$fu->status}}</td>
+                <td>
+                    <div moe relative="">
+                        <a href="#" start show>Edit Status</a>
+                        <form url="/api/clientRepFollowUp/update-status" right>
+                            <input type="hidden" name="uid" value="{{$fu->uid}}">
+                            <div class="mb-2">
+                                <label for="" class="text-secondary mb-1">Status</label>
+                                <select class="form-control input-sm" name="status">
+                                    <option value=""></option>
+                                    @foreach($nextFUStatus as $fuStatus)
+                                        <option {{ $fu->status == $fuStatus ? 'selected':'' }}>{{ $fuStatus }}</option>
+                                    @endforeach
+                                </select>
+                            </div>
+                            <div class="mb-2">
+                                <label for="" class="text-sm text-secondary mb-1">Call Memo</label>
+                                <textarea class="form-control input-sm" name="nextFollowUpMemo">{{ $fu->next_follow_up_memo ?: '' }}</textarea>
+                            </div>
+                            <div class="d-flex align-items-center">
+                                <button class="btn btn-sm btn-primary mr-2" submit>Submit</button>
+                                <button class="btn btn-sm btn-default mr-2 border" cancel>Cancel</button>
+                            </div>
+                        </form>
+                    </div>
+                </td>
+            </tr>
+        @endforeach
+        </tbody>
+    </table>
+@else
+    <div class="text-secondary p-2">No follow ups scheduled for today!</div>
+@endif