Refactor CurrencyRateResource and VisaMasterSettings: remove unnecessary whitespace, add property annotations, and define possible setting types. Update Turkish translations for warning text and content.
This commit is contained in:
@@ -23,7 +23,6 @@ class CurrencyRateResource extends Resource
|
||||
|
||||
protected static ?string $cluster = SettingsCluster::class;
|
||||
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
@@ -41,7 +40,6 @@ class CurrencyRateResource extends Resource
|
||||
return __('Currency rates');
|
||||
}
|
||||
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return CurrencyRateForm::configure($schema);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Resources\VisaMasterSettings\Pages;
|
||||
|
||||
use App\Filament\Clusters\Settings\Resources\VisaMasterSettings\VisaMasterSettingsResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateVisaMasterSettings extends CreateRecord
|
||||
{
|
||||
protected static string $resource = VisaMasterSettingsResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Resources\VisaMasterSettings\Pages;
|
||||
|
||||
use App\Filament\Clusters\Settings\Resources\VisaMasterSettings\VisaMasterSettingsResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditVisaMasterSettings extends EditRecord
|
||||
{
|
||||
protected static string $resource = VisaMasterSettingsResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Resources\VisaMasterSettings\Pages;
|
||||
|
||||
use App\Filament\Clusters\Settings\Resources\VisaMasterSettings\VisaMasterSettingsResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListVisaMasterSettings extends ListRecords
|
||||
{
|
||||
protected static string $resource = VisaMasterSettingsResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Resources\VisaMasterSettings\Schemas;
|
||||
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterSettings;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class VisaMasterSettingsForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('name')
|
||||
->label(__('Type'))
|
||||
->options(VisaMasterSettings::types())
|
||||
->native(false)
|
||||
->required(),
|
||||
|
||||
TextInput::make('display_name')
|
||||
->label(__('Name'))
|
||||
->required()
|
||||
->string()
|
||||
->maxLength(255)
|
||||
->readonly(! user()->isMe()),
|
||||
|
||||
RichEditor::make('value')
|
||||
->label(__('Content'))
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Resources\VisaMasterSettings\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class VisaMasterSettingsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
TextColumn::make('display_name')
|
||||
->searchable(),
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
TextColumn::make('updated_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Clusters\Settings\Resources\VisaMasterSettings;
|
||||
|
||||
use App\Filament\Clusters\Settings\Resources\VisaMasterSettings\Pages\CreateVisaMasterSettings;
|
||||
use App\Filament\Clusters\Settings\Resources\VisaMasterSettings\Pages\EditVisaMasterSettings;
|
||||
use App\Filament\Clusters\Settings\Resources\VisaMasterSettings\Pages\ListVisaMasterSettings;
|
||||
use App\Filament\Clusters\Settings\Resources\VisaMasterSettings\Schemas\VisaMasterSettingsForm;
|
||||
use App\Filament\Clusters\Settings\Resources\VisaMasterSettings\Tables\VisaMasterSettingsTable;
|
||||
use App\Filament\Clusters\Settings\SettingsCluster;
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterSettings;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class VisaMasterSettingsResource extends Resource
|
||||
{
|
||||
protected static ?string $model = VisaMasterSettings::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedDocumentText;
|
||||
|
||||
protected static ?string $cluster = SettingsCluster::class;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'display_name';
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('Currencies');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('Warning text');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('Warning text');
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return VisaMasterSettingsForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return VisaMasterSettingsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListVisaMasterSettings::route('/'),
|
||||
'create' => CreateVisaMasterSettings::route('/create'),
|
||||
'edit' => EditVisaMasterSettings::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,25 @@ namespace App\Modules\VisaMasterPaymentOrder\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $display_name
|
||||
* @property string $value
|
||||
*/
|
||||
class VisaMasterSettings extends Model
|
||||
{
|
||||
protected $table = 'visa_master_settings';
|
||||
|
||||
/**
|
||||
* The possible types of settings.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function types(): array
|
||||
{
|
||||
return [
|
||||
'payment_warning_text' => __('Warning text'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -709,5 +709,7 @@
|
||||
"Currency from": "Walýuta girişi",
|
||||
"Currency to": "Walýuta çykýan",
|
||||
"Currency value": "Kursy",
|
||||
"Currency rates": "Walýuta kurslary"
|
||||
"Currency rates": "Walýuta kurslary",
|
||||
"Warning text": "Duýduruş teksti",
|
||||
"Content": "Mazmuny"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user