소스 검색

Current work indicator

Vijayakrishnan 4 년 전
부모
커밋
2ac1ed77c4

+ 4 - 0
app/Http/Controllers/PracticeManagementController.php

@@ -170,4 +170,8 @@ class PracticeManagementController extends Controller
         }
         return json_encode($results);
     }
+
+    public function currentWork(Request $request) {
+        return view('app/current-work');
+    }
 }

+ 4 - 0
app/Models/Pro.php

@@ -80,6 +80,10 @@ class Pro extends Model
             ->orderBy('position_index', 'asc');
     }
 
+    public function currentWork() {
+        return ProClientWork::where('pro_id', $this->id)->where('is_active', true)->first();
+    }
+
     public function isWorkingOnClient($_client) {
         $count = ProClientWork::where('pro_id', $this->id)->where('client_id', $_client->id)->where('is_active', true)->count();
         return $count > 0;

+ 4 - 0
app/Models/ProClientWork.php

@@ -8,4 +8,8 @@ class ProClientWork extends Model
 {
     protected $table = 'pro_client_work';
 
+    public function client()
+    {
+        return $this->hasOne(Client::class, 'id', 'client_id');
+    }
 }

+ 11 - 0
public/css/style.css

@@ -786,3 +786,14 @@ body .node input[type="number"] {
 .queue-item:hover {
     background: aliceblue;
 }
+.current-work-indicator {
+    position: fixed;
+    top: 55px;
+    right: 0;
+    z-index: 9999;
+    background: #1c45879c;
+    color: #fff;
+    font-size: 12px;
+    padding: 3px 8px;
+    border-bottom-left-radius: 5px;
+}

+ 11 - 0
resources/views/app/current-work.blade.php

@@ -0,0 +1,11 @@
+<?php $currentWork = $pro->currentWork(); ?>
+@if($currentWork)
+    <div class="current-work-indicator">
+        <i class="fa fa-clock mr-1"></i>
+        Current work:
+        <a class="text-white font-weight-bold" href="/patients/view/{{ $currentWork->client->uid }}">
+            {{ $currentWork->client->displayName() }}
+        </a>
+        <span class="pl-3">Started: <b>{{ friendly_time($currentWork->start_time) }}</b></span>
+    </div>
+@endif

+ 10 - 3
resources/views/layouts/template.blade.php

@@ -125,13 +125,16 @@
         </a>
     </nav>
 
-
     <main role="main" class="stag-content px-0">
 
         @yield('content')
 
     </main><!-- /.container -->
 
+    {{-- if pro is working on a client and is not in tht client --}}
+    <div class="current-work">
+        @include('app/current-work')
+    </div>
 
     <!-- shortcut/suggest component -->
     <link href="/css/shortcut.css" rel=stylesheet>
@@ -245,6 +248,12 @@
                 fastLoad('/patients/view/' + $(this).attr('data-target-uid'), true, false, false);
                 return false;
             });
+
+            window.setInterval(function() {
+                $.get('/current-work', function(_data) {
+                    $('.current-work').html(_data);
+                });
+            }, 2500);
         });
     </script>
     <script>
@@ -293,8 +302,6 @@
         })();
     </script>
 
-    {{-- if pro is working on a client and is not in tht client --}}
-
 </body>
 
 </html>

+ 1 - 0
routes/web.php

@@ -135,6 +135,7 @@ Route::middleware('pro.auth')->group(function () {
     Route::get('/pro/meet/{uid?}', 'PracticeManagementController@meet');
     Route::get('/pro/get-opentok-session-key/{uid}', 'PracticeManagementController@getOpentokSessionKey');
     Route::get('/patients-in-queue', 'PracticeManagementController@getPatientsInQueue');
+    Route::get('/current-work', 'PracticeManagementController@currentWork');
 
     //Notes stuff
     Route::get('/note/{note_uid}', 'NoteController@renderNote')->name('render-note');