Browse Source

feat: ✨ Added Resource plan-/product-data to server card

IceToast 3 years ago
parent
commit
5a05c5f846
2 changed files with 12 additions and 4 deletions
  1. 2 2
      app/Http/Controllers/ServerController.php
  2. 10 2
      resources/views/servers/index.blade.php

+ 2 - 2
app/Http/Controllers/ServerController.php

@@ -44,9 +44,9 @@ class ServerController extends Controller
             $server->nest = $serverRelationships['nest']['attributes']['name'];
 
             //get productname by product_id for server
-            $productName = Product::find($server->product_id)->name;
+            $product = Product::find($server->product_id);
 
-            $server->resourceplanName = $productName;
+            $server->product = $product;
         }
 
         return view('servers.index')->with([

+ 10 - 2
resources/views/servers/index.blade.php

@@ -107,8 +107,12 @@
                                     <div class="col-5 ">
                                         {{ __('Resource plan') }}:
                                     </div>
-                                    <div class="col-7 text-wrap">
-                                        <span>{{ $server->resourceplanName }}</span>
+                                    <div class="col-7 text-wrap d-flex justify-content-between align-items-center">
+                                        <span>{{ $server->product->name }}
+                                        </span>
+                                        <i data-toggle="popover" data-trigger="hover" data-html="true"
+                                            data-content="{{ __('CPU') }}: {{ $server->product->cpu / 100 }} {{ __('vCores') }} <br/>{{ __('RAM') }}: {{ $server->product->memory }} MB <br/>{{ __('Disk') }}: {{ $server->product->disk }} MB <br/>{{ __('Backups') }}: {{ $server->product->backups }} <br/> {{ __('MySQL Databases') }}: {{ $server->product->databases }} <br/> {{ __('Allocations') }}: {{ $server->product->allocations }} <br/>"
+                                            class="fas fa-info-circle"></i>
                                     </div>
 
                                 </div>
@@ -193,5 +197,9 @@
                 window.location.reload();
             });
         }
+
+        document.addEventListener('DOMContentLoaded', () => {
+            $('[data-toggle="popover"]').popover();
+        });
     </script>
 @endsection