init
This commit is contained in:
232 files changed
+25416
No files matched your search
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarSubscriptions;
|
||||
|
||||
use App\Filament\Resources\BazaarSubscriptions\Pages\ListBazaarSubscriptions;
|
||||
use App\Filament\Resources\BazaarSubscriptions\Pages\ViewBazaarSubscription;
|
||||
use App\Filament\Resources\BazaarSubscriptions\Schemas\BazaarSubscriptionForm;
|
||||
use App\Filament\Resources\BazaarSubscriptions\Schemas\BazaarSubscriptionInfolist;
|
||||
use App\Filament\Resources\BazaarSubscriptions\Tables\BazaarSubscriptionsTable;
|
||||
use App\Models\BazaarSubscription;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class BazaarSubscriptionResource extends Resource
|
||||
{
|
||||
protected static ?string $model = BazaarSubscription::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Cafe Bazaar';
|
||||
|
||||
protected static ?string $navigationLabel = 'Subscriptions';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return BazaarSubscriptionForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return BazaarSubscriptionInfolist::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return BazaarSubscriptionsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListBazaarSubscriptions::route('/'),
|
||||
'view' => ViewBazaarSubscription::route('/{record}'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarSubscriptions\Pages;
|
||||
|
||||
use App\Filament\Resources\BazaarSubscriptions\BazaarSubscriptionResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateBazaarSubscription extends CreateRecord
|
||||
{
|
||||
protected static string $resource = BazaarSubscriptionResource::class;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarSubscriptions\Pages;
|
||||
|
||||
use App\Filament\Resources\BazaarSubscriptions\BazaarSubscriptionResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditBazaarSubscription extends EditRecord
|
||||
{
|
||||
protected static string $resource = BazaarSubscriptionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
ViewAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarSubscriptions\Pages;
|
||||
|
||||
use App\Filament\Resources\BazaarSubscriptions\BazaarSubscriptionResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListBazaarSubscriptions extends ListRecords
|
||||
{
|
||||
protected static string $resource = BazaarSubscriptionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarSubscriptions\Pages;
|
||||
|
||||
use App\Filament\Resources\BazaarSubscriptions\BazaarSubscriptionResource;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewBazaarSubscription extends ViewRecord
|
||||
{
|
||||
protected static string $resource = BazaarSubscriptionResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarSubscriptions\Schemas;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class BazaarSubscriptionForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarSubscriptions\Schemas;
|
||||
|
||||
use Filament\Infolists\Components\IconEntry;
|
||||
use Filament\Infolists\Components\TextEntry;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class BazaarSubscriptionInfolist
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextEntry::make('subscription_id'),
|
||||
TextEntry::make('purchase_token')->copyable()->columnSpanFull(),
|
||||
TextEntry::make('linked_subscription_token')->copyable()->columnSpanFull(),
|
||||
TextEntry::make('status')->badge(),
|
||||
IconEntry::make('auto_renewing')->boolean(),
|
||||
TextEntry::make('starts_at')->dateTime(),
|
||||
TextEntry::make('valid_until')->dateTime(),
|
||||
TextEntry::make('bazaar_response')->formatStateUsing(fn (?array $state): string => json_encode($state, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE))->columnSpanFull(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BazaarSubscriptions\Tables;
|
||||
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class BazaarSubscriptionsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('subscription_id')->searchable()->sortable(),
|
||||
TextColumn::make('status')->badge()->sortable(),
|
||||
IconColumn::make('auto_renewing')->boolean(),
|
||||
TextColumn::make('starts_at')->dateTime()->sortable(),
|
||||
TextColumn::make('valid_until')->dateTime()->sortable(),
|
||||
TextColumn::make('validated_at')->since()->sortable(),
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('status')->options([
|
||||
'active' => 'Active',
|
||||
'expired' => 'Expired',
|
||||
'cancelled' => 'Cancelled',
|
||||
'refunded' => 'Refunded',
|
||||
'unknown' => 'Unknown',
|
||||
]),
|
||||
])
|
||||
->recordActions([
|
||||
ViewAction::make(),
|
||||
])
|
||||
->defaultSort('created_at', 'desc');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user