Browse Source

Search by tag + minor UI polish

Vijayakrishnan Krishnan 2 weeks ago
parent
commit
e7b3a7ee4e

+ 14 - 0
app/Http/Controllers/AdminController.php

@@ -329,6 +329,20 @@ class AdminController extends Controller
 
         }
 
+        // search by tag
+        if ($request->input('tags')) {
+            $tags = trim($request->input('tags'));
+            if ($tags) {
+                try {
+                    $condSql = "((SELECT COUNT(ct.id) FROM client_tag ct WHERE ct.client_id = admin_patient_list.id AND UPPER(ct.tag) LIKE '%" . strtoupper($tags) . "%') > 0)";
+                    $patients = $patients->whereRaw($condSql);
+                }
+                catch (\Exception $e) {
+                    dd($e->getMessage());
+                }
+            }
+        }
+
         $sortBy = $request->input('sort_by') ?: 'name_first';
         $sortDir = $request->input('sort_dir') ?: 'ASC';
 

+ 2 - 2
public/css/style.css

@@ -2524,7 +2524,7 @@ body.in-iframe .main-row > .sidebar {
     border-right: 1px solid #ddd;
     border-left: 1px solid #ddd;
     height: 300px;
-    overflow: hidden;
+    overflow: overlay;
     max-height: calc(100vh - 55px);
     background-color: #fff;
 }
@@ -2801,7 +2801,7 @@ table.table-cage tbody tr td:last-child {
 }
 
 table.table-cage tbody tr td:nth-last-child(2) {
-    width: 100% !important;
+    width: 50% !important;
     border-right: 0 !important;
 }
 

+ 9 - 1
resources/views/app/admin/patients_filters.blade.php

@@ -440,6 +440,13 @@ use App\Models\Company;
 		</div>
 	</div>
 
+	<div class="sm-section">
+		<div class="">
+			<label>Tag:</label>
+			<input name="tags" class="form-control input-sm" v-model="filters.tags">
+		</div>
+	</div>
+
 	@if($performer->pro->pro_type == 'ADMIN')
 	<div class="sm-section">
 		<div class="">
@@ -567,7 +574,8 @@ $allFilterKeys = [
 	'has_temp_fun',
 	'imei',
 	'mapView',
-	'company'
+	'company',
+	'tags'
 ];
 for ($i=0; $i < count($allFilterKeys); $i++) {
 	if (!isset($loadedFilters[$allFilterKeys[$i]]) || !$loadedFilters[$allFilterKeys[$i]]) {