Parcourir la source

show filters in head of table

Alexander Musikhin il y a 6 mois
Parent
commit
0e71195efb
3 fichiers modifiés avec 56 ajouts et 10 suppressions
  1. 27 0
      app/Models/OrderView.php
  2. 7 1
      resources/sass/app.scss
  3. 22 9
      resources/views/partials/table.blade.php

+ 27 - 0
app/Models/OrderView.php

@@ -10,7 +10,34 @@ class OrderView extends Model
     const DEFAULT_SORT_BY = 'created_at';
 
 
+
+
     protected $table = 'orders_view';
+
+    protected $fillable = [
+        'year',
+        'name',
+        'user_id',
+        'district_id',
+        'area_id',
+        'object_address',
+        'object_type_id',
+        'comment',
+        'installation_date',
+        'ready_date',
+        'brigadier_id',
+        'order_status_id',
+        'tg_group_name',
+        'tg_group_link',
+        'ready_to_mount',
+        'user_name',
+        'district_name',
+        'area_name',
+        'object_type_name',
+        'brigadier_name',
+        'order_status_name',
+    ];
+
     public $appends = ['common_name', 'products_with_count'];
 
 

+ 7 - 1
resources/sass/app.scss

@@ -31,7 +31,7 @@
 .table-buttons {
   position: fixed;
   right: 0;
-  opacity: 0.5;
+  opacity: 0.7;
   z-index: 999;
 }
 .table-buttons:hover {
@@ -46,6 +46,10 @@
   td {
     cursor: pointer;
   }
+
+  th {
+    border-right: 1px solid #d7d7d7;
+  }
 }
 
 .maf:hover, tr:hover td {
@@ -56,6 +60,8 @@
   padding: 3px;
 }
 
+
+
 .pagination .text-muted {
   padding-right: 1rem;
 }

+ 22 - 9
resources/views/partials/table.blade.php

@@ -4,12 +4,12 @@
     <div class="table-buttons py-2 bg-primary rounded-start d-flex flex-column ">
         <button type="button" class="btn btn-sm text-white" data-bs-toggle="modal"
                 data-bs-target="#table_{{ $id }}_modal_search">
-            <i class="bi bi-search"></i>
+            <i class="bi bi-search-heart @if(request()->has('s')) text-danger @endif"></i>
         </button>
 
         <button type="button" class="btn btn-sm text-white " data-bs-toggle="modal"
                 data-bs-target="#table_{{ $id }}_modal_filters">
-            <i class="bi bi-funnel-fill"></i>
+            <i class="bi bi-funnel-fill @if(request()->has('filters')) text-danger @endif"></i>
         </button>
 
         <button type="button" class="btn btn-sm text-white " data-bs-toggle="modal"
@@ -22,23 +22,36 @@
         <tr>
             @foreach($header as $headerName => $headerTitle)
                 <th scope="col" class="bg-primary-subtle column_{{ $headerName }}">
-                        <span class="cursor-pointer sort-by-column" data-name="{{ $headerName }}">
+                    <div class="d-flex align-items-center justify-content-between">
+
+                        <div class="cursor-pointer sort-by-column" data-name="{{ $headerName }}">
                             {{ $headerTitle }}
-                            @if(str_starts_with($headerName, $sortBy))
+                        </div>
+                        <div class="text-center mx-1 cursor-pointer sort-by-column" data-name="{{ $headerName }}">
+                            @if(($headerName== $sortBy))
                                 @if($orderBy === 'asc')
-                                    <i class="bi bi-arrow-up"></i>
+                                    <i class="bi bi-arrow-up-square-fill text-primary"></i>
                                 @else
-                                    <i class="bi bi-arrow-down"></i>
+                                    <i class="bi bi-arrow-down-square-fill text-primary"></i>
                                 @endif
                             @endif
-
+                        </div>
+                        <div class="text-end cursor-pointer">
+                            <i data-bs-toggle="modal"
+                               data-bs-target="#table_{{ $id }}_modal_filters"
+                                    class="bi
                             @if(isset(request()->filters[$headerName]) ||
                                 isset(request()->filters[str_replace('_txt', '', $headerName) . '_from']) ||
                                 isset(request()->filters[str_replace('_txt', '', $headerName) . '_to'])
                                 )
-                                <i class="bi bi-funnel"></i>
+                                bi-funnel-fill text-danger
+                                @else
+                                bi-funnel
                             @endif
-                        </span>
+                            "></i>
+                        </div>
+                    </div>
+
                 </th>
             @endforeach