Browse Source

Dashboard memos - show only latest 10 + UI updates

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

+ 16 - 1
app/Http/Controllers/HomeController.php

@@ -398,8 +398,23 @@ WHERE
       cm.mcp_stamp_id IS NULL
       AND (is_admin_only IS FALSE OR is_admin_only IS NULL)
 ORDER BY cm.created_at DESC
+OFFSET 0 LIMIT 10
             ")
         );
+        $mcpClientMemosCount = DB::select(
+            DB::raw("
+SELECT count(c.uid)
+FROM client c join client_memo cm on c.id = cm.client_id
+WHERE
+      c.mcp_pro_id = {$performerProID} AND
+      cm.mcp_stamp_id IS NULL
+      AND (is_admin_only IS FALSE OR is_admin_only IS NULL)
+            ")
+        );
+        if($mcpClientMemosCount && count($mcpClientMemosCount)) {
+            $mcpClientMemosCount = $mcpClientMemosCount[0]->count;
+        }
+
         // for na
         $naClientMemos = DB::select(
             DB::raw("
@@ -523,7 +538,7 @@ WHERE cl.shadow_pro_id IS NULL
             'incomingReports', 'tickets', 'supplyOrders',
             'numERx', 'numLabs', 'numImaging', 'numSupplyOrders',
             'newMCPAssociations', 'newNAAssociations',
-            'mcpClientMemos', 'naClientMemos'));
+            'mcpClientMemos', 'mcpClientMemosCount', 'naClientMemos'));
     }
 
     private function dashboard_DNA(Request $request){

+ 8 - 10
resources/views/app/mcp/dashboard/calls_memos.blade.php

@@ -2,13 +2,6 @@
 <div class="px-2 py-3">No memos</div>
 @else
 <table class="table table-sm m-0">
-	<thead>
-		<tr>
-			<th class="w-25">Client</th>
-			<th class="w-50">Content</th>
-			<th class="w-25">Created At</th>
-		</tr>
-	</thead>
 	<tbody>
 		@foreach($mcpClientMemos as $memo)
 		<tr>
@@ -21,10 +14,10 @@
 				</div>
 			</td>
 			<td class="px-1">
-				<div class="on-hover-text-reveal width-200px">{{$memo->content}}</div>
+				{{$memo->content}}
 			</td>
-			<td class="px-1">
-				<div moe relative>
+			<td class="width-70px px-2 text-right">
+				<div moe relative class="ml-auto">
 					<form show url="/api/clientMemo/stamp">
 						<input type="hidden" name="uid" value="{{$memo->uid}}">
 						<button submit class="bg-transparent border-0 p-0 text-primary font-underline">Stamp</button>
@@ -35,4 +28,9 @@
 		@endforeach
 	</tbody>
 </table>
+@if($mcpClientMemosCount > 10)
+	<div class="p-2 border-top bg-light text-center">
+		Showing 1 to 10 of {{$mcpClientMemosCount}} unstamped memos
+	</div>
+@endif
 @endif