mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
migration script
# Conflicts: # app/Filament/Resources/Torrent/AnnounceLogResource.php
This commit is contained in:
@@ -2,12 +2,23 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\System\AgentAllowResource\RelationManagers\DeniesRelationManager;
|
||||
use App\Filament\Resources\System\AgentAllowResource\Pages\ListAgentAllows;
|
||||
use App\Filament\Resources\System\AgentAllowResource\Pages\CreateAgentAllow;
|
||||
use App\Filament\Resources\System\AgentAllowResource\Pages\EditAgentAllow;
|
||||
use App\Filament\OptionsTrait;
|
||||
use App\Filament\Resources\System\AgentAllowResource\Pages;
|
||||
use App\Filament\Resources\System\AgentAllowResource\RelationManagers;
|
||||
use App\Models\AgentAllow;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -20,9 +31,9 @@ class AgentAllowResource extends Resource
|
||||
|
||||
protected static ?string $model = AgentAllow::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-check';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-check';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
@@ -37,24 +48,24 @@ class AgentAllowResource extends Resource
|
||||
}
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('family')->required()->label(__('label.agent_allow.family')),
|
||||
Forms\Components\TextInput::make('start_name')->required()->label(__('label.agent_allow.start_name')),
|
||||
Forms\Components\TextInput::make('peer_id_start')->required()->label(__('label.agent_allow.peer_id_start')),
|
||||
Forms\Components\TextInput::make('peer_id_pattern')->required()->label(__('label.agent_allow.peer_id_pattern')),
|
||||
Forms\Components\Radio::make('peer_id_matchtype')->options(self::$matchTypes)->required()->label(__('label.agent_allow.peer_id_matchtype')),
|
||||
Forms\Components\TextInput::make('peer_id_match_num')->integer()->required()->label(__('label.agent_allow.peer_id_match_num')),
|
||||
Forms\Components\TextInput::make('agent_start')->required()->label(__('label.agent_allow.agent_start')),
|
||||
Forms\Components\TextInput::make('agent_pattern')->required()->label(__('label.agent_allow.agent_pattern')),
|
||||
Forms\Components\Radio::make('agent_matchtype')->options(self::$matchTypes)->required()->label(__('label.agent_allow.agent_matchtype')),
|
||||
Forms\Components\TextInput::make('agent_match_num')->required()->label(__('label.agent_allow.agent_match_num')),
|
||||
Forms\Components\Radio::make('exception')->options(self::$yesOrNo)->required()->label(__('label.agent_allow.exception')),
|
||||
Forms\Components\Radio::make('allowhttps')->options(self::$yesOrNo)->required()->label(__('label.agent_allow.allowhttps')),
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('family')->required()->label(__('label.agent_allow.family')),
|
||||
TextInput::make('start_name')->required()->label(__('label.agent_allow.start_name')),
|
||||
TextInput::make('peer_id_start')->required()->label(__('label.agent_allow.peer_id_start')),
|
||||
TextInput::make('peer_id_pattern')->required()->label(__('label.agent_allow.peer_id_pattern')),
|
||||
Radio::make('peer_id_matchtype')->options(self::$matchTypes)->required()->label(__('label.agent_allow.peer_id_matchtype')),
|
||||
TextInput::make('peer_id_match_num')->integer()->required()->label(__('label.agent_allow.peer_id_match_num')),
|
||||
TextInput::make('agent_start')->required()->label(__('label.agent_allow.agent_start')),
|
||||
TextInput::make('agent_pattern')->required()->label(__('label.agent_allow.agent_pattern')),
|
||||
Radio::make('agent_matchtype')->options(self::$matchTypes)->required()->label(__('label.agent_allow.agent_matchtype')),
|
||||
TextInput::make('agent_match_num')->required()->label(__('label.agent_allow.agent_match_num')),
|
||||
Radio::make('exception')->options(self::$yesOrNo)->required()->label(__('label.agent_allow.exception')),
|
||||
Radio::make('allowhttps')->options(self::$yesOrNo)->required()->label(__('label.agent_allow.allowhttps')),
|
||||
|
||||
Forms\Components\Textarea::make('comment')->label(__('label.comment')),
|
||||
Textarea::make('comment')->label(__('label.comment')),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -62,42 +73,42 @@ class AgentAllowResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
Tables\Columns\TextColumn::make('family')->searchable()->label(__('label.agent_allow.family')),
|
||||
Tables\Columns\TextColumn::make('start_name')->searchable()->label(__('label.agent_allow.start_name')),
|
||||
Tables\Columns\TextColumn::make('peer_id_start')->label(__('label.agent_allow.peer_id_start')),
|
||||
Tables\Columns\TextColumn::make('agent_start')->label(__('label.agent_allow.agent_start')),
|
||||
TextColumn::make('id')->sortable(),
|
||||
TextColumn::make('family')->searchable()->label(__('label.agent_allow.family')),
|
||||
TextColumn::make('start_name')->searchable()->label(__('label.agent_allow.start_name')),
|
||||
TextColumn::make('peer_id_start')->label(__('label.agent_allow.peer_id_start')),
|
||||
TextColumn::make('agent_start')->label(__('label.agent_allow.agent_start')),
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make()->using(function ($record) {
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make()->using(function ($record) {
|
||||
$record->delete();
|
||||
clear_agent_allow_deny_cache();
|
||||
return redirect(self::getUrl());
|
||||
})
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
RelationManagers\DeniesRelationManager::class,
|
||||
DeniesRelationManager::class,
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListAgentAllows::route('/'),
|
||||
'create' => Pages\CreateAgentAllow::route('/create'),
|
||||
'edit' => Pages\EditAgentAllow::route('/{record}/edit'),
|
||||
'index' => ListAgentAllows::route('/'),
|
||||
'create' => CreateAgentAllow::route('/create'),
|
||||
'edit' => EditAgentAllow::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\AgentAllowResource\Pages;
|
||||
|
||||
use Filament\Actions\DeleteAction;
|
||||
use App\Filament\Resources\System\AgentAllowResource;
|
||||
use App\Models\NexusModel;
|
||||
use Filament\Pages\Actions;
|
||||
@@ -14,7 +15,7 @@ class EditAgentAllow extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make()->using(function ($record) {
|
||||
DeleteAction::make()->using(function ($record) {
|
||||
$record->delete();
|
||||
clear_agent_allow_deny_cache();
|
||||
return redirect(AgentAllowResource::getUrl());
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
|
||||
namespace App\Filament\Resources\System\AgentAllowResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Exception;
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\System\AgentAllowResource;
|
||||
use App\Repositories\AgentAllowRepository;
|
||||
@@ -16,12 +20,12 @@ class ListAgentAllows extends PageList
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
Actions\Action::make('check')
|
||||
CreateAction::make(),
|
||||
Action::make('check')
|
||||
->label(__('admin.resources.agent_allow.check_modal_btn'))
|
||||
->form([
|
||||
Forms\Components\TextInput::make('peer_id')->required(),
|
||||
Forms\Components\TextInput::make('agent')->required(),
|
||||
->schema([
|
||||
TextInput::make('peer_id')->required(),
|
||||
TextInput::make('agent')->required(),
|
||||
])
|
||||
->modalHeading(__('admin.resources.agent_allow.check_modal_header'))
|
||||
->action(function ($data) {
|
||||
@@ -29,7 +33,7 @@ class ListAgentAllows extends PageList
|
||||
try {
|
||||
$result = $agentAllowRep->checkClient($data['peer_id'], $data['agent']);
|
||||
send_admin_success_notification(__('admin.resources.agent_allow.check_pass_msg', ['id' => $result->id]));
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
send_admin_fail_notification($exception->getMessage());
|
||||
}
|
||||
})
|
||||
|
||||
+24
-17
@@ -2,8 +2,15 @@
|
||||
|
||||
namespace App\Filament\Resources\System\AgentAllowResource\RelationManagers;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\RelationManagers\RelationManager;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -16,14 +23,14 @@ class DeniesRelationManager extends RelationManager
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public function form(Form $form): Form
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')->required()->maxLength(255)->label(__('label.name')),
|
||||
Forms\Components\TextInput::make('peer_id')->required()->maxLength(255)->label(__('label.agent_deny.peer_id')),
|
||||
Forms\Components\TextInput::make('agent')->required()->maxLength(255)->label(__('label.agent_deny.agent')),
|
||||
Forms\Components\Textarea::make('comment')->label(__('label.comment')),
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->required()->maxLength(255)->label(__('label.name')),
|
||||
TextInput::make('peer_id')->required()->maxLength(255)->label(__('label.agent_deny.peer_id')),
|
||||
TextInput::make('agent')->required()->maxLength(255)->label(__('label.agent_deny.agent')),
|
||||
Textarea::make('comment')->label(__('label.comment')),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -31,22 +38,22 @@ class DeniesRelationManager extends RelationManager
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('name')->label(__('label.name')),
|
||||
Tables\Columns\TextColumn::make('peer_id')->label(__('label.agent_deny.peer_id')),
|
||||
Tables\Columns\TextColumn::make('agent')->label(__('label.agent_deny.agent')),
|
||||
TextColumn::make('name')->label(__('label.name')),
|
||||
TextColumn::make('peer_id')->label(__('label.agent_deny.peer_id')),
|
||||
TextColumn::make('agent')->label(__('label.agent_deny.agent')),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->headerActions([
|
||||
Tables\Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,21 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\System\AgentDenyResource\Pages\ListAgentDenies;
|
||||
use App\Filament\Resources\System\AgentDenyResource\Pages\CreateAgentDeny;
|
||||
use App\Filament\Resources\System\AgentDenyResource\Pages\EditAgentDeny;
|
||||
use App\Filament\Resources\System\AgentDenyResource\Pages;
|
||||
use App\Filament\Resources\System\AgentDenyResource\RelationManagers;
|
||||
use App\Models\AgentDeny;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -17,9 +27,9 @@ class AgentDenyResource extends Resource
|
||||
{
|
||||
protected static ?string $model = AgentDeny::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-no-symbol';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-no-symbol';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
@@ -33,16 +43,16 @@ class AgentDenyResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('family_id')->label('Allow family')
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('family_id')->label('Allow family')
|
||||
->relationship('family', 'family')->required()->label(__('label.agent_allow.family')),
|
||||
Forms\Components\TextInput::make('name')->required()->label(__('label.name')),
|
||||
Forms\Components\TextInput::make('peer_id')->required()->label(__('label.agent_deny.peer_id')),
|
||||
Forms\Components\TextInput::make('agent')->required()->label(__('label.agent_deny.agent')),
|
||||
Forms\Components\Textarea::make('comment')->label(__('label.comment')),
|
||||
TextInput::make('name')->required()->label(__('label.name')),
|
||||
TextInput::make('peer_id')->required()->label(__('label.agent_deny.peer_id')),
|
||||
TextInput::make('agent')->required()->label(__('label.agent_deny.agent')),
|
||||
Textarea::make('comment')->label(__('label.comment')),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -50,26 +60,26 @@ class AgentDenyResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
Tables\Columns\TextColumn::make('family.family')->label(__('label.agent_allow.family')),
|
||||
Tables\Columns\TextColumn::make('name')->searchable()->label(__('label.name')),
|
||||
Tables\Columns\TextColumn::make('peer_id')->searchable()->label(__('label.agent_deny.peer_id')),
|
||||
Tables\Columns\TextColumn::make('agent')->searchable()->label(__('label.agent_deny.agent')),
|
||||
TextColumn::make('id')->sortable(),
|
||||
TextColumn::make('family.family')->label(__('label.agent_allow.family')),
|
||||
TextColumn::make('name')->searchable()->label(__('label.name')),
|
||||
TextColumn::make('peer_id')->searchable()->label(__('label.agent_deny.peer_id')),
|
||||
TextColumn::make('agent')->searchable()->label(__('label.agent_deny.agent')),
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make()->using(function ($record) {
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make()->using(function ($record) {
|
||||
$record->delete();
|
||||
clear_agent_allow_deny_cache();
|
||||
return redirect(self::getUrl());
|
||||
})
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -83,9 +93,9 @@ class AgentDenyResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListAgentDenies::route('/'),
|
||||
'create' => Pages\CreateAgentDeny::route('/create'),
|
||||
'edit' => Pages\EditAgentDeny::route('/{record}/edit'),
|
||||
'index' => ListAgentDenies::route('/'),
|
||||
'create' => CreateAgentDeny::route('/create'),
|
||||
'edit' => EditAgentDeny::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\AgentDenyResource\Pages;
|
||||
|
||||
use Filament\Actions\DeleteAction;
|
||||
use App\Filament\Resources\System\AgentDenyResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
@@ -13,7 +14,7 @@ class EditAgentDeny extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make()->using(function ($record) {
|
||||
DeleteAction::make()->using(function ($record) {
|
||||
$record->delete();
|
||||
clear_agent_allow_deny_cache();
|
||||
return redirect(AgentDenyResource::getUrl());
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\AgentDenyResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\System\AgentDenyResource;
|
||||
use Filament\Pages\Actions;
|
||||
@@ -14,7 +15,7 @@ class ListAgentDenies extends PageList
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,17 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\System\DownloadSpeedResource\Pages\ManageDownloadSpeeds;
|
||||
use App\Filament\Resources\System\DownloadSpeedResource\Pages;
|
||||
use App\Filament\Resources\System\DownloadSpeedResource\RelationManagers;
|
||||
use App\Models\DownloadSpeed;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -17,9 +23,9 @@ class DownloadSpeedResource extends Resource
|
||||
{
|
||||
protected static ?string $model = DownloadSpeed::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-arrow-down-tray';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-arrow-down-tray';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 6;
|
||||
|
||||
@@ -33,11 +39,11 @@ class DownloadSpeedResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')->label(__('label.name'))
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->label(__('label.name'))
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -45,25 +51,25 @@ class DownloadSpeedResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('name')->label(__('label.name')),
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')->label(__('label.name')),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageDownloadSpeeds::route('/'),
|
||||
'index' => ManageDownloadSpeeds::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\DownloadSpeedResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Filament\Resources\System\DownloadSpeedResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
@@ -13,7 +14,7 @@ class ManageDownloadSpeeds extends ManageRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,25 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Utilities\Get;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Components\Hidden;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\CheckboxList;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\BooleanColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use App\Filament\Resources\System\ExamResource\Pages\ListExams;
|
||||
use App\Filament\Resources\System\ExamResource\Pages\CreateExam;
|
||||
use App\Filament\Resources\System\ExamResource\Pages\EditExam;
|
||||
use App\Filament\OptionsTrait;
|
||||
use App\Filament\Resources\System\ExamResource\Pages;
|
||||
use App\Filament\Resources\System\ExamResource\RelationManagers;
|
||||
@@ -9,7 +28,6 @@ use App\Models\Exam;
|
||||
use App\Repositories\ExamRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -23,9 +41,9 @@ class ExamResource extends Resource
|
||||
|
||||
protected static ?string $model = Exam::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-exclamation-triangle';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-exclamation-triangle';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
@@ -41,14 +59,14 @@ class ExamResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
$userRep = new UserRepository();
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Section::make(__('label.exam.section_base_info'))->schema([
|
||||
Forms\Components\TextInput::make('name')->required()->columnSpan(['sm' => 2])->label(__('label.name')),
|
||||
Forms\Components\Select::make('type')
|
||||
return $schema
|
||||
->components([
|
||||
Section::make(__('label.exam.section_base_info'))->schema([
|
||||
TextInput::make('name')->required()->columnSpan(['sm' => 2])->label(__('label.name')),
|
||||
Select::make('type')
|
||||
->required()
|
||||
->columnSpanFull()
|
||||
->label(__('exam.type'))
|
||||
@@ -56,74 +74,74 @@ class ExamResource extends Resource
|
||||
->helperText(__('exam.type_help'))
|
||||
->reactive()
|
||||
,
|
||||
Forms\Components\TextInput::make('success_reward_bonus')
|
||||
TextInput::make('success_reward_bonus')
|
||||
->columnSpanFull()
|
||||
->required()
|
||||
->label(__('exam.success_reward_bonus'))
|
||||
->hidden(fn (\Filament\Forms\Get $get) => $get('type') != Exam::TYPE_TASK)
|
||||
->hidden(fn (Get $get) => $get('type') != Exam::TYPE_TASK)
|
||||
,
|
||||
Forms\Components\TextInput::make('fail_deduct_bonus')
|
||||
TextInput::make('fail_deduct_bonus')
|
||||
->columnSpanFull()
|
||||
->required()
|
||||
->label(__('exam.fail_deduct_bonus'))
|
||||
->hidden(fn (\Filament\Forms\Get $get) => $get('type') != Exam::TYPE_TASK)
|
||||
->hidden(fn (Get $get) => $get('type') != Exam::TYPE_TASK)
|
||||
,
|
||||
Forms\Components\TextInput::make('max_user_count')
|
||||
TextInput::make('max_user_count')
|
||||
->columnSpanFull()
|
||||
->required()
|
||||
->numeric()
|
||||
->label(__('exam.max_user_count'))
|
||||
->hidden(fn (\Filament\Forms\Get $get) => $get('type') != Exam::TYPE_TASK)
|
||||
->hidden(fn (Get $get) => $get('type') != Exam::TYPE_TASK)
|
||||
,
|
||||
|
||||
Forms\Components\Repeater::make('indexes')->schema([
|
||||
Forms\Components\Select::make('index')
|
||||
Repeater::make('indexes')->schema([
|
||||
Select::make('index')
|
||||
->options(Exam::listIndex(true))
|
||||
->label(__('label.exam.index_required_label'))
|
||||
->rules([Rule::in(array_keys(Exam::$indexes))])
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('require_value')
|
||||
TextInput::make('require_value')
|
||||
->label(__('label.exam.index_required_value'))
|
||||
->placeholder(__('label.exam.index_placeholder'))
|
||||
->integer()
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('checked')->default(true),
|
||||
Hidden::make('checked')->default(true),
|
||||
])
|
||||
->label(__('label.exam.index_formatted'))
|
||||
->required(),
|
||||
|
||||
Forms\Components\Radio::make('status')
|
||||
Radio::make('status')
|
||||
->options(self::getEnableDisableOptions())
|
||||
->inline()
|
||||
->required()
|
||||
->label(__('label.status'))
|
||||
->columnSpan(['sm' => 2]),
|
||||
Forms\Components\Radio::make('is_discovered')
|
||||
Radio::make('is_discovered')
|
||||
->options(self::IS_DISCOVERED_OPTIONS)
|
||||
->label(__('label.exam.is_discovered'))
|
||||
->inline()
|
||||
->required()
|
||||
->columnSpan(['sm' => 2]),
|
||||
Forms\Components\TextInput::make('background_color')
|
||||
TextInput::make('background_color')
|
||||
->required()
|
||||
->label(__('exam.background_color'))
|
||||
->columnSpan(['sm' => 2]),
|
||||
Forms\Components\TextInput::make('priority')
|
||||
TextInput::make('priority')
|
||||
->columnSpan(['sm' => 2])
|
||||
->integer()
|
||||
->label(__("label.priority"))
|
||||
->helperText(__('label.exam.priority_help')),
|
||||
])->columns(2),
|
||||
|
||||
Forms\Components\Section::make(__('label.exam.section_time'))->schema([
|
||||
Forms\Components\DateTimePicker::make('begin')->label(__('label.begin')),
|
||||
Forms\Components\DateTimePicker::make('end')->label(__('label.end')),
|
||||
Forms\Components\TextInput::make('duration')
|
||||
Section::make(__('label.exam.section_time'))->schema([
|
||||
DateTimePicker::make('begin')->label(__('label.begin')),
|
||||
DateTimePicker::make('end')->label(__('label.end')),
|
||||
TextInput::make('duration')
|
||||
->integer()
|
||||
->columnSpan(['sm' => 2])
|
||||
->label(__('label.duration'))
|
||||
->helperText(__('label.exam.duration_help')),
|
||||
Forms\Components\Select::make('recurring')
|
||||
Select::make('recurring')
|
||||
->options(Exam::listRecurringOptions())
|
||||
->label(__('exam.recurring'))
|
||||
->helperText(__('exam.recurring_help'))
|
||||
@@ -131,22 +149,22 @@ class ExamResource extends Resource
|
||||
,
|
||||
])->columns(2),
|
||||
|
||||
Forms\Components\Section::make(__('label.exam.section_target_user'))->schema([
|
||||
Forms\Components\CheckboxList::make('filters.classes')
|
||||
Section::make(__('label.exam.section_target_user'))->schema([
|
||||
CheckboxList::make('filters.classes')
|
||||
->options($userRep->listClass())->columnSpan(['sm' => 2])
|
||||
->columns(4)
|
||||
->label(__('label.user.class')),
|
||||
Forms\Components\DateTimePicker::make('filters.register_time_range.0')->label(__("label.exam.register_time_range.begin")),
|
||||
Forms\Components\DateTimePicker::make('filters.register_time_range.1')->label(__("label.exam.register_time_range.end")),
|
||||
Forms\Components\TextInput::make('filters.register_days_range.0')->numeric()->label(__("label.exam.register_days_range.begin")),
|
||||
Forms\Components\TextInput::make('filters.register_days_range.1')->numeric()->label(__("label.exam.register_days_range.end")),
|
||||
Forms\Components\CheckboxList::make('filters.donate_status')
|
||||
DateTimePicker::make('filters.register_time_range.0')->label(__("label.exam.register_time_range.begin")),
|
||||
DateTimePicker::make('filters.register_time_range.1')->label(__("label.exam.register_time_range.end")),
|
||||
TextInput::make('filters.register_days_range.0')->numeric()->label(__("label.exam.register_days_range.begin")),
|
||||
TextInput::make('filters.register_days_range.1')->numeric()->label(__("label.exam.register_days_range.end")),
|
||||
CheckboxList::make('filters.donate_status')
|
||||
->options(self::$yesOrNo)
|
||||
->label(__('label.exam.donated')),
|
||||
])->columns(2),
|
||||
|
||||
|
||||
Forms\Components\Textarea::make('description')->columnSpan(['sm' => 2])->label(__('label.description')),
|
||||
Textarea::make('description')->columnSpan(['sm' => 2])->label(__('label.description')),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -154,33 +172,33 @@ class ExamResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
Tables\Columns\TextColumn::make('name')->searchable()->label(__('label.name')),
|
||||
Tables\Columns\TextColumn::make('typeText')->label(__('exam.type')),
|
||||
Tables\Columns\TextColumn::make('indexFormatted')->label(__('label.exam.index_formatted'))->html(),
|
||||
Tables\Columns\TextColumn::make('begin')->label(__('label.begin')),
|
||||
Tables\Columns\TextColumn::make('end')->label(__('label.end')),
|
||||
Tables\Columns\TextColumn::make('durationText')->label(__('label.duration')),
|
||||
Tables\Columns\TextColumn::make('recurringText')->label(__('exam.recurring')),
|
||||
Tables\Columns\TextColumn::make('filterFormatted')->label(__('label.exam.filter_formatted'))->html()->extraAttributes([]),
|
||||
Tables\Columns\BooleanColumn::make('is_discovered')->label(__('label.exam.is_discovered')),
|
||||
Tables\Columns\TextColumn::make('priority')->label(__('label.priority')),
|
||||
Tables\Columns\TextColumn::make('statusText')->label(__('label.status')),
|
||||
TextColumn::make('id')->sortable(),
|
||||
TextColumn::make('name')->searchable()->label(__('label.name')),
|
||||
TextColumn::make('typeText')->label(__('exam.type')),
|
||||
TextColumn::make('indexFormatted')->label(__('label.exam.index_formatted'))->html(),
|
||||
TextColumn::make('begin')->label(__('label.begin')),
|
||||
TextColumn::make('end')->label(__('label.end')),
|
||||
TextColumn::make('durationText')->label(__('label.duration')),
|
||||
TextColumn::make('recurringText')->label(__('exam.recurring')),
|
||||
TextColumn::make('filterFormatted')->label(__('label.exam.filter_formatted'))->html()->extraAttributes([]),
|
||||
BooleanColumn::make('is_discovered')->label(__('label.exam.is_discovered')),
|
||||
TextColumn::make('priority')->label(__('label.priority')),
|
||||
TextColumn::make('statusText')->label(__('label.status')),
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
->filters([
|
||||
Tables\Filters\SelectFilter::make('type')->options(Exam::listTypeOptions())->label(__("exam.type")),
|
||||
Tables\Filters\SelectFilter::make('is_discovered')->options(self::IS_DISCOVERED_OPTIONS)->label(__("label.exam.is_discovered")),
|
||||
Tables\Filters\SelectFilter::make('status')->options(self::getEnableDisableOptions())->label(__("label.status")),
|
||||
SelectFilter::make('type')->options(Exam::listTypeOptions())->label(__("exam.type")),
|
||||
SelectFilter::make('is_discovered')->options(self::IS_DISCOVERED_OPTIONS)->label(__("label.exam.is_discovered")),
|
||||
SelectFilter::make('status')->options(self::getEnableDisableOptions())->label(__("label.status")),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make()->using(function ($record) {
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make()->using(function ($record) {
|
||||
$rep = new ExamRepository();
|
||||
$rep->delete($record->id);
|
||||
}),
|
||||
])
|
||||
->bulkActions([
|
||||
->toolbarActions([
|
||||
// Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
@@ -195,9 +213,9 @@ class ExamResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListExams::route('/'),
|
||||
'create' => Pages\CreateExam::route('/create'),
|
||||
'edit' => Pages\EditExam::route('/{record}/edit'),
|
||||
'index' => ListExams::route('/'),
|
||||
'create' => CreateExam::route('/create'),
|
||||
'edit' => EditExam::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\ExamResource\Pages;
|
||||
|
||||
use Exception;
|
||||
use App\Filament\Resources\System\ExamResource;
|
||||
use App\Repositories\ExamRepository;
|
||||
use Filament\Pages\Actions;
|
||||
@@ -28,7 +29,7 @@ class CreateExam extends CreateRecord
|
||||
return;
|
||||
}
|
||||
$this->redirect($this->getResource()::getUrl('index'));
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
do_log($exception->getMessage() . "\n" . $exception->getTraceAsString(), "error");
|
||||
send_admin_fail_notification($exception->getMessage());
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\System\ExamResource\Pages;
|
||||
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Exception;
|
||||
use App\Filament\Resources\System\ExamResource;
|
||||
use App\Repositories\ExamRepository;
|
||||
use Filament\Pages\Actions;
|
||||
@@ -14,7 +16,7 @@ class EditExam extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -26,7 +28,7 @@ class EditExam extends EditRecord
|
||||
$this->record = $examRep->update($data, $this->record->id);
|
||||
send_admin_success_notification();
|
||||
$this->redirect($this->getResource()::getUrl('index'));
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
send_admin_fail_notification($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\ExamResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\System\ExamResource;
|
||||
use Filament\Pages\Actions;
|
||||
@@ -14,7 +15,7 @@ class ListExams extends PageList
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,17 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\System\IspResource\Pages\ManageIsps;
|
||||
use App\Filament\Resources\System\IspResource\Pages;
|
||||
use App\Filament\Resources\System\IspResource\RelationManagers;
|
||||
use App\Models\Isp;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -17,9 +23,9 @@ class IspResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Isp::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-globe-alt';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-globe-alt';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 7;
|
||||
|
||||
@@ -33,11 +39,11 @@ class IspResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')->label(__('label.name'))
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->label(__('label.name'))
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -45,25 +51,25 @@ class IspResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('name')->label(__('label.name')),
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')->label(__('label.name')),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageIsps::route('/'),
|
||||
'index' => ManageIsps::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\IspResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Filament\Resources\System\IspResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
@@ -13,7 +14,7 @@ class ManageIsps extends ManageRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,24 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ImageColumn;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\System\MedalResource\Pages\ListMedals;
|
||||
use App\Filament\Resources\System\MedalResource\Pages\CreateMedal;
|
||||
use App\Filament\Resources\System\MedalResource\Pages\EditMedal;
|
||||
use App\Filament\Resources\System\MedalResource\Pages;
|
||||
use App\Filament\Resources\System\MedalResource\RelationManagers;
|
||||
use App\Models\Medal;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -18,9 +31,9 @@ class MedalResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Medal::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-check-badge';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-check-badge';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
@@ -35,69 +48,69 @@ class MedalResource extends Resource
|
||||
}
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')->required()->label(__('label.name')),
|
||||
Forms\Components\TextInput::make('price')->required()->integer()->label(__('label.price')),
|
||||
Forms\Components\TextInput::make('image_large')->required()->label(__('label.medal.image_large')),
|
||||
Forms\Components\TextInput::make('image_small')->required()->label(__('label.medal.image_small')),
|
||||
Forms\Components\Radio::make('get_type')
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->required()->label(__('label.name')),
|
||||
TextInput::make('price')->required()->integer()->label(__('label.price')),
|
||||
TextInput::make('image_large')->required()->label(__('label.medal.image_large')),
|
||||
TextInput::make('image_small')->required()->label(__('label.medal.image_small')),
|
||||
Radio::make('get_type')
|
||||
->options(Medal::listGetTypes(true))
|
||||
->inline()
|
||||
->label(__('label.medal.get_type'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\Toggle::make('display_on_medal_page')
|
||||
Toggle::make('display_on_medal_page')
|
||||
->label(__('label.medal.display_on_medal_page'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('duration')
|
||||
TextInput::make('duration')
|
||||
->integer()
|
||||
->label(__('label.medal.duration'))
|
||||
->helperText(__('label.medal.duration_help'))
|
||||
,
|
||||
Forms\Components\TextInput::make('inventory')
|
||||
TextInput::make('inventory')
|
||||
->integer()
|
||||
->label(__('medal.fields.inventory'))
|
||||
->helperText(__('medal.fields.inventory_help'))
|
||||
,
|
||||
Forms\Components\DateTimePicker::make('sale_begin_time')
|
||||
DateTimePicker::make('sale_begin_time')
|
||||
->label(__('medal.fields.sale_begin_time'))
|
||||
->helperText(__('medal.fields.sale_begin_time_help'))
|
||||
,
|
||||
Forms\Components\DateTimePicker::make('sale_end_time')
|
||||
DateTimePicker::make('sale_end_time')
|
||||
->label(__('medal.fields.sale_end_time'))
|
||||
->helperText(__('medal.fields.sale_end_time_help'))
|
||||
,
|
||||
Forms\Components\TextInput::make('bonus_addition_factor')
|
||||
TextInput::make('bonus_addition_factor')
|
||||
->label(__('medal.fields.bonus_addition_factor'))
|
||||
->helperText(__('medal.fields.bonus_addition_factor_help'))
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->default(0)
|
||||
,
|
||||
Forms\Components\TextInput::make('bonus_addition_duration')
|
||||
TextInput::make('bonus_addition_duration')
|
||||
->label(__('medal.fields.bonus_addition_duration'))
|
||||
->helperText(__('medal.fields.bonus_addition_duration_help'))
|
||||
->numeric()
|
||||
->minValue(0)
|
||||
->default(0)
|
||||
,
|
||||
Forms\Components\TextInput::make('gift_fee_factor')
|
||||
TextInput::make('gift_fee_factor')
|
||||
->label(__('medal.fields.gift_fee_factor'))
|
||||
->helperText(__('medal.fields.gift_fee_factor_help'))
|
||||
->numeric()
|
||||
->default(0)
|
||||
,
|
||||
Forms\Components\TextInput::make('priority')
|
||||
TextInput::make('priority')
|
||||
->label(__('label.priority'))
|
||||
->helperText(__('label.priority_help'))
|
||||
->numeric()
|
||||
->default(0)
|
||||
,
|
||||
Forms\Components\Textarea::make('description')
|
||||
Textarea::make('description')
|
||||
->label(__('label.description'))
|
||||
,
|
||||
]);
|
||||
@@ -107,36 +120,36 @@ class MedalResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
Tables\Columns\TextColumn::make('name')->label(__('label.name'))->searchable(),
|
||||
Tables\Columns\ImageColumn::make('image_large')->height(60)->label(__('label.medal.image_large')),
|
||||
Tables\Columns\TextColumn::make('getTypeText')->label('Get type')->label(__('label.medal.get_type')),
|
||||
Tables\Columns\IconColumn::make('display_on_medal_page')->label(__('label.medal.display_on_medal_page'))->boolean(),
|
||||
Tables\Columns\TextColumn::make('sale_begin_end_time')
|
||||
TextColumn::make('id')->sortable(),
|
||||
TextColumn::make('name')->label(__('label.name'))->searchable(),
|
||||
ImageColumn::make('image_large')->height(60)->label(__('label.medal.image_large')),
|
||||
TextColumn::make('getTypeText')->label('Get type')->label(__('label.medal.get_type')),
|
||||
IconColumn::make('display_on_medal_page')->label(__('label.medal.display_on_medal_page'))->boolean(),
|
||||
TextColumn::make('sale_begin_end_time')
|
||||
->label(__('medal.fields.sale_begin_end_time'))
|
||||
->formatStateUsing(fn ($record) => new HtmlString(sprintf('%s ~<br/>%s', $record->sale_begin_time ?? nexus_trans('nexus.no_limit'), $record->sale_end_time ?? nexus_trans('nexus.no_limit'))))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('bonus_addition_factor')->label(__('medal.fields.bonus_addition_factor')),
|
||||
Tables\Columns\TextColumn::make('bonus_addition_duration')->label(__('medal.fields.bonus_addition_duration')),
|
||||
Tables\Columns\TextColumn::make('gift_fee_factor')->label(__('medal.fields.gift_fee_factor')),
|
||||
Tables\Columns\TextColumn::make('price')->label(__('label.price'))->formatStateUsing(fn ($state) => number_format($state)),
|
||||
TextColumn::make('bonus_addition_factor')->label(__('medal.fields.bonus_addition_factor')),
|
||||
TextColumn::make('bonus_addition_duration')->label(__('medal.fields.bonus_addition_duration')),
|
||||
TextColumn::make('gift_fee_factor')->label(__('medal.fields.gift_fee_factor')),
|
||||
TextColumn::make('price')->label(__('label.price'))->formatStateUsing(fn ($state) => number_format($state)),
|
||||
|
||||
Tables\Columns\TextColumn::make('duration')->label(__('label.medal.duration')),
|
||||
TextColumn::make('duration')->label(__('label.medal.duration')),
|
||||
|
||||
Tables\Columns\TextColumn::make('inventoryText')
|
||||
TextColumn::make('inventoryText')
|
||||
->label(__('medal.fields.inventory'))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('users_count')->label(__('medal.fields.users_count')),
|
||||
Tables\Columns\TextColumn::make('priority')->label(__('label.priority')),
|
||||
TextColumn::make('users_count')->label(__('medal.fields.users_count')),
|
||||
TextColumn::make('priority')->label(__('label.priority')),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
])
|
||||
->modifyQueryUsing(fn (Builder $query) => $query->orderBy("priority", 'desc')->orderBy('id', 'desc'))
|
||||
;
|
||||
@@ -152,9 +165,9 @@ class MedalResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListMedals::route('/'),
|
||||
'create' => Pages\CreateMedal::route('/create'),
|
||||
'edit' => Pages\EditMedal::route('/{record}/edit'),
|
||||
'index' => ListMedals::route('/'),
|
||||
'create' => CreateMedal::route('/create'),
|
||||
'edit' => EditMedal::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\MedalResource\Pages;
|
||||
|
||||
use Filament\Actions\DeleteAction;
|
||||
use App\Filament\Resources\System\MedalResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
@@ -13,7 +14,7 @@ class EditMedal extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\MedalResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\System\MedalResource;
|
||||
use App\Models\Medal;
|
||||
@@ -16,7 +17,7 @@ class ListMedals extends PageList
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,16 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\System\MessageTemplateResource\Pages\ManageMessageTemplates;
|
||||
use App\Enums\MessageTemplateNameEnum;
|
||||
use App\Filament\Resources\System\MessageTemplateResource\Pages;
|
||||
use App\Filament\Resources\System\MessageTemplateResource\RelationManagers;
|
||||
@@ -9,7 +19,6 @@ use App\Models\Language;
|
||||
use App\Models\MessageTemplate;
|
||||
use App\Models\Setting;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
@@ -21,9 +30,9 @@ class MessageTemplateResource extends Resource
|
||||
{
|
||||
protected static ?string $model = MessageTemplate::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
@@ -37,24 +46,24 @@ class MessageTemplateResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
$languages = Language::all();
|
||||
$default = $languages->first(fn ($item) => $item->site_lang_folder == Setting::getDefaultLang());
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('name')
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('name')
|
||||
->label(__('label.name'))
|
||||
->options(MessageTemplate::listAllNames())
|
||||
->columnSpanFull()
|
||||
->required(),
|
||||
Forms\Components\Select::make('language_id')
|
||||
Select::make('language_id')
|
||||
->label(__('label.language'))
|
||||
->options($languages->pluck('lang_name', 'id'))
|
||||
->default($default ? $default->id : null)
|
||||
->columnSpanFull()
|
||||
->required(),
|
||||
Forms\Components\Textarea::make('content')
|
||||
Textarea::make('content')
|
||||
->label(__('label.content'))
|
||||
->helperText(new HtmlString(__('message-template.content_help')."<br/>".__('message-template.register_welcome_content_help')))
|
||||
->columnSpanFull()
|
||||
@@ -68,35 +77,35 @@ class MessageTemplateResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('name')
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')
|
||||
->label(__('label.name'))
|
||||
->formatStateUsing(fn ($state) => $state->label())
|
||||
,
|
||||
Tables\Columns\TextColumn::make('language.lang_name')
|
||||
TextColumn::make('language.lang_name')
|
||||
->label(__('label.language'))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
TextColumn::make('updated_at')
|
||||
->label(__('label.updated_at'))
|
||||
,
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\SelectFilter::make('name')
|
||||
SelectFilter::make('name')
|
||||
->label(__('label.name'))
|
||||
->options(MessageTemplate::listAllNames())
|
||||
,
|
||||
Tables\Filters\SelectFilter::make('language_id')
|
||||
SelectFilter::make('language_id')
|
||||
->label(__('label.language'))
|
||||
->options(Language::all()->pluck('lang_name', 'id'))
|
||||
,
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -104,7 +113,7 @@ class MessageTemplateResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageMessageTemplates::route('/'),
|
||||
'index' => ManageMessageTemplates::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\MessageTemplateResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Filament\PageListSingle;
|
||||
use App\Filament\Resources\System\MessageTemplateResource;
|
||||
use Filament\Actions;
|
||||
@@ -14,7 +15,7 @@ class ManageMessageTemplates extends PageListSingle
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,19 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\System\PluginResource\Pages\ManagePlugins;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\Action;
|
||||
use App\Filament\Resources\System\PluginResource\Pages;
|
||||
use App\Filament\Resources\System\PluginResource\RelationManagers;
|
||||
use App\Jobs\ManagePlugin;
|
||||
use App\Models\Plugin;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -19,9 +26,9 @@ class PluginResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Plugin::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-plus-circle';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-plus-circle';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 99;
|
||||
|
||||
@@ -37,12 +44,12 @@ class PluginResource extends Resource
|
||||
|
||||
protected static bool $shouldRegisterNavigation = false;
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('package_name')->label(__('plugin.labels.package_name')),
|
||||
Forms\Components\TextInput::make('remote_url')->label(__('plugin.labels.remote_url')),
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('package_name')->label(__('plugin.labels.package_name')),
|
||||
TextInput::make('remote_url')->label(__('plugin.labels.remote_url')),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -50,36 +57,36 @@ class PluginResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('package_name')->label(__('plugin.labels.package_name')),
|
||||
Tables\Columns\TextColumn::make('remote_url')->label(__('plugin.labels.remote_url')),
|
||||
Tables\Columns\TextColumn::make('installed_version')->label(__('plugin.labels.installed_version')),
|
||||
Tables\Columns\TextColumn::make('statusText')->label(__('label.status')),
|
||||
Tables\Columns\TextColumn::make('updated_at')->label(__('plugin.labels.updated_at')),
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('package_name')->label(__('plugin.labels.package_name')),
|
||||
TextColumn::make('remote_url')->label(__('plugin.labels.remote_url')),
|
||||
TextColumn::make('installed_version')->label(__('plugin.labels.installed_version')),
|
||||
TextColumn::make('statusText')->label(__('label.status')),
|
||||
TextColumn::make('updated_at')->label(__('plugin.labels.updated_at')),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions(self::getActions())
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->recordActions(self::getActions())
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManagePlugins::route('/'),
|
||||
'index' => ManagePlugins::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
private static function getActions()
|
||||
{
|
||||
$actions = [];
|
||||
$actions[] = Tables\Actions\EditAction::make();
|
||||
$actions[] = EditAction::make();
|
||||
$actions[] = self::buildInstallAction();
|
||||
$actions[] = self::buildUpdateAction();
|
||||
$actions[] = Tables\Actions\DeleteAction::make('delete')
|
||||
$actions[] = DeleteAction::make('delete')
|
||||
->hidden(fn ($record) => !in_array($record->status, Plugin::$showDeleteBtnStatus))
|
||||
->using(function ($record) {
|
||||
$record->update(['status' => Plugin::STATUS_PRE_DELETE]);
|
||||
@@ -90,7 +97,7 @@ class PluginResource extends Resource
|
||||
|
||||
private static function buildInstallAction()
|
||||
{
|
||||
return Tables\Actions\Action::make('install')
|
||||
return Action::make('install')
|
||||
->label(__('plugin.actions.install'))
|
||||
->icon('heroicon-o-arrow-down')
|
||||
->requiresConfirmation()
|
||||
@@ -104,7 +111,7 @@ class PluginResource extends Resource
|
||||
|
||||
private static function buildUpdateAction()
|
||||
{
|
||||
return Tables\Actions\Action::make('update')
|
||||
return Action::make('update')
|
||||
->label(__('plugin.actions.update'))
|
||||
->icon('heroicon-o-arrow-up')
|
||||
->requiresConfirmation()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\PluginResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Filament\PageListSingle;
|
||||
use App\Filament\Resources\System\PluginResource;
|
||||
use Filament\Pages\Actions;
|
||||
@@ -14,7 +15,7 @@ class ManagePlugins extends PageListSingle
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\Layout\Stack;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use App\Filament\Resources\System\PluginStoreResource\Pages\ListPluginStores;
|
||||
use App\Filament\Resources\System\PluginStoreResource\Pages;
|
||||
use App\Filament\Resources\System\PluginStoreResource\RelationManagers;
|
||||
use App\Livewire\InstallPluginModal;
|
||||
use App\Models\Plugin;
|
||||
use App\Models\PluginStore;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Infolists\Infolist;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Support\Enums\FontWeight;
|
||||
use Filament\Tables;
|
||||
@@ -26,9 +30,9 @@ use Livewire\Livewire;
|
||||
class PluginStoreResource extends Resource
|
||||
{
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 99;
|
||||
|
||||
@@ -37,10 +41,10 @@ class PluginStoreResource extends Resource
|
||||
return PluginStore::getHasNewVersionCount() ?: '';
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
@@ -49,15 +53,15 @@ class PluginStoreResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\Layout\Stack::make([
|
||||
Tables\Columns\Layout\Stack::make([
|
||||
Tables\Columns\TextColumn::make(self::getColumnLabelKey("title"))
|
||||
Stack::make([
|
||||
Stack::make([
|
||||
TextColumn::make(self::getColumnLabelKey("title"))
|
||||
->weight(FontWeight::Bold)
|
||||
,
|
||||
Tables\Columns\TextColumn::make(self::getColumnLabelKey("description")),
|
||||
TextColumn::make(self::getColumnLabelKey("description")),
|
||||
]),
|
||||
Tables\Columns\Layout\Stack::make([
|
||||
Tables\Columns\TextColumn::make('version')
|
||||
Stack::make([
|
||||
TextColumn::make('version')
|
||||
->formatStateUsing(function (PluginStore $record) {
|
||||
$installedVersion = $record->installed_version;
|
||||
$latestVersion = $record->version;
|
||||
@@ -82,8 +86,8 @@ class PluginStoreResource extends Resource
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make()
|
||||
->recordActions([
|
||||
ViewAction::make()
|
||||
->modalHeading(nexus_trans("plugin.labels.introduce"))
|
||||
->modalContent(fn (PluginStore $record) => $record->getFullDescription())
|
||||
->extraModalFooterActions([
|
||||
@@ -93,7 +97,7 @@ class PluginStoreResource extends Resource
|
||||
,
|
||||
])
|
||||
,
|
||||
Tables\Actions\Action::make("install")
|
||||
Action::make("install")
|
||||
->label(function(PluginStore $record) {
|
||||
if ($record->hasNewVersion()) {
|
||||
return sprintf('%s(new: %s)', nexus_trans("plugin.actions.update"), $record->version);
|
||||
@@ -102,10 +106,10 @@ class PluginStoreResource extends Resource
|
||||
})
|
||||
->modalHeading(fn (PluginStore $record) => sprintf("%s: %s", nexus_trans("plugin.actions.install_or_update"), data_get($record, self::getColumnLabelKey("title"))))
|
||||
->modalContent(function (PluginStore $record) {
|
||||
$infolist = new Infolist();
|
||||
$infolist = new Schema();
|
||||
$infolist->record = $record;
|
||||
$infolist->schema([
|
||||
Infolists\Components\TextEntry::make('plugin_id')
|
||||
$infolist->components([
|
||||
TextEntry::make('plugin_id')
|
||||
->label(fn () => nexus_trans("plugin.labels.install_title", ['web_root' => base_path()]))
|
||||
->html(true)
|
||||
->formatStateUsing(function (PluginStore $record) {
|
||||
@@ -155,7 +159,7 @@ class PluginStoreResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListPluginStores::route('/'),
|
||||
'index' => ListPluginStores::route('/'),
|
||||
// 'create' => Pages\CreatePluginStore::route('/create'),
|
||||
// 'edit' => Pages\EditPluginStore::route('/{record}/edit'),
|
||||
];
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\PluginStoreResource\Pages;
|
||||
|
||||
use Filament\Actions\DeleteAction;
|
||||
use App\Filament\Resources\System\PluginStoreResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
@@ -13,7 +14,7 @@ class EditPluginStore extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,23 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Exception;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\BadgeColumn;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\System\SeedBoxRecordResource\Pages\ListSeedBoxRecords;
|
||||
use App\Filament\Resources\System\SeedBoxRecordResource\Pages\CreateSeedBoxRecord;
|
||||
use App\Filament\Resources\System\SeedBoxRecordResource\Pages\EditSeedBoxRecord;
|
||||
use App\Filament\OptionsTrait;
|
||||
use App\Filament\Resources\System\SeedBoxRecordResource\Pages;
|
||||
use App\Filament\Resources\System\SeedBoxRecordResource\RelationManagers;
|
||||
@@ -10,7 +27,6 @@ use App\Models\SeedBoxRecord;
|
||||
use App\Repositories\SeedBoxRepository;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -25,9 +41,9 @@ class SeedBoxRecordResource extends Resource
|
||||
|
||||
protected static ?string $model = SeedBoxRecord::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-archive-box';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-archive-box';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 8;
|
||||
|
||||
@@ -41,21 +57,21 @@ class SeedBoxRecordResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('operator')->label(__('label.seed_box_record.operator')),
|
||||
Forms\Components\TextInput::make('bandwidth')->label(__('label.seed_box_record.bandwidth'))->integer(),
|
||||
Forms\Components\TextInput::make('asn')->label(__('label.seed_box_record.asn'))->integer(),
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('operator')->label(__('label.seed_box_record.operator')),
|
||||
TextInput::make('bandwidth')->label(__('label.seed_box_record.bandwidth'))->integer(),
|
||||
TextInput::make('asn')->label(__('label.seed_box_record.asn'))->integer(),
|
||||
// Forms\Components\TextInput::make('ip_begin')->label(__('label.seed_box_record.ip_begin')),
|
||||
// Forms\Components\TextInput::make('ip_end')->label(__('label.seed_box_record.ip_end')),
|
||||
Forms\Components\TextInput::make('ip')->label(__('label.seed_box_record.ip'))->helperText(__('label.seed_box_record.ip_help')),
|
||||
Forms\Components\Toggle::make('is_allowed')
|
||||
TextInput::make('ip')->label(__('label.seed_box_record.ip'))->helperText(__('label.seed_box_record.ip_help')),
|
||||
Toggle::make('is_allowed')
|
||||
->label(__('label.seed_box_record.is_allowed'))
|
||||
->helperText(__('label.seed_box_record.is_allowed_help'))
|
||||
,
|
||||
Forms\Components\Textarea::make('comment')->label(__('label.comment')),
|
||||
Textarea::make('comment')->label(__('label.comment')),
|
||||
])->columns(1);
|
||||
}
|
||||
|
||||
@@ -63,18 +79,18 @@ class SeedBoxRecordResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('typeText')->label(__('label.seed_box_record.type')),
|
||||
Tables\Columns\TextColumn::make('uid')->searchable(),
|
||||
Tables\Columns\TextColumn::make('user.username')
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('typeText')->label(__('label.seed_box_record.type')),
|
||||
TextColumn::make('uid')->searchable(),
|
||||
TextColumn::make('user.username')
|
||||
->label(__('label.username'))
|
||||
->searchable()
|
||||
->formatStateUsing(fn ($record) => username_for_admin($record->uid))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('operator')->label(__('label.seed_box_record.operator'))->searchable(),
|
||||
Tables\Columns\TextColumn::make('bandwidth')->label(__('label.seed_box_record.bandwidth')),
|
||||
Tables\Columns\TextColumn::make('asn')->label(__('label.seed_box_record.asn')),
|
||||
Tables\Columns\TextColumn::make('ipRange')
|
||||
TextColumn::make('operator')->label(__('label.seed_box_record.operator'))->searchable(),
|
||||
TextColumn::make('bandwidth')->label(__('label.seed_box_record.bandwidth')),
|
||||
TextColumn::make('asn')->label(__('label.seed_box_record.asn')),
|
||||
TextColumn::make('ipRange')
|
||||
->label(__('label.seed_box_record.ip'))
|
||||
->searchable(true, function (Builder $query, $search) {
|
||||
try {
|
||||
@@ -83,14 +99,14 @@ class SeedBoxRecordResource extends Resource
|
||||
return $query->orWhere(function (Builder $query) use ($ipNumeric) {
|
||||
return $query->where('ip_begin_numeric', '<=', $ipNumeric)->where('ip_end_numeric', '>=', $ipNumeric);
|
||||
});
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
do_log("Invalid IP: $search, error: " . $exception->getMessage());
|
||||
}
|
||||
})
|
||||
,
|
||||
Tables\Columns\TextColumn::make('comment')->label(__('label.comment'))->searchable(),
|
||||
Tables\Columns\IconColumn::make('is_allowed')->boolean()->label(__('label.seed_box_record.is_allowed')),
|
||||
Tables\Columns\BadgeColumn::make('status')
|
||||
TextColumn::make('comment')->label(__('label.comment'))->searchable(),
|
||||
IconColumn::make('is_allowed')->boolean()->label(__('label.seed_box_record.is_allowed')),
|
||||
BadgeColumn::make('status')
|
||||
->colors([
|
||||
'success' => SeedBoxRecord::STATUS_ALLOWED,
|
||||
'warning' => SeedBoxRecord::STATUS_UNAUDITED,
|
||||
@@ -101,9 +117,9 @@ class SeedBoxRecordResource extends Resource
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
->filters([
|
||||
Tables\Filters\Filter::make('id')
|
||||
->form([
|
||||
Forms\Components\TextInput::make('id')
|
||||
Filter::make('id')
|
||||
->schema([
|
||||
TextInput::make('id')
|
||||
->label('ID')
|
||||
->placeholder('ID')
|
||||
,
|
||||
@@ -111,9 +127,9 @@ class SeedBoxRecordResource extends Resource
|
||||
return $query->when($data['id'], fn (Builder $query, $id) => $query->where("id", $id));
|
||||
})
|
||||
,
|
||||
Tables\Filters\Filter::make('uid')
|
||||
->form([
|
||||
Forms\Components\TextInput::make('uid')
|
||||
Filter::make('uid')
|
||||
->schema([
|
||||
TextInput::make('uid')
|
||||
->label('UID')
|
||||
->placeholder('UID')
|
||||
,
|
||||
@@ -121,26 +137,26 @@ class SeedBoxRecordResource extends Resource
|
||||
return $query->when($data['uid'], fn (Builder $query, $uid) => $query->where("uid", $uid));
|
||||
})
|
||||
,
|
||||
Tables\Filters\SelectFilter::make('type')->options(SeedBoxRecord::listTypes('text'))->label(__('label.seed_box_record.type')),
|
||||
Tables\Filters\SelectFilter::make('is_allowed')->options(self::getYesNoOptions())->label(__('label.seed_box_record.is_allowed')),
|
||||
Tables\Filters\SelectFilter::make('status')->options(SeedBoxRecord::listStatus('text'))->label(__('label.seed_box_record.status')),
|
||||
SelectFilter::make('type')->options(SeedBoxRecord::listTypes('text'))->label(__('label.seed_box_record.type')),
|
||||
SelectFilter::make('is_allowed')->options(self::getYesNoOptions())->label(__('label.seed_box_record.is_allowed')),
|
||||
SelectFilter::make('status')->options(SeedBoxRecord::listStatus('text'))->label(__('label.seed_box_record.status')),
|
||||
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\Action::make('audit')
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
Action::make('audit')
|
||||
->label(__('admin.resources.seed_box_record.toggle_status'))
|
||||
->mountUsing(fn (Forms\ComponentContainer $form, NexusModel $record) => $form->fill([
|
||||
->mountUsing(fn (Schema $schema, NexusModel $record) => $schema->fill([
|
||||
'status' => $record->status,
|
||||
]))
|
||||
->form([
|
||||
Forms\Components\Radio::make('status')
|
||||
->schema([
|
||||
Radio::make('status')
|
||||
->options(SeedBoxRecord::listStatus('text'))
|
||||
->inline()
|
||||
->label(__('label.seed_box_record.status'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('reason')
|
||||
TextInput::make('reason')
|
||||
->label(__('label.reason'))
|
||||
,
|
||||
])
|
||||
@@ -148,14 +164,14 @@ class SeedBoxRecordResource extends Resource
|
||||
$rep = new SeedBoxRepository();
|
||||
try {
|
||||
$rep->updateStatus($record, $data['status'], $data['reason']);
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
send_admin_fail_notification(class_basename($exception));
|
||||
}
|
||||
})
|
||||
,
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -169,9 +185,9 @@ class SeedBoxRecordResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListSeedBoxRecords::route('/'),
|
||||
'create' => Pages\CreateSeedBoxRecord::route('/create'),
|
||||
'edit' => Pages\EditSeedBoxRecord::route('/{record}/edit'),
|
||||
'index' => ListSeedBoxRecords::route('/'),
|
||||
'create' => CreateSeedBoxRecord::route('/create'),
|
||||
'edit' => EditSeedBoxRecord::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\SeedBoxRecordResource\Pages;
|
||||
|
||||
use Exception;
|
||||
use App\Filament\Resources\System\SeedBoxRecordResource;
|
||||
use App\Models\SeedBoxRecord;
|
||||
use App\Repositories\SeedBoxRepository;
|
||||
@@ -33,7 +34,7 @@ class CreateSeedBoxRecord extends CreateRecord
|
||||
return;
|
||||
}
|
||||
$this->redirect($this->getResource()::getUrl('index'));
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
send_admin_fail_notification($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\System\SeedBoxRecordResource\Pages;
|
||||
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Exception;
|
||||
use App\Filament\Resources\System\SeedBoxRecordResource;
|
||||
use App\Repositories\SeedBoxRepository;
|
||||
use Filament\Pages\Actions;
|
||||
@@ -14,7 +16,7 @@ class EditSeedBoxRecord extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -26,7 +28,7 @@ class EditSeedBoxRecord extends EditRecord
|
||||
$this->record = $rep->update($data, $this->record->id);
|
||||
send_admin_success_notification();
|
||||
$this->redirect($this->getResource()::getUrl('index'));
|
||||
} catch (\Exception $exception) {
|
||||
} catch (Exception $exception) {
|
||||
send_admin_fail_notification($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace App\Filament\Resources\System\SeedBoxRecordResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use App\Filament\PageList;
|
||||
use App\Filament\Resources\System\SeedBoxRecordResource;
|
||||
use App\Repositories\SeedBoxRepository;
|
||||
@@ -18,12 +21,12 @@ class ListSeedBoxRecords extends PageList
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
Actions\Action::make('check')
|
||||
CreateAction::make(),
|
||||
Action::make('check')
|
||||
->label(__('admin.resources.seed_box_record.check_modal_btn'))
|
||||
->form([
|
||||
Forms\Components\TextInput::make('ip')->required()->label('IP'),
|
||||
Forms\Components\TextInput::make('uid')->required()->label('UID'),
|
||||
->schema([
|
||||
TextInput::make('ip')->required()->label('IP'),
|
||||
TextInput::make('uid')->required()->label('UID'),
|
||||
])
|
||||
->modalHeading(__('admin.resources.seed_box_record.check_modal_header'))
|
||||
->action(function (array $data) {
|
||||
@@ -38,7 +41,7 @@ class ListSeedBoxRecords extends PageList
|
||||
// }
|
||||
})
|
||||
->registerModalActions([
|
||||
Actions\Action::make('checkResult')
|
||||
Action::make('checkResult')
|
||||
->modalHeading(function () {
|
||||
if (self::$checkResult !== null) {
|
||||
if (self::$checkResult['result']) {
|
||||
|
||||
@@ -2,12 +2,19 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\BadgeColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Actions\EditAction;
|
||||
use App\Filament\Resources\System\SettingResource\Pages\EditSetting;
|
||||
use App\Filament\OptionsTrait;
|
||||
use App\Filament\Resources\System\SettingResource\Pages;
|
||||
use App\Filament\Resources\System\SettingResource\RelationManagers;
|
||||
use App\Models\Setting;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -20,9 +27,9 @@ class SettingResource extends Resource
|
||||
|
||||
protected static ?string $model = Setting::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-cog';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-cog';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 1000;
|
||||
|
||||
@@ -37,13 +44,13 @@ class SettingResource extends Resource
|
||||
}
|
||||
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')->required()->disabled()->columnSpan(['sm' => 2]),
|
||||
Forms\Components\Textarea::make('value')->required()->columnSpan(['sm' => 2])
|
||||
->afterStateHydrated(function (Forms\Components\Textarea $component, $state) {
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->required()->disabled()->columnSpan(['sm' => 2]),
|
||||
Textarea::make('value')->required()->columnSpan(['sm' => 2])
|
||||
->afterStateHydrated(function (Textarea $component, $state) {
|
||||
$arr = json_decode($state, true);
|
||||
if (is_array($arr)) {
|
||||
$component->disabled();
|
||||
@@ -56,19 +63,19 @@ class SettingResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('name')->searchable(),
|
||||
Tables\Columns\TextColumn::make('value')->limit(),
|
||||
Tables\Columns\BadgeColumn::make('autoload')->colors(['success' => 'yes', 'warning' => 'no']),
|
||||
Tables\Columns\TextColumn::make('updated_at'),
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')->searchable(),
|
||||
TextColumn::make('value')->limit(),
|
||||
BadgeColumn::make('autoload')->colors(['success' => 'yes', 'warning' => 'no']),
|
||||
TextColumn::make('updated_at'),
|
||||
])
|
||||
->filters([
|
||||
Tables\Filters\SelectFilter::make('autoload')->options(self::$yesOrNo),
|
||||
SelectFilter::make('autoload')->options(self::$yesOrNo),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
->toolbarActions([
|
||||
// Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
@@ -85,7 +92,7 @@ class SettingResource extends Resource
|
||||
return [
|
||||
// 'index' => Pages\ListSettings::route('/'),
|
||||
// 'create' => Pages\CreateSetting::route('/create'),
|
||||
'index' => Pages\EditSetting::route('/'),
|
||||
'index' => EditSetting::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,17 @@
|
||||
|
||||
namespace App\Filament\Resources\System\SettingResource\Pages;
|
||||
|
||||
use Filament\Forms\Contracts\HasForms;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Schemas\Components\Tabs;
|
||||
use Filament\Schemas\Components\Tabs\Tab;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\CheckboxList;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Schemas\Components\Section;
|
||||
use App\Auth\Permission;
|
||||
use App\Filament\OptionsTrait;
|
||||
use App\Filament\Resources\System\SettingResource;
|
||||
@@ -20,13 +31,13 @@ use Illuminate\Support\HtmlString;
|
||||
use Meilisearch\Contracts\Index\Settings;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
class EditSetting extends Page implements HasForms
|
||||
{
|
||||
use Forms\Concerns\InteractsWithForms, OptionsTrait;
|
||||
use InteractsWithForms, OptionsTrait;
|
||||
|
||||
protected static string $resource = SettingResource::class;
|
||||
|
||||
protected static string $view = 'filament.resources.system.setting-resource.pages.edit-hit-and-run';
|
||||
protected string $view = 'filament.resources.system.setting-resource.pages.edit-hit-and-run';
|
||||
|
||||
public ?array $data = [];
|
||||
|
||||
@@ -41,10 +52,10 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
$this->fillForm();
|
||||
}
|
||||
|
||||
public function form(Forms\Form $form): Forms\Form
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema($this->getFormSchema())
|
||||
return $schema
|
||||
->components($this->getFormSchema())
|
||||
->statePath('data');
|
||||
}
|
||||
|
||||
@@ -59,7 +70,7 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
protected function getFormSchema(): array
|
||||
{
|
||||
return [
|
||||
Forms\Components\Tabs::make('Heading')
|
||||
Tabs::make('Heading')
|
||||
->tabs($this->getTabs())
|
||||
];
|
||||
}
|
||||
@@ -109,7 +120,7 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
private function getTabs(): array
|
||||
{
|
||||
$tabs = [];
|
||||
$tabs[] = Forms\Components\Tabs\Tab::make(__('label.setting.hr.tab_header'))
|
||||
$tabs[] = Tab::make(__('label.setting.hr.tab_header'))
|
||||
->id('hr')
|
||||
->schema($this->getHitAndRunSchema())
|
||||
->columns(2)
|
||||
@@ -120,102 +131,102 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
// ->columns(2)
|
||||
// ;
|
||||
|
||||
$tabs[] = Forms\Components\Tabs\Tab::make(__('label.setting.backup.tab_header'))
|
||||
$tabs[] = Tab::make(__('label.setting.backup.tab_header'))
|
||||
->id('backup')
|
||||
->schema([
|
||||
Forms\Components\Radio::make('backup.enabled')->options(self::$yesOrNo)->inline(true)->label(__('label.enabled'))->helperText(__('label.setting.backup.enabled_help')),
|
||||
Forms\Components\Radio::make('backup.frequency')->options(['daily' => 'daily', 'hourly' => 'hourly'])->inline(true)->label(__('label.setting.backup.frequency'))->helperText(__('label.setting.backup.frequency_help')),
|
||||
Forms\Components\Select::make('backup.hour')->options(range(0, 23))->label(__('label.setting.backup.hour'))->helperText(__('label.setting.backup.hour_help')),
|
||||
Forms\Components\Select::make('backup.minute')->options(range(0, 59))->label(__('label.setting.backup.minute'))->helperText(__('label.setting.backup.minute_help')),
|
||||
Radio::make('backup.enabled')->options(self::$yesOrNo)->inline(true)->label(__('label.enabled'))->helperText(__('label.setting.backup.enabled_help')),
|
||||
Radio::make('backup.frequency')->options(['daily' => 'daily', 'hourly' => 'hourly'])->inline(true)->label(__('label.setting.backup.frequency'))->helperText(__('label.setting.backup.frequency_help')),
|
||||
Select::make('backup.hour')->options(range(0, 23))->label(__('label.setting.backup.hour'))->helperText(__('label.setting.backup.hour_help')),
|
||||
Select::make('backup.minute')->options(range(0, 59))->label(__('label.setting.backup.minute'))->helperText(__('label.setting.backup.minute_help')),
|
||||
// Forms\Components\TextInput::make('backup.google_drive_client_id')->label(__('label.setting.backup.google_drive_client_id')),
|
||||
// Forms\Components\TextInput::make('backup.google_drive_client_secret')->label(__('label.setting.backup.google_drive_client_secret')),
|
||||
// Forms\Components\TextInput::make('backup.google_drive_refresh_token')->label(__('label.setting.backup.google_drive_refresh_token')),
|
||||
// Forms\Components\TextInput::make('backup.google_drive_folder_id')->label(__('label.setting.backup.google_drive_folder_id')),
|
||||
Forms\Components\TextInput::make('backup.export_path')->label(__('label.setting.backup.export_path'))->helperText(new HtmlString(__('label.setting.backup.export_path_help', ['default_path' => ToolRepository::getBackupExportPathDefault()]))),
|
||||
Forms\Components\TextInput::make('backup.retention_count')->numeric()->label(__('label.setting.backup.retention_count'))->helperText(new HtmlString(__('label.setting.backup.retention_count_help', ['default_count' => ToolRepository::BACKUP_RETENTION_COUNT_DEFAULT]))),
|
||||
Forms\Components\Radio::make('backup.via_ftp')->options(self::$yesOrNo)->inline(true)->label(__('label.setting.backup.via_ftp'))->helperText(new HtmlString(__('label.setting.backup.via_ftp_help'))),
|
||||
Forms\Components\Radio::make('backup.via_sftp')->options(self::$yesOrNo)->inline(true)->label(__('label.setting.backup.via_sftp'))->helperText(new HtmlString(__('label.setting.backup.via_sftp_help'))),
|
||||
TextInput::make('backup.export_path')->label(__('label.setting.backup.export_path'))->helperText(new HtmlString(__('label.setting.backup.export_path_help', ['default_path' => ToolRepository::getBackupExportPathDefault()]))),
|
||||
TextInput::make('backup.retention_count')->numeric()->label(__('label.setting.backup.retention_count'))->helperText(new HtmlString(__('label.setting.backup.retention_count_help', ['default_count' => ToolRepository::BACKUP_RETENTION_COUNT_DEFAULT]))),
|
||||
Radio::make('backup.via_ftp')->options(self::$yesOrNo)->inline(true)->label(__('label.setting.backup.via_ftp'))->helperText(new HtmlString(__('label.setting.backup.via_ftp_help'))),
|
||||
Radio::make('backup.via_sftp')->options(self::$yesOrNo)->inline(true)->label(__('label.setting.backup.via_sftp'))->helperText(new HtmlString(__('label.setting.backup.via_sftp_help'))),
|
||||
])->columns(2);
|
||||
|
||||
$tabs[] = Forms\Components\Tabs\Tab::make(__('label.setting.seed_box.tab_header'))
|
||||
$tabs[] = Tab::make(__('label.setting.seed_box.tab_header'))
|
||||
->id('seed_box')
|
||||
->schema([
|
||||
Forms\Components\Radio::make('seed_box.enabled')->options(self::$yesOrNo)->inline(true)->label(__('label.enabled'))->helperText(__('label.setting.seed_box.enabled_help')),
|
||||
Forms\Components\TextInput::make('seed_box.not_seed_box_max_speed')->label(__('label.setting.seed_box.not_seed_box_max_speed'))->helperText(__('label.setting.seed_box.not_seed_box_max_speed_help'))->integer(),
|
||||
Forms\Components\Radio::make('seed_box.no_promotion')->options(self::$yesOrNo)->inline(true)->label(__('label.setting.seed_box.no_promotion'))->helperText(__('label.setting.seed_box.no_promotion_help')),
|
||||
Forms\Components\TextInput::make('seed_box.max_uploaded')->label(__('label.setting.seed_box.max_uploaded'))->helperText(__('label.setting.seed_box.max_uploaded_help'))->integer(),
|
||||
Forms\Components\TextInput::make('seed_box.max_uploaded_duration')->label(__('label.setting.seed_box.max_uploaded_duration'))->helperText(__('label.setting.seed_box.max_uploaded_duration_help'))->integer(),
|
||||
Radio::make('seed_box.enabled')->options(self::$yesOrNo)->inline(true)->label(__('label.enabled'))->helperText(__('label.setting.seed_box.enabled_help')),
|
||||
TextInput::make('seed_box.not_seed_box_max_speed')->label(__('label.setting.seed_box.not_seed_box_max_speed'))->helperText(__('label.setting.seed_box.not_seed_box_max_speed_help'))->integer(),
|
||||
Radio::make('seed_box.no_promotion')->options(self::$yesOrNo)->inline(true)->label(__('label.setting.seed_box.no_promotion'))->helperText(__('label.setting.seed_box.no_promotion_help')),
|
||||
TextInput::make('seed_box.max_uploaded')->label(__('label.setting.seed_box.max_uploaded'))->helperText(__('label.setting.seed_box.max_uploaded_help'))->integer(),
|
||||
TextInput::make('seed_box.max_uploaded_duration')->label(__('label.setting.seed_box.max_uploaded_duration'))->helperText(__('label.setting.seed_box.max_uploaded_duration_help'))->integer(),
|
||||
])->columns(2);
|
||||
|
||||
$id = "meilisearch";
|
||||
$tabs[] = Forms\Components\Tabs\Tab::make(__("label.setting.$id.tab_header"))
|
||||
$tabs[] = Tab::make(__("label.setting.$id.tab_header"))
|
||||
->id($id)
|
||||
->schema($this->getTabMeilisearchSchema($id))
|
||||
->columns(2)
|
||||
;
|
||||
|
||||
$id = "image_hosting";
|
||||
$tabs[] = Forms\Components\Tabs\Tab::make(__("label.setting.$id.tab_header"))
|
||||
$tabs[] = Tab::make(__("label.setting.$id.tab_header"))
|
||||
->id($id)
|
||||
->schema($this->getTabImageHostingSchema($id))
|
||||
->columns(2)
|
||||
;
|
||||
$id = "permission";
|
||||
$tabs[] = Forms\Components\Tabs\Tab::make(__("label.setting.$id.tab_header"))
|
||||
$tabs[] = Tab::make(__("label.setting.$id.tab_header"))
|
||||
->id($id)
|
||||
->schema($this->getTabPermissionSchema($id))
|
||||
->columns(2)
|
||||
;
|
||||
|
||||
$tabs[] = Forms\Components\Tabs\Tab::make(__('label.setting.system.tab_header'))
|
||||
$tabs[] = Tab::make(__('label.setting.system.tab_header'))
|
||||
->id('system')
|
||||
->schema([
|
||||
Forms\Components\Radio::make('system.change_username_card_allow_characters_outside_the_alphabets')
|
||||
Radio::make('system.change_username_card_allow_characters_outside_the_alphabets')
|
||||
->options(self::$yesOrNo)
|
||||
->inline(true)
|
||||
->label(__('label.setting.system.change_username_card_allow_characters_outside_the_alphabets'))
|
||||
,
|
||||
Forms\Components\TextInput::make('system.change_username_min_interval_in_days')
|
||||
TextInput::make('system.change_username_min_interval_in_days')
|
||||
->integer()
|
||||
->label(__('label.setting.system.change_username_min_interval_in_days'))
|
||||
,
|
||||
Forms\Components\TextInput::make('system.maximum_number_of_medals_can_be_worn')
|
||||
TextInput::make('system.maximum_number_of_medals_can_be_worn')
|
||||
->integer()
|
||||
->label(__('label.setting.system.maximum_number_of_medals_can_be_worn'))
|
||||
,
|
||||
Forms\Components\TextInput::make('system.cookie_valid_days')
|
||||
TextInput::make('system.cookie_valid_days')
|
||||
->integer()
|
||||
->label(__('label.setting.system.cookie_valid_days'))
|
||||
,
|
||||
Forms\Components\TextInput::make('system.maximum_upload_speed')
|
||||
TextInput::make('system.maximum_upload_speed')
|
||||
->integer()
|
||||
->label(__('label.setting.system.maximum_upload_speed'))
|
||||
->helperText(__('label.setting.system.maximum_upload_speed_help'))
|
||||
,
|
||||
Forms\Components\Radio::make('system.is_invite_pre_email_and_username')
|
||||
Radio::make('system.is_invite_pre_email_and_username')
|
||||
->options(self::$yesOrNo)
|
||||
->inline(true)
|
||||
->label(__('label.setting.system.is_invite_pre_email_and_username'))
|
||||
->helperText(__('label.setting.system.is_invite_pre_email_and_username_help'))
|
||||
,
|
||||
Forms\Components\Radio::make('system.is_record_announce_log')
|
||||
Radio::make('system.is_record_announce_log')
|
||||
->options(self::$yesOrNo)
|
||||
->inline(true)
|
||||
->label(__('label.setting.system.is_record_announce_log'))
|
||||
->helperText(__('label.setting.system.is_record_announce_log_help'))
|
||||
,
|
||||
Forms\Components\Radio::make('system.is_record_seeding_bonus_log')
|
||||
Radio::make('system.is_record_seeding_bonus_log')
|
||||
->options(self::$yesOrNo)
|
||||
->inline(true)
|
||||
->label(__('label.setting.system.is_record_seeding_bonus_log'))
|
||||
->helperText(__('label.setting.system.is_record_seeding_bonus_log_help'))
|
||||
,
|
||||
Forms\Components\Select::make('system.access_admin_class_min')
|
||||
Select::make('system.access_admin_class_min')
|
||||
->options(User::listClass(User::CLASS_VIP))
|
||||
->label(__('label.setting.system.access_admin_class_min'))
|
||||
->helperText(__('label.setting.system.access_admin_class_min_help'))
|
||||
,
|
||||
Forms\Components\TextInput::make('system.alarm_email_receiver')
|
||||
TextInput::make('system.alarm_email_receiver')
|
||||
->label(__('label.setting.system.alarm_email_receiver'))
|
||||
->helperText(__('label.setting.system.alarm_email_receiver_help'))
|
||||
,
|
||||
@@ -228,13 +239,13 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
private function getHitAndRunSchema()
|
||||
{
|
||||
$default = [
|
||||
Forms\Components\Radio::make('hr.mode')->options(HitAndRun::listModes(true))->inline(true)->label(__('label.setting.hr.mode')),
|
||||
Forms\Components\TextInput::make('hr.inspect_time')->helperText(__('label.setting.hr.inspect_time_help'))->label(__('label.setting.hr.inspect_time'))->integer(),
|
||||
Forms\Components\TextInput::make('hr.seed_time_minimum')->helperText(__('label.setting.hr.seed_time_minimum_help'))->label(__('label.setting.hr.seed_time_minimum'))->integer(),
|
||||
Forms\Components\TextInput::make('hr.leech_time_minimum')->helperText(__('label.setting.hr.leech_time_minimum_help'))->label(__('label.setting.hr.leech_time_minimum'))->integer(),
|
||||
Forms\Components\TextInput::make('hr.ignore_when_ratio_reach')->helperText(__('label.setting.hr.ignore_when_ratio_reach_help'))->label(__('label.setting.hr.ignore_when_ratio_reach'))->integer(),
|
||||
Forms\Components\TextInput::make('hr.ban_user_when_counts_reach')->helperText(__('label.setting.hr.ban_user_when_counts_reach_help'))->label(__('label.setting.hr.ban_user_when_counts_reach'))->integer(),
|
||||
Forms\Components\TextInput::make('hr.include_rate')->helperText(__('label.setting.hr.include_rate_help'))->label(__('label.setting.hr.include_rate'))->numeric(),
|
||||
Radio::make('hr.mode')->options(HitAndRun::listModes(true))->inline(true)->label(__('label.setting.hr.mode')),
|
||||
TextInput::make('hr.inspect_time')->helperText(__('label.setting.hr.inspect_time_help'))->label(__('label.setting.hr.inspect_time'))->integer(),
|
||||
TextInput::make('hr.seed_time_minimum')->helperText(__('label.setting.hr.seed_time_minimum_help'))->label(__('label.setting.hr.seed_time_minimum'))->integer(),
|
||||
TextInput::make('hr.leech_time_minimum')->helperText(__('label.setting.hr.leech_time_minimum_help'))->label(__('label.setting.hr.leech_time_minimum'))->integer(),
|
||||
TextInput::make('hr.ignore_when_ratio_reach')->helperText(__('label.setting.hr.ignore_when_ratio_reach_help'))->label(__('label.setting.hr.ignore_when_ratio_reach'))->integer(),
|
||||
TextInput::make('hr.ban_user_when_counts_reach')->helperText(__('label.setting.hr.ban_user_when_counts_reach_help'))->label(__('label.setting.hr.ban_user_when_counts_reach'))->integer(),
|
||||
TextInput::make('hr.include_rate')->helperText(__('label.setting.hr.include_rate_help'))->label(__('label.setting.hr.include_rate'))->numeric(),
|
||||
];
|
||||
return apply_filter("hit_and_run_setting_schema", $default);
|
||||
}
|
||||
@@ -242,42 +253,42 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
private function getRequireSeedSectionSchema(): array
|
||||
{
|
||||
return [
|
||||
Forms\Components\Radio::make('require_seed_section.enabled')->options(self::$yesOrNo)->label(__('label.enabled'))->helperText(__('label.setting.require_seed_section.enabled_help')),
|
||||
Forms\Components\TextInput::make('require_seed_section.menu_title')->label(__('label.setting.require_seed_section.menu_title'))->helperText(__('label.setting.require_seed_section.menu_title_help')),
|
||||
Forms\Components\TextInput::make('require_seed_section.seeder_lte')->label(__('label.setting.require_seed_section.seeder_lte'))->helperText(__('label.setting.require_seed_section.seeder_lte_help'))->integer(),
|
||||
Forms\Components\TextInput::make('require_seed_section.seeder_gte')->label(__('label.setting.require_seed_section.seeder_gte'))->helperText(__('label.setting.require_seed_section.seeder_gte_help'))->integer(),
|
||||
Forms\Components\CheckboxList::make('require_seed_section.require_tags')->label(__('label.setting.require_seed_section.require_tags'))->helperText(__('label.setting.require_seed_section.require_tags_help'))->options(Tag::query()->pluck('name', 'id'))->columns(4),
|
||||
Forms\Components\Select::make('require_seed_section.promotion_state')->label(__('label.setting.require_seed_section.promotion_state'))->helperText(__('label.setting.require_seed_section.promotion_state_help'))->options(Torrent::listPromotionTypes(true)),
|
||||
Forms\Components\TextInput::make('require_seed_section.daily_seed_time_min')->label(__('label.setting.require_seed_section.daily_seed_time_min'))->helperText(__('label.setting.require_seed_section.daily_seed_time_min_help'))->integer(),
|
||||
Forms\Components\TextInput::make('require_seed_section.torrent_count_max')->label(__('label.setting.require_seed_section.torrent_count_max'))->helperText(__('label.setting.require_seed_section.torrent_count_max_help'))->integer(),
|
||||
Forms\Components\Repeater::make('require_seed_section.bonus_reward')
|
||||
Radio::make('require_seed_section.enabled')->options(self::$yesOrNo)->label(__('label.enabled'))->helperText(__('label.setting.require_seed_section.enabled_help')),
|
||||
TextInput::make('require_seed_section.menu_title')->label(__('label.setting.require_seed_section.menu_title'))->helperText(__('label.setting.require_seed_section.menu_title_help')),
|
||||
TextInput::make('require_seed_section.seeder_lte')->label(__('label.setting.require_seed_section.seeder_lte'))->helperText(__('label.setting.require_seed_section.seeder_lte_help'))->integer(),
|
||||
TextInput::make('require_seed_section.seeder_gte')->label(__('label.setting.require_seed_section.seeder_gte'))->helperText(__('label.setting.require_seed_section.seeder_gte_help'))->integer(),
|
||||
CheckboxList::make('require_seed_section.require_tags')->label(__('label.setting.require_seed_section.require_tags'))->helperText(__('label.setting.require_seed_section.require_tags_help'))->options(Tag::query()->pluck('name', 'id'))->columns(4),
|
||||
Select::make('require_seed_section.promotion_state')->label(__('label.setting.require_seed_section.promotion_state'))->helperText(__('label.setting.require_seed_section.promotion_state_help'))->options(Torrent::listPromotionTypes(true)),
|
||||
TextInput::make('require_seed_section.daily_seed_time_min')->label(__('label.setting.require_seed_section.daily_seed_time_min'))->helperText(__('label.setting.require_seed_section.daily_seed_time_min_help'))->integer(),
|
||||
TextInput::make('require_seed_section.torrent_count_max')->label(__('label.setting.require_seed_section.torrent_count_max'))->helperText(__('label.setting.require_seed_section.torrent_count_max_help'))->integer(),
|
||||
Repeater::make('require_seed_section.bonus_reward')
|
||||
->label(__('label.setting.require_seed_section.bonus_reward'))
|
||||
->helperText(__('label.setting.require_seed_section.bonus_reward_help'))
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('seeders')
|
||||
TextInput::make('seeders')
|
||||
->label(__('label.setting.require_seed_section.seeders'))
|
||||
->required()
|
||||
->integer()
|
||||
->columnSpan(2)
|
||||
,
|
||||
Forms\Components\Repeater::make('seed_time_reward')
|
||||
Repeater::make('seed_time_reward')
|
||||
->label(__('label.setting.require_seed_section.seed_time_reward'))
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('begin')->label(__('label.setting.require_seed_section.seed_time_reward_begin'))->helperText(__('label.setting.require_seed_section.seed_time_reward_begin_help')),
|
||||
Forms\Components\TextInput::make('end')->label(__('label.setting.require_seed_section.seed_time_reward_end'))->helperText(__('label.setting.require_seed_section.seed_time_reward_end_help')),
|
||||
Forms\Components\TextInput::make('window')->label(__('label.setting.require_seed_section.seed_time_reward_window'))->helperText(__('label.setting.require_seed_section.seed_time_reward_window_help')),
|
||||
Forms\Components\TextInput::make('reward')->label(__('label.setting.require_seed_section.seed_time_reward_reward'))->helperText(__('label.setting.require_seed_section.seed_time_reward_reward_help')),
|
||||
TextInput::make('begin')->label(__('label.setting.require_seed_section.seed_time_reward_begin'))->helperText(__('label.setting.require_seed_section.seed_time_reward_begin_help')),
|
||||
TextInput::make('end')->label(__('label.setting.require_seed_section.seed_time_reward_end'))->helperText(__('label.setting.require_seed_section.seed_time_reward_end_help')),
|
||||
TextInput::make('window')->label(__('label.setting.require_seed_section.seed_time_reward_window'))->helperText(__('label.setting.require_seed_section.seed_time_reward_window_help')),
|
||||
TextInput::make('reward')->label(__('label.setting.require_seed_section.seed_time_reward_reward'))->helperText(__('label.setting.require_seed_section.seed_time_reward_reward_help')),
|
||||
])
|
||||
->columns(4)
|
||||
->columnSpan(5)
|
||||
,
|
||||
Forms\Components\Repeater::make('data_traffic_reward')
|
||||
Repeater::make('data_traffic_reward')
|
||||
->label(__('label.setting.require_seed_section.data_traffic_reward'))
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('begin')->label(__('label.setting.require_seed_section.data_traffic_reward_begin'))->helperText(__('label.setting.require_seed_section.data_traffic_reward_begin_help')),
|
||||
Forms\Components\TextInput::make('end')->label(__('label.setting.require_seed_section.data_traffic_reward_end'))->helperText(__('label.setting.require_seed_section.data_traffic_reward_end_help')),
|
||||
Forms\Components\TextInput::make('window')->label(__('label.setting.require_seed_section.data_traffic_reward_window'))->helperText(__('label.setting.require_seed_section.data_traffic_reward_window_help')),
|
||||
Forms\Components\TextInput::make('reward')->label(__('label.setting.require_seed_section.data_traffic_reward_reward'))->helperText(__('label.setting.require_seed_section.data_traffic_reward_reward_help')),
|
||||
TextInput::make('begin')->label(__('label.setting.require_seed_section.data_traffic_reward_begin'))->helperText(__('label.setting.require_seed_section.data_traffic_reward_begin_help')),
|
||||
TextInput::make('end')->label(__('label.setting.require_seed_section.data_traffic_reward_end'))->helperText(__('label.setting.require_seed_section.data_traffic_reward_end_help')),
|
||||
TextInput::make('window')->label(__('label.setting.require_seed_section.data_traffic_reward_window'))->helperText(__('label.setting.require_seed_section.data_traffic_reward_window_help')),
|
||||
TextInput::make('reward')->label(__('label.setting.require_seed_section.data_traffic_reward_reward'))->helperText(__('label.setting.require_seed_section.data_traffic_reward_reward_help')),
|
||||
])
|
||||
->columns(4)
|
||||
->columnSpan(5)
|
||||
@@ -294,7 +305,7 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
$schema = [];
|
||||
|
||||
$name = "$id.enabled";
|
||||
$schema[] = Forms\Components\Radio::make($name)
|
||||
$schema[] = Radio::make($name)
|
||||
->options(self::$yesOrNo)
|
||||
->inline(true)
|
||||
->label(__('label.enabled'))
|
||||
@@ -302,7 +313,7 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
;
|
||||
|
||||
$name = "$id.search_description";
|
||||
$schema[] = Forms\Components\Radio::make($name)
|
||||
$schema[] = Radio::make($name)
|
||||
->options(self::$yesOrNo)
|
||||
->inline(true)
|
||||
->label(__("label.setting.$name"))
|
||||
@@ -310,7 +321,7 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
;
|
||||
|
||||
$name = "$id.default_search_mode";
|
||||
$schema[] = Forms\Components\Radio::make($name)
|
||||
$schema[] = Radio::make($name)
|
||||
->options(SearchBox::listSearchModes())
|
||||
->inline(true)
|
||||
->label(__("label.setting.$name"))
|
||||
@@ -324,7 +335,7 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
{
|
||||
$schema = [];
|
||||
$name = "$id.driver";
|
||||
$schema[] = Forms\Components\Radio::make($name)
|
||||
$schema[] = Radio::make($name)
|
||||
->options(['local' => 'local', 'chevereto' => 'chevereto', 'lsky' => 'lsky'])
|
||||
->inline(true)
|
||||
->label(__("label.setting.$name"))
|
||||
@@ -337,19 +348,19 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
$driverId = sprintf("%s_%s", $id, $driverName);
|
||||
$driverSchemas = [];
|
||||
$field = "upload_api_endpoint";
|
||||
$driverSchemas[] = Forms\Components\TextInput::make("$driverId.$field")
|
||||
$driverSchemas[] = TextInput::make("$driverId.$field")
|
||||
->label(__("label.setting.$id.$field"))
|
||||
;
|
||||
$field = "upload_token";
|
||||
$driverSchemas[] = Forms\Components\TextInput::make("$driverId.$field")
|
||||
$driverSchemas[] = TextInput::make("$driverId.$field")
|
||||
->label(__("label.setting.$id.$field"))
|
||||
;
|
||||
$field = "base_url";
|
||||
$driverSchemas[] = Forms\Components\TextInput::make("$driverId.$field")
|
||||
$driverSchemas[] = TextInput::make("$driverId.$field")
|
||||
->label(__("label.setting.$id.$field"))
|
||||
;
|
||||
|
||||
$driverSection = Forms\Components\Section::make($driverName)->schema($driverSchemas);
|
||||
$driverSection = Section::make($driverName)->schema($driverSchemas);
|
||||
$schema[] = $driverSection;
|
||||
|
||||
//lsky
|
||||
@@ -357,18 +368,18 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
$driverId = sprintf("%s_%s", $id, $driverName);
|
||||
$driverSchemas = [];
|
||||
$field = "upload_api_endpoint";
|
||||
$driverSchemas[] = Forms\Components\TextInput::make("$driverId.$field")
|
||||
$driverSchemas[] = TextInput::make("$driverId.$field")
|
||||
->label(__("label.setting.$id.$field"))
|
||||
;
|
||||
$field = "upload_token";
|
||||
$driverSchemas[] = Forms\Components\TextInput::make("$driverId.$field")
|
||||
$driverSchemas[] = TextInput::make("$driverId.$field")
|
||||
->label(__("label.setting.$id.$field"))
|
||||
;
|
||||
$field = "base_url";
|
||||
$driverSchemas[] = Forms\Components\TextInput::make("$driverId.$field")
|
||||
$driverSchemas[] = TextInput::make("$driverId.$field")
|
||||
->label(__("label.setting.$id.$field"))
|
||||
;
|
||||
$driverSection = Forms\Components\Section::make($driverName)->schema($driverSchemas);
|
||||
$driverSection = Section::make($driverName)->schema($driverSchemas);
|
||||
$schema[] = $driverSection;
|
||||
|
||||
|
||||
@@ -380,7 +391,7 @@ class EditSetting extends Page implements Forms\Contracts\HasForms
|
||||
$schema = [];
|
||||
|
||||
$name = "$id.user_token_allowed";
|
||||
$schema[] = Forms\Components\CheckboxList::make($name)
|
||||
$schema[] = CheckboxList::make($name)
|
||||
->options(TokenRepository::listUserTokenPermissions())
|
||||
->label(__("label.setting.{$name}"))
|
||||
->helperText(__("label.setting.{$name}_help"))
|
||||
|
||||
@@ -2,13 +2,18 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\EditAction;
|
||||
use App\Filament\Resources\System\TorrentStateResource\Pages\ManageTorrentStates;
|
||||
use App\Filament\Resources\System\TorrentStateResource\Pages;
|
||||
use App\Filament\Resources\System\TorrentStateResource\RelationManagers;
|
||||
use App\Models\Setting;
|
||||
use App\Models\Torrent;
|
||||
use App\Models\TorrentState;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -20,9 +25,9 @@ class TorrentStateResource extends Resource
|
||||
{
|
||||
protected static ?string $model = TorrentState::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-megaphone';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-megaphone';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 9;
|
||||
|
||||
@@ -36,17 +41,17 @@ class TorrentStateResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('global_sp_state')
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('global_sp_state')
|
||||
->options(Torrent::listPromotionTypes(true))
|
||||
->label(__('label.torrent_state.global_sp_state'))
|
||||
->required(),
|
||||
Forms\Components\DateTimePicker::make('begin')
|
||||
DateTimePicker::make('begin')
|
||||
->label(__('label.begin')),
|
||||
Forms\Components\DateTimePicker::make('deadline')
|
||||
DateTimePicker::make('deadline')
|
||||
->label(__('label.deadline')),
|
||||
])->columns(1);
|
||||
}
|
||||
@@ -55,15 +60,15 @@ class TorrentStateResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('global_sp_state_text')->label(__('label.torrent_state.global_sp_state')),
|
||||
Tables\Columns\TextColumn::make('begin')->label(__('label.begin')),
|
||||
Tables\Columns\TextColumn::make('deadline')->label(__('label.deadline')),
|
||||
TextColumn::make('global_sp_state_text')->label(__('label.torrent_state.global_sp_state')),
|
||||
TextColumn::make('begin')->label(__('label.begin')),
|
||||
TextColumn::make('deadline')->label(__('label.deadline')),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make()->after(function () {
|
||||
->recordActions([
|
||||
EditAction::make()->after(function () {
|
||||
do_log("cache_del: global_promotion_state");
|
||||
NexusDB::cache_del(Setting::TORRENT_GLOBAL_STATE_CACHE_KEY);
|
||||
do_log("publish_model_event: global_promotion_state_updated");
|
||||
@@ -71,7 +76,7 @@ class TorrentStateResource extends Resource
|
||||
}),
|
||||
// Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
->toolbarActions([
|
||||
// Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
@@ -79,7 +84,7 @@ class TorrentStateResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageTorrentStates::route('/'),
|
||||
'index' => ManageTorrentStates::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,21 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\System\TrackerUrlResource\Pages\ManageTrackerUrls;
|
||||
use App\Filament\OptionsTrait;
|
||||
use App\Filament\Resources\System\TrackerUrlResource\Pages;
|
||||
use App\Filament\Resources\System\TrackerUrlResource\RelationManagers;
|
||||
use App\Models\TrackerUrl;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
@@ -20,9 +29,9 @@ class TrackerUrlResource extends Resource
|
||||
|
||||
protected static ?string $model = TrackerUrl::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 10;
|
||||
|
||||
@@ -36,24 +45,24 @@ class TrackerUrlResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('url')->required(),
|
||||
Forms\Components\Radio::make('is_default')
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('url')->required(),
|
||||
Radio::make('is_default')
|
||||
->label(__('label.is_default'))
|
||||
->options(self::getYesNoOptions())
|
||||
->required(true)
|
||||
->inline()
|
||||
,
|
||||
Forms\Components\Radio::make('enabled')
|
||||
Radio::make('enabled')
|
||||
->label(__('label.enabled'))
|
||||
->options(self::getEnableDisableOptions(1, 0))
|
||||
->required(true)
|
||||
->inline()
|
||||
,
|
||||
Forms\Components\TextInput::make('priority')
|
||||
TextInput::make('priority')
|
||||
->label(__('label.priority'))->numeric()
|
||||
->default(0)
|
||||
->helperText(__('label.priority_help'))
|
||||
@@ -74,35 +83,35 @@ class TrackerUrlResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
TextColumn::make('id')
|
||||
,
|
||||
Tables\Columns\TextColumn::make('url')
|
||||
TextColumn::make('url')
|
||||
,
|
||||
Tables\Columns\IconColumn::make('is_default')
|
||||
IconColumn::make('is_default')
|
||||
->label(__('label.is_default'))
|
||||
->boolean()
|
||||
,
|
||||
Tables\Columns\IconColumn::make('enabled')
|
||||
IconColumn::make('enabled')
|
||||
->label(__('label.enabled'))
|
||||
->boolean()
|
||||
,
|
||||
Tables\Columns\TextColumn::make('priority')
|
||||
TextColumn::make('priority')
|
||||
->label(__('label.priority'))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
TextColumn::make('updated_at')
|
||||
->label(__('label.updated_at'))
|
||||
,
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -110,7 +119,7 @@ class TrackerUrlResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageTrackerUrls::route('/'),
|
||||
'index' => ManageTrackerUrls::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\TrackerUrlResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Filament\PageListSingle;
|
||||
use App\Filament\Resources\System\TrackerUrlResource;
|
||||
use Filament\Actions;
|
||||
@@ -14,7 +15,7 @@ class ManageTrackerUrls extends PageListSingle
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,17 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\System\UploadSpeedResource\Pages\ManageUploadSpeeds;
|
||||
use App\Filament\Resources\System\UploadSpeedResource\Pages;
|
||||
use App\Filament\Resources\System\UploadSpeedResource\RelationManagers;
|
||||
use App\Models\UploadSpeed;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -17,9 +23,9 @@ class UploadSpeedResource extends Resource
|
||||
{
|
||||
protected static ?string $model = UploadSpeed::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-arrow-up-tray';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-arrow-up-tray';
|
||||
|
||||
protected static ?string $navigationGroup = 'System';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'System';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
@@ -33,11 +39,11 @@ class UploadSpeedResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')->label(__('label.name'))
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->label(__('label.name'))
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -45,25 +51,25 @@ class UploadSpeedResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('name')->label(__('label.name')),
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')->label(__('label.name')),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageUploadSpeeds::route('/'),
|
||||
'index' => ManageUploadSpeeds::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\System\UploadSpeedResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Filament\Resources\System\UploadSpeedResource;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
@@ -13,7 +14,7 @@ class ManageUploadSpeeds extends ManageRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,16 @@
|
||||
|
||||
namespace App\Filament\Resources\System;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use App\Filament\Resources\System\UsernameChangeLogResource\Pages\ManageUsernameChangeLogs;
|
||||
use App\Filament\Resources\System\UsernameChangeLogResource\Pages;
|
||||
use App\Filament\Resources\System\UsernameChangeLogResource\RelationManagers;
|
||||
use App\Models\UsernameChangeLog;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -18,9 +23,9 @@ class UsernameChangeLogResource extends Resource
|
||||
{
|
||||
protected static ?string $model = UsernameChangeLog::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-pencil-square';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-pencil-square';
|
||||
|
||||
protected static ?string $navigationGroup = 'User';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'User';
|
||||
|
||||
protected static ?int $navigationSort = 100;
|
||||
|
||||
@@ -34,10 +39,10 @@ class UsernameChangeLogResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
@@ -46,28 +51,28 @@ class UsernameChangeLogResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
Tables\Columns\TextColumn::make('changeTypeText')->label(__('username-change-log.labels.change_type')),
|
||||
Tables\Columns\TextColumn::make('uid')->searchable(),
|
||||
Tables\Columns\TextColumn::make('user.username')->searchable()->label(__('label.username')),
|
||||
Tables\Columns\TextColumn::make('username_old')->searchable()->label(__('username-change-log.labels.username_old')),
|
||||
Tables\Columns\TextColumn::make('username_new')
|
||||
TextColumn::make('id')->sortable(),
|
||||
TextColumn::make('changeTypeText')->label(__('username-change-log.labels.change_type')),
|
||||
TextColumn::make('uid')->searchable(),
|
||||
TextColumn::make('user.username')->searchable()->label(__('label.username')),
|
||||
TextColumn::make('username_old')->searchable()->label(__('username-change-log.labels.username_old')),
|
||||
TextColumn::make('username_new')
|
||||
->searchable()
|
||||
->label(__('username-change-log.labels.username_new'))
|
||||
->formatStateUsing(fn ($record) => new HtmlString(get_username($record->uid, false, true, true, true)))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('operator')
|
||||
TextColumn::make('operator')
|
||||
->searchable()
|
||||
->label(__('label.operator'))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('created_at')->label(__('label.created_at'))->formatStateUsing(fn ($state) => format_datetime($state)),
|
||||
TextColumn::make('created_at')->label(__('label.created_at'))->formatStateUsing(fn ($state) => format_datetime($state)),
|
||||
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
->filters([
|
||||
Tables\Filters\Filter::make('uid')
|
||||
->form([
|
||||
Forms\Components\TextInput::make('uid')
|
||||
Filter::make('uid')
|
||||
->schema([
|
||||
TextInput::make('uid')
|
||||
->label('UID')
|
||||
->placeholder('UID')
|
||||
,
|
||||
@@ -75,13 +80,13 @@ class UsernameChangeLogResource extends Resource
|
||||
return $query->when($data['uid'], fn (Builder $query, $uid) => $query->where("uid", $uid));
|
||||
})
|
||||
,
|
||||
Tables\Filters\SelectFilter::make('change_type')->options(UsernameChangeLog::listChangeType())->label(__('username-change-log.labels.change_type')),
|
||||
SelectFilter::make('change_type')->options(UsernameChangeLog::listChangeType())->label(__('username-change-log.labels.change_type')),
|
||||
])
|
||||
->actions([
|
||||
->recordActions([
|
||||
// Tables\Actions\EditAction::make(),
|
||||
// Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
->toolbarActions([
|
||||
// Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
@@ -89,7 +94,7 @@ class UsernameChangeLogResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageUsernameChangeLogs::route('/'),
|
||||
'index' => ManageUsernameChangeLogs::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user