Bozhidar Slaveykov 1 year ago
parent
commit
1848d65a03

+ 19 - 3
web/app/Filament/Resources/HostingSubscriptionResource.php

@@ -4,6 +4,7 @@ namespace App\Filament\Resources;
 
 
 use App\Filament\Resources\HostingSubscriptionResource\Pages;
 use App\Filament\Resources\HostingSubscriptionResource\Pages;
 use App\Models\HostingSubscription;
 use App\Models\HostingSubscription;
+use App\Models\PhyreServer;
 use Filament\Forms;
 use Filament\Forms;
 use Filament\Forms\Form;
 use Filament\Forms\Form;
 use Filament\Resources\Resource;
 use Filament\Resources\Resource;
@@ -113,6 +114,21 @@ class HostingSubscriptionResource extends Resource
         return $table
         return $table
             ->columns([
             ->columns([
 
 
+                Tables\Columns\TextColumn::make('phyre_server_id')
+                    ->label('Server')
+                    ->badge()
+                    ->state(function ($record) {
+                        if ($record->phyre_server_id > 0) {
+                            $phyreServer = PhyreServer::where('id', $record->phyre_server_id)->first();
+                            if ($phyreServer) {
+                                return $phyreServer->name;
+                            }
+                        }
+                        return 'MAIN';
+                    })
+                    ->searchable()
+                    ->sortable(),
+
                 Tables\Columns\TextColumn::make('domain')
                 Tables\Columns\TextColumn::make('domain')
                     ->searchable()
                     ->searchable()
                     ->sortable(),
                     ->sortable(),
@@ -125,9 +141,9 @@ class HostingSubscriptionResource extends Resource
                     ->searchable()
                     ->searchable()
                     ->sortable(),
                     ->sortable(),
 
 
-                Tables\Columns\TextColumn::make('hostingPlan.name')
-                    ->searchable()
-                    ->sortable(),
+//                Tables\Columns\TextColumn::make('hostingPlan.name')
+//                    ->searchable()
+//                    ->sortable(),
 
 
             ])
             ])
             ->defaultSort('id', 'desc')
             ->defaultSort('id', 'desc')

+ 19 - 1
web/app/Filament/Widgets/Websites.php

@@ -3,6 +3,8 @@
 namespace App\Filament\Widgets;
 namespace App\Filament\Widgets;
 
 
 use App\Models\Domain;
 use App\Models\Domain;
+use App\Models\HostingSubscription;
+use App\Models\PhyreServer;
 use Filament\Tables;
 use Filament\Tables;
 use Filament\Tables\Table;
 use Filament\Tables\Table;
 use Filament\Widgets\TableWidget as BaseWidget;
 use Filament\Widgets\TableWidget as BaseWidget;
@@ -21,7 +23,7 @@ class Websites extends BaseWidget
     {
     {
         return $table
         return $table
             ->query(
             ->query(
-                Domain::query()
+                HostingSubscription::query()
             )
             )
             ->actions([
             ->actions([
                 Tables\Actions\Action::make('visit')
                 Tables\Actions\Action::make('visit')
@@ -31,6 +33,22 @@ class Websites extends BaseWidget
                     ->url(fn ($record): string => 'http://'.$record->domain, true),
                     ->url(fn ($record): string => 'http://'.$record->domain, true),
             ])
             ])
             ->columns([
             ->columns([
+
+                Tables\Columns\TextColumn::make('phyre_server_id')
+                    ->label('Server')
+                    ->badge()
+                    ->state(function ($record) {
+                        if ($record->phyre_server_id > 0) {
+                            $phyreServer = PhyreServer::where('id', $record->phyre_server_id)->first();
+                            if ($phyreServer) {
+                                return $phyreServer->name;
+                            }
+                        }
+                        return 'MAIN';
+                    })
+                    ->searchable()
+                    ->sortable(),
+
                 Tables\Columns\TextColumn::make('domain'),
                 Tables\Columns\TextColumn::make('domain'),
                // Tables\Columns\TextColumn::make('hostingPlan.name'),
                // Tables\Columns\TextColumn::make('hostingPlan.name'),
                 Tables\Columns\TextColumn::make('created_at'),
                 Tables\Columns\TextColumn::make('created_at'),

+ 4 - 2
web/app/Models/PhyreServer.php

@@ -105,7 +105,7 @@ class PhyreServer extends Model
                     $findHostingSubscription->phyre_server_id = $this->id;
                     $findHostingSubscription->phyre_server_id = $this->id;
                     $findHostingSubscription->external_id = $phyreServerHostingSubscription['id'];
                     $findHostingSubscription->external_id = $phyreServerHostingSubscription['id'];
                 }
                 }
-                
+
                 $findHostingSubscriptionCustomer = Customer::where('external_id', $phyreServerHostingSubscription['customer_id'])
                 $findHostingSubscriptionCustomer = Customer::where('external_id', $phyreServerHostingSubscription['customer_id'])
                     ->where('phyre_server_id', $this->id)
                     ->where('phyre_server_id', $this->id)
                     ->first();
                     ->first();
@@ -113,10 +113,12 @@ class PhyreServer extends Model
                     $findHostingSubscription->customer_id = $findHostingSubscriptionCustomer->id;
                     $findHostingSubscription->customer_id = $findHostingSubscriptionCustomer->id;
                 }
                 }
 
 
+                $findHostingSubscription->system_username = $phyreServerHostingSubscription['system_username'];
+                $findHostingSubscription->system_password = $phyreServerHostingSubscription['system_password'];
+
                 $findHostingSubscription->domain = $phyreServerHostingSubscription['domain'];
                 $findHostingSubscription->domain = $phyreServerHostingSubscription['domain'];
                 $findHostingSubscription->save();
                 $findHostingSubscription->save();
 
 
-
             }
             }
         }
         }