-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0eb207c
commit a2e1a95
Showing
8 changed files
with
704 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources; | ||
|
||
use App\Filament\Resources\CatalogPageResource\Pages; | ||
use App\Filament\Resources\CatalogPageResource\RelationManagers\CatalogItemsRelationManager; | ||
use App\Models\Game\Furniture\CatalogPage; | ||
use Filament\Forms\Components\TextInput; | ||
use Filament\Forms\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Tables\Actions\BulkActionGroup; | ||
use Filament\Tables\Actions\DeleteAction; | ||
use Filament\Tables\Actions\DeleteBulkAction; | ||
use Filament\Tables\Actions\EditAction; | ||
use Filament\Tables\Columns\ImageColumn; | ||
use Filament\Tables\Columns\TextColumn; | ||
use Filament\Tables\Table; | ||
|
||
class CatalogPageResource extends Resource | ||
{ | ||
protected static ?string $model = CatalogPage::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack'; | ||
|
||
protected static ?string $navigationGroup = 'Hotel'; | ||
|
||
public static string $translateIdentifier = 'catalog-pages'; | ||
|
||
protected static ?string $slug = 'hotel/catalog-pages'; | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
TextInput::make('parent_id') | ||
->required() | ||
->integer(), | ||
|
||
TextInput::make('caption_save') | ||
->required(), | ||
|
||
TextInput::make('caption') | ||
->required(), | ||
|
||
TextInput::make('page_layout') | ||
->required(), | ||
|
||
TextInput::make('icon_color') | ||
->required() | ||
->integer(), | ||
|
||
TextInput::make('icon_image') | ||
->required() | ||
->integer(), | ||
|
||
TextInput::make('min_rank') | ||
->required() | ||
->integer(), | ||
|
||
TextInput::make('order_num') | ||
->required() | ||
->integer(), | ||
|
||
TextInput::make('visible') | ||
->required(), | ||
|
||
TextInput::make('enabled') | ||
->required(), | ||
|
||
TextInput::make('club_only') | ||
->required(), | ||
|
||
TextInput::make('vip_only') | ||
->required(), | ||
|
||
TextInput::make('page_headline') | ||
->required(), | ||
|
||
TextInput::make('page_teaser') | ||
->required(), | ||
|
||
TextInput::make('page_special'), | ||
|
||
TextInput::make('page_text1'), | ||
|
||
TextInput::make('page_text2'), | ||
|
||
TextInput::make('page_text_details'), | ||
|
||
TextInput::make('page_text_teaser'), | ||
|
||
TextInput::make('room_id') | ||
->integer(), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
TextColumn::make('parent_id'), | ||
|
||
TextColumn::make('caption_save'), | ||
|
||
TextColumn::make('caption') | ||
->searchable() | ||
->sortable(), | ||
|
||
TextColumn::make('page_layout'), | ||
|
||
TextColumn::make('icon_color'), | ||
|
||
ImageColumn::make('icon_image'), | ||
|
||
TextColumn::make('min_rank'), | ||
|
||
TextColumn::make('order_num'), | ||
|
||
TextColumn::make('visible'), | ||
|
||
TextColumn::make('enabled'), | ||
|
||
TextColumn::make('club_only'), | ||
|
||
TextColumn::make('vip_only'), | ||
|
||
TextColumn::make('page_headline'), | ||
|
||
TextColumn::make('page_teaser'), | ||
|
||
TextColumn::make('page_special'), | ||
|
||
TextColumn::make('page_text1'), | ||
|
||
TextColumn::make('page_text2'), | ||
|
||
TextColumn::make('room_id'), | ||
|
||
TextColumn::make('includes'), | ||
]) | ||
->filters([ | ||
// | ||
]) | ||
->actions([ | ||
EditAction::make(), | ||
DeleteAction::make(), | ||
]) | ||
->bulkActions([ | ||
BulkActionGroup::make([ | ||
DeleteBulkAction::make(), | ||
]), | ||
]); | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListCatalogPages::route('/'), | ||
'create' => Pages\CreateCatalogPage::route('/create'), | ||
'edit' => Pages\EditCatalogPage::route('/{record}/edit'), | ||
]; | ||
} | ||
|
||
public static function getRelations(): array | ||
{ | ||
return [ | ||
CatalogItemsRelationManager::class, | ||
]; | ||
} | ||
|
||
public static function getGloballySearchableAttributes(): array | ||
{ | ||
return ['caption']; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
app/Filament/Resources/CatalogPageResource/Pages/CreateCatalogPage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\CatalogPageResource\Pages; | ||
|
||
use App\Filament\Resources\CatalogPageResource; | ||
use Filament\Resources\Pages\CreateRecord; | ||
|
||
class CreateCatalogPage extends CreateRecord | ||
{ | ||
protected static string $resource = CatalogPageResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
|
||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/CatalogPageResource/Pages/EditCatalogPage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\CatalogPageResource\Pages; | ||
|
||
use App\Filament\Resources\CatalogPageResource; | ||
use Filament\Actions\DeleteAction; | ||
use Filament\Resources\Pages\EditRecord; | ||
|
||
class EditCatalogPage extends EditRecord | ||
{ | ||
protected static string $resource = CatalogPageResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
DeleteAction::make(), | ||
]; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/Filament/Resources/CatalogPageResource/Pages/ListCatalogPages.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
namespace App\Filament\Resources\CatalogPageResource\Pages; | ||
|
||
use App\Filament\Resources\CatalogPageResource; | ||
use Filament\Actions\CreateAction; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
class ListCatalogPages extends ListRecords | ||
{ | ||
protected static string $resource = CatalogPageResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
CreateAction::make(), | ||
]; | ||
} | ||
} |
Oops, something went wrong.