update
This commit is contained in:
Bozhidar Slaveykov 2024-04-02 21:54:23 +03:00
parent 01acbfba1b
commit a1747d218c
28 changed files with 339 additions and 217 deletions

View file

@ -10,7 +10,9 @@ class Modules extends Page
protected static string $view = 'filament.pages.modules';
protected static ?string $navigationGroup = 'Hosting';
protected static ?string $navigationGroup = 'Server Management';
protected static ?string $navigationLabel = 'Extensions';
protected static ?int $navigationSort = 100;

View file

@ -9,7 +9,7 @@ use Outerweb\FilamentSettings\Filament\Pages\Settings as BaseSettings;
class Settings extends BaseSettings
{
protected static ?string $navigationGroup = 'System';
protected static ?string $navigationGroup = 'Server Management';
protected static ?int $navigationSort = 100;

View file

@ -19,7 +19,7 @@ class BackupResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-inbox-stack';
protected static ?string $navigationGroup = 'System';
protected static ?string $navigationGroup = 'Server Management';
protected static ?int $navigationSort = 99;

View file

@ -19,7 +19,7 @@ class CronJobResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-clock';
protected static ?string $navigationGroup = 'System';
protected static ?string $navigationGroup = 'Server Management';
protected static ?int $navigationSort = 98;

View file

@ -0,0 +1,85 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\CustomerResource\Pages;
use App\Filament\Resources\CustomerResource\RelationManagers;
use App\Models\Customer;
use Faker\Provider\Text;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class CustomerResource extends Resource
{
protected static ?string $model = Customer::class;
protected static ?string $navigationIcon = 'heroicon-o-users';
protected static ?string $navigationGroup = 'Hosting Services';
protected static ?int $navigationSort = 1;
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('name'),
Forms\Components\TextInput::make('email'),
Forms\Components\TextInput::make('phone'),
Forms\Components\TextInput::make('address'),
Forms\Components\TextInput::make('city'),
Forms\Components\TextInput::make('state'),
Forms\Components\TextInput::make('zip'),
Forms\Components\TextInput::make('country'),
Forms\Components\TextInput::make('company'),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label('Customer Name')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('email')
->searchable()
->sortable()
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListCustomers::route('/'),
'create' => Pages\CreateCustomer::route('/create'),
'edit' => Pages\EditCustomer::route('/{record}/edit'),
];
}
}

View file

@ -0,0 +1,12 @@
<?php
namespace App\Filament\Resources\CustomerResource\Pages;
use App\Filament\Resources\CustomerResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateCustomer extends CreateRecord
{
protected static string $resource = CustomerResource::class;
}

View file

@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\CustomerResource\Pages;
use App\Filament\Resources\CustomerResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditCustomer extends EditRecord
{
protected static string $resource = CustomerResource::class;
protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}

View file

@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\CustomerResource\Pages;
use App\Filament\Resources\CustomerResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListCustomers extends ListRecords
{
protected static string $resource = CustomerResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View file

@ -1,12 +0,0 @@
<?php
namespace App\Filament\Resources\HostingAccountResource\Pages;
use App\Filament\Resources\HostingAccountResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateHostingAccount extends CreateRecord
{
protected static string $resource = HostingAccountResource::class;
}

View file

@ -1,19 +0,0 @@
<?php
namespace App\Filament\Resources\HostingAccountResource\Pages;
use App\Filament\Resources\HostingAccountResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditHostingAccount extends EditRecord
{
protected static string $resource = HostingAccountResource::class;
protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}

View file

@ -1,19 +0,0 @@
<?php
namespace App\Filament\Resources\HostingAccountResource\Pages;
use App\Filament\Resources\HostingAccountResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListHostingAccounts extends ListRecords
{
protected static string $resource = HostingAccountResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View file

@ -1,95 +0,0 @@
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\HostingDatabaseResource\Pages;
use App\Filament\Resources\HostingDatabaseResource\RelationManagers;
use App\Models\HostingDatabase;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class HostingDatabaseResource extends Resource
{
protected static ?string $model = HostingDatabase::class;
protected static ?string $navigationIcon = 'heroicon-o-circle-stack';
protected static ?string $navigationGroup = 'Hosting';
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('database_name')
->required()
->disabled(function ($record) {
if (isset($record->exists)) {
return $record->exists;
} else {
return false;
}
}),
Forms\Components\TextInput::make('database_username')
->required()
->disabled(function ($record) {
if (isset($record->exists)) {
return $record->exists;
} else {
return false;
}
}),
Forms\Components\TextInput::make('database_password')
->required(),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('database_name')
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('database_username')
->searchable()
->sortable(),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListHostingDatabases::route('/'),
'create' => Pages\CreateHostingDatabase::route('/create'),
'edit' => Pages\EditHostingDatabase::route('/{record}/edit'),
];
}
}

View file

@ -1,12 +0,0 @@
<?php
namespace App\Filament\Resources\HostingDatabaseResource\Pages;
use App\Filament\Resources\HostingDatabaseResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateHostingDatabase extends CreateRecord
{
protected static string $resource = HostingDatabaseResource::class;
}

View file

@ -1,19 +0,0 @@
<?php
namespace App\Filament\Resources\HostingDatabaseResource\Pages;
use App\Filament\Resources\HostingDatabaseResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditHostingDatabase extends EditRecord
{
protected static string $resource = HostingDatabaseResource::class;
protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}

View file

@ -1,19 +0,0 @@
<?php
namespace App\Filament\Resources\HostingDatabaseResource\Pages;
use App\Filament\Resources\HostingDatabaseResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListHostingDatabases extends ListRecords
{
protected static string $resource = HostingDatabaseResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View file

@ -19,7 +19,9 @@ class HostingPlanResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-server-stack';
protected static ?string $navigationGroup = 'Hosting';
protected static ?string $navigationGroup = 'Hosting Services';
protected static ?int $navigationSort = 4;
public static function form(Form $form): Form
{

View file

@ -2,9 +2,9 @@
namespace App\Filament\Resources;
use App\Filament\Resources\HostingAccountResource\Pages;
use App\Filament\Resources\HostingAccountResource\RelationManagers;
use App\Models\HostingAccount;
use App\Filament\Resources\HostingSubscriptionResource\Pages;
use App\Filament\Resources\HostingSubscriptionResource\RelationManagers;
use App\Models\HostingSubscription;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
@ -13,13 +13,17 @@ use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class HostingAccountResource extends Resource
class HostingSubscriptionResource extends Resource
{
protected static ?string $model = HostingAccount::class;
protected static ?string $model = HostingSubscription::class;
protected static ?string $navigationIcon = 'heroicon-o-users';
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
protected static ?string $navigationGroup = 'Hosting';
protected static ?string $navigationGroup = 'Hosting Services';
protected static ?string $label = 'Subscriptions';
protected static ?int $navigationSort = 2;
public static function form(Form $form): Form
{
@ -58,9 +62,9 @@ class HostingAccountResource extends Resource
public static function getPages(): array
{
return [
'index' => Pages\ListHostingAccounts::route('/'),
'create' => Pages\CreateHostingAccount::route('/create'),
'edit' => Pages\EditHostingAccount::route('/{record}/edit'),
'index' => Pages\ListHostingSubscriptions::route('/'),
'create' => Pages\CreateHostingSubscription::route('/create'),
'edit' => Pages\EditHostingSubscription::route('/{record}/edit'),
];
}
}

View file

@ -0,0 +1,12 @@
<?php
namespace App\Filament\Resources\HostingSubscriptionResource\Pages;
use App\Filament\Resources\HostingSubscriptionResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
class CreateHostingSubscription extends CreateRecord
{
protected static string $resource = HostingSubscriptionResource::class;
}

View file

@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\HostingSubscriptionResource\Pages;
use App\Filament\Resources\HostingSubscriptionResource;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
class EditHostingSubscription extends EditRecord
{
protected static string $resource = HostingSubscriptionResource::class;
protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
];
}
}

View file

@ -0,0 +1,19 @@
<?php
namespace App\Filament\Resources\HostingSubscriptionResource\Pages;
use App\Filament\Resources\HostingSubscriptionResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
class ListHostingSubscriptions extends ListRecords
{
protected static string $resource = HostingSubscriptionResource::class;
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
];
}
}

View file

@ -19,7 +19,7 @@ class UserResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-users';
protected static ?string $navigationGroup = 'System';
protected static ?string $navigationGroup = 'Server Management';
public static function form(Form $form): Form
{

View file

@ -20,9 +20,9 @@ class WebsiteResource extends Resource
protected static ?string $navigationIcon = 'heroicon-o-globe-europe-africa';
protected static ?string $navigationGroup = 'Websites';
protected static ?string $navigationGroup = 'Hosting Services';
protected static ?int $navigationSort = 1;
protected static ?int $navigationSort = 2;
public static function form(Form $form): Form
{

View file

@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Customer extends Model
{
use HasFactory;
protected $fillable = [
'name',
'email',
'phone',
'address',
'city',
'state',
'zip',
'country',
'company',
];
}

View file

@ -0,0 +1,23 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class HostingSubscription extends Model
{
use HasFactory;
protected $fillable = [
'customer_id',
'hosting_plan_id',
'domain',
'username',
'password',
'description',
'setup_date',
'expiry_date',
'renewal_date'
];
}

View file

@ -36,9 +36,8 @@ class AdminPanelProvider extends PanelProvider
'primary' => Color::Amber,
])
->navigationGroups([
'Websites' => NavigationGroup::make()->label('Websites'),
'Hosting' => NavigationGroup::make()->label('Hosting'),
'System' => NavigationGroup::make()->label('System'),
'Hosting Services' => NavigationGroup::make()->label('Hosting Services'),
'Server Management' => NavigationGroup::make()->label('Server Management'),
])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')

View file

@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('customers', function (Blueprint $table) {
$table->id();
$table->string('name')->nullable();
$table->string('email')->nullable();
$table->string('phone')->nullable();
$table->string('address')->nullable();
$table->string('city')->nullable();
$table->string('state')->nullable();
$table->string('zip')->nullable();
$table->string('country')->nullable();
$table->string('company')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('customers');
}
};

View file

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('hosting_subscriptions', function (Blueprint $table) {
$table->id();
$table->bigInteger('customer_id')->nullable();
$table->bigInteger('hosting_plan_id')->nullable();
$table->string('domain')->nullable();
$table->string('username')->nullable();
$table->string('password')->nullable();
$table->longText('description')->nullable();
$table->timestamp('setup_date')->nullable();
$table->timestamp('expiry_date')->nullable();
$table->timestamp('renewal_date')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('hosting_subscriptions');
}
};

View file

@ -1,7 +1,7 @@
<?php
return [
'navigation.group' => 'System',
'navigation.group' => 'Server Management',
'navigation.authentication-log.label' => 'Auth Logs',
'navigation.authentication-log.plural-label' => 'Auth Logs',