Selaa lähdekoodia

Dashboard updates

Samson Mutunga 1 vuosi sitten
vanhempi
commit
2c7675282c

+ 7 - 0
app/Models/UserEvent.php

@@ -18,4 +18,11 @@ class UserEvent extends BaseModel
     public function createdByUser(){
         return $this->hasOne(User::class, 'id', 'created_by_user_id');
     }
+    public function detailJson($toArray = false)
+    {
+        if($toArray){
+            return json_decode($this->detail_json ?? '{}', true);
+        }
+        return json_decode($this->detail_json ?? '{}');
+    }
 }

+ 11 - 6
resources/views/app/my-account/admin/dashboard.blade.php

@@ -15,32 +15,37 @@
                             {{ $c }}
                         </th>
                         <th class="pl-2 w-100">
-                            Client{{$c === 1 ? '' : 's'}}
+                            <a href="{{route('admin.users')}}">Client{{$c === 1 ? '' : 's'}}</a>
                         </th>
                     </tr>
                     <tr>
                         <?php $c = \App\Models\StoreOrder::count(); ?>
                         <th class="px-2 bg-light fw-bold text-nowrap">{{$c}}</th>
                         <th class="pl-2">
-                            Order{{$c === 1 ? '' : 's'}}
+                            <a href="{{route('admin.orders')}}">Order{{$c === 1 ? '' : 's'}}</a>
                         </th>
                     </tr>
                     <tr>
                         <th class="px-2 bg-light fw-bold text-nowrap">{{displayAmount('$', $ordersTotal)}}</th>
                         <th class="pl-2">
-                            Order Value
+                            <a href="{{route('admin.orders')}}">Order Value</a>
                         </th>
                     </tr>
                     </tbody>
                 </table>
-
+            </div>
+            <div class="col-lg-6">
                 <h2 class="font-size-14 fw-bold mb-2">Action Pending</h2>
                 <table class="table table-sm table-bordered dashboard-stats-table">
                     <tbody>
                     <tr>
-                        <?php $c = \App\Models\User::whereRaw("(app_user.id NOT IN (SELECT user_id FROM store_order))")->count(); ?>
+                        <?php 
+                            $c = \App\Models\User::whereHas('storeOrdersAsClient', function($qry){
+                                    return $qry->whereRaw('(store_order.id NOT IN (SELECT financial_transaction.order_id FROM financial_transaction))');
+                                })->orderBy('created_at', 'DESC')->paginate(30);
+                        ?>
                         <th class="px-2 bg-light fw-bold text-nowrap min-width-70px">
-                            {{ $c }}
+                            {{ $c->total() }}
                         </th>
                         <th class="pl-2 w-100">
                             <a href="{{route('admin.report', 'new-orders-pending-processing')}}">Users With New order{{$c === 1 ? '' : 's'}} pending processing</a>

+ 1 - 1
resources/views/app/my-account/admin/user-events/partials/table.blade.php

@@ -19,7 +19,7 @@
                     <td>{{ $userEvent->entity_uid }}</td>
                     <td>{{ $userEvent->event }}</td>
                     <td>
-                        <?php parseRender(json_decode($userEvent->detail_json)); ?>
+                        <?= parseRender($userEvent->detailJson()); ?>
                     </td>
                     <td>
                         @if ($userEvent->user)