Explorar o código

Show client online status and who (all) he is in call with - in client single dashboard

Vijayakrishnan Krishnan %!s(int64=5) %!d(string=hai) anos
pai
achega
1ef2abe544

+ 5 - 1
app/Http/Controllers/clients_SINGLE_Controller.php

@@ -3,6 +3,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Models\Pro;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Auth;
@@ -389,7 +390,10 @@ class clients_SINGLE_Controller extends Controller
 	public function SUB_dashboard(Request $request, $uid) {
 		$record = Client::where("uid", $uid)->first();
 		$careMonth = $record->careMonth;//TODO: get caremonth selected from the UI
-		return response()->view('pro/clients_SINGLE/SUB_dashboard', compact('record', 'careMonth'), session('message') ? 500 : 200)->header('Content-Type', 'text/html');
+        $inCallWithPros = Pro::where('in_meeting_with_client_id', $record->id)->get();
+		return response()->view('pro/clients_SINGLE/SUB_dashboard',
+            compact('record', 'careMonth', 'inCallWithPros'),
+            session('message') ? 500 : 200)->header('Content-Type', 'text/html');
 	}
 
 	// GET /clients/view/{uid}/SUB_detail

+ 25 - 4
resources/views/pro/clients_SINGLE/SUB_dashboard.blade.php

@@ -7,14 +7,35 @@
         <div class="col-md-12">
             <p>{{$record->name_display()}}</p>
 
-            <div class="p-3 border d-flex align-items-center mb-3">
-                <span class="mr-3">Video:
+            <div class="p-3 border small mb-3">
+                <div class="mr-3 my-1">Online:
+                    <span class="font-weight-bold">
+                        <?= $record->is_online ? '<span class="text-success">YES</span>' : '<span class="text-secondary">NO</span>' ?>
+                    </span>
+                </div>
+                <div class="mr-3 my-1">Video:
                     <span class="font-weight-bold">
                         <?= $record->is_client_video_turned_on ? '<span class="text-success">ON</span>' : '<span class="text-secondary">OFF</span>' ?>
                     </span>
-                </span>
+                    @if(isset($inCallWithPros) && count($inCallWithPros))
+                        <div class="my-1 font-weight-bold">Currently talking to:</div>
+                        @foreach($inCallWithPros as $inCallPro)
+                            <div class="d-block my-1">
+                                <i class="fa fa-chevron-right mr-1"></i>
+                                <a href="/mc/pros/view/{{ $inCallPro->uid }}/SUB_dashboard" class="text-primary">
+                                    {{ $inCallPro->name_display }}
+                                </a>
+                            </div>
+                        @endforeach
+                    @endif
+                </div>
                 @if($record->is_client_video_turned_on)
-                    <a href="#" class="text-primary font-weight-bold" onclick="return window.top.openInRHS('/pro/meet/{{ $record->uid }}')">Go to Call</a>
+                    <div>
+                        <a href="#" class="btn btn-sm btn-primary text-primary mt-2 font-weight-bold px-3" onclick="return window.top.openInRHS('/pro/meet/{{ $record->uid }}')">
+                            <i class="fa fa-phone mr-1"></i>
+                            Go to Call
+                        </a>
+                    </div>
                 @endif
             </div>