wip import
This commit is contained in:
1 parent
2ead682763
commit
baa1117f61
22 files changed
+315
-261
No files matched your search
@@ -15,8 +15,6 @@ class BettypeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Bettype::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-storefront';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?string $navigationLabel = 'NuhOdds Markets';
|
||||
|
||||
-2
@@ -16,8 +16,6 @@ class CompetitionGroupResource extends Resource
|
||||
{
|
||||
protected static ?string $model = CompetitionGroup::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-folder';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
-2
@@ -16,8 +16,6 @@ class CompetitonGroupProviderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = CompetitionGroupProvider::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-folder';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $modelLabel = 'Provider Groups';
|
||||
|
||||
@@ -28,8 +28,6 @@ class CountryResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 13;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-folder';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'TxOdds';
|
||||
|
||||
-2
@@ -16,8 +16,6 @@ class ElementProviderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = ElementProvider::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-folder';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?int $navigationSort = 21;
|
||||
|
||||
@@ -16,8 +16,6 @@ class ElementResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Element::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-folder';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
@@ -7,7 +7,7 @@ use App\Filament\Clusters\StaticData\Resources\Players\Schemas\PlayerForm;
|
||||
use App\Filament\Clusters\StaticData\Resources\Players\Tables\PlayersTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\Player;
|
||||
use BackedEnum;
|
||||
// use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
@@ -18,8 +18,6 @@ class PlayerResource extends Resource
|
||||
|
||||
protected static bool $shouldRegisterNavigation = false;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerplayer';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
@@ -19,8 +19,6 @@ class SportResource extends Resource
|
||||
|
||||
protected static ?int $navigationSort = 13;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-folder';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'name';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
+10
-10
@@ -3,11 +3,11 @@
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\StatistikoEventsResource;
|
||||
use App\Filament\Imports\StatistikoEventImporter;
|
||||
// use App\Filament\Imports\StatistikoEventImporter;
|
||||
use App\Models\StatistikoEvent;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\ImportAction;
|
||||
// use Filament\Actions\ImportAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStatistikoEvents extends ListRecords
|
||||
@@ -27,14 +27,14 @@ class ListStatistikoEvents extends ListRecords
|
||||
CreateAction::make()
|
||||
->label('New')
|
||||
->icon('phosphor-plus'),
|
||||
ImportAction::make('importEvents')
|
||||
->maxRows(200000)
|
||||
->color('success')
|
||||
->chunkSize(250)
|
||||
->icon('phosphor-upload')
|
||||
->label('Import')
|
||||
->modalDescription('Max 20k rows per import, column separator: ";"')
|
||||
->importer(StatistikoEventImporter::class),
|
||||
// ImportAction::make('importEvents')
|
||||
// ->maxRows(200000)
|
||||
// ->color('success')
|
||||
// ->chunkSize(250)
|
||||
// ->icon('phosphor-upload')
|
||||
// ->label('Import')
|
||||
// ->modalDescription('Max 20k rows per import, column separator: ";"')
|
||||
// ->importer(StatistikoEventImporter::class),
|
||||
];
|
||||
}
|
||||
}
|
||||
+1
-4
@@ -7,7 +7,6 @@ use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Schemas\Statisti
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoEvents\Tables\StatistikoEventsTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\StatistikoEvent;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
@@ -17,9 +16,7 @@ class StatistikoEventsResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StatistikoEvent::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerball';
|
||||
|
||||
protected static ?string $navigationLabel = 'Event';
|
||||
protected static ?string $navigationLabel = 'Events';
|
||||
|
||||
protected static ?string $modelLabel = 'Events';
|
||||
|
||||
|
||||
+3
@@ -14,7 +14,10 @@ class ListStatistikoImports extends ListRecords
|
||||
{
|
||||
return [
|
||||
CreateAction::make('upload_file')
|
||||
->modalIcon('phosphor-upload')
|
||||
->modalHeading('Upload Statistiko Files')
|
||||
->label('Upload file')
|
||||
->createAnother(false)
|
||||
->icon('phosphor-upload'),
|
||||
];
|
||||
}
|
||||
|
||||
+14
-2
@@ -5,6 +5,7 @@ namespace App\Filament\Clusters\StaticData\Resources\StatistikoImports\Schemas;
|
||||
use App\Models\Sport;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Schemas\Components\Icon;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class StatistikoImportForm
|
||||
@@ -26,10 +27,21 @@ class StatistikoImportForm
|
||||
]),
|
||||
|
||||
FileUpload::make('file_name')
|
||||
->directory('statistika')
|
||||
->label('Select File')
|
||||
->directory('statistiko')
|
||||
->visibility('public')
|
||||
->required()
|
||||
->storeFileNamesIn('file_name_original'),
|
||||
->storeFileNamesIn('file_name_original')
|
||||
->beforeContent(Icon::make('phosphor-microsoft-excel-logo'))
|
||||
->belowContent(Schema::end([
|
||||
'Only excel files accepted.',
|
||||
'First row contains column titles.',
|
||||
]))
|
||||
->acceptedFileTypes([
|
||||
'application/vnd.ms-excel',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'text/csv', // Optional: include if you accept CSV too
|
||||
]),
|
||||
])->columns(1);
|
||||
}
|
||||
}
|
||||
-3
@@ -7,7 +7,6 @@ use App\Filament\Clusters\StaticData\Resources\StatistikoImports\Schemas\Statist
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoImports\Tables\StatistikoImportsTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\StatistikoImport;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
@@ -17,8 +16,6 @@ class StatistikaImportResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StatistikoImport::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'phosphor-upload';
|
||||
|
||||
protected static ?string $navigationLabel = 'File Uploads';
|
||||
|
||||
protected static ?string $modelLabel = 'File Uploads';
|
||||
|
||||
+31
-14
@@ -2,13 +2,15 @@
|
||||
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoImports\Tables;
|
||||
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\SelectColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class StatistikoImportsTable
|
||||
@@ -31,23 +33,38 @@ class StatistikoImportsTable
|
||||
'events' => '<span class="text-green-500">Events</span>',
|
||||
'events_player' => '<span class="text-amber-500">Events & Player</span>',
|
||||
]),
|
||||
// TextColumn::make('data_type'),
|
||||
TextColumn::make('file_name_original')->searchable()->color('primary')->label('Name'),
|
||||
ToggleColumn::make('run_import')
|
||||
->tooltip('Import will run in the background, on compleation a message will be send.')
|
||||
->onColor(fn ($state) => $state ? 'success' : 'gray')
|
||||
->beforeStateUpdated(function ($record, $state) {
|
||||
if ($state) {
|
||||
$record->is_running = 1;
|
||||
}
|
||||
}),
|
||||
IconColumn::make('is_running')->boolean()->falseColor('gray'),
|
||||
IconColumn::make('has_run')->boolean()->falseColor('gray'),
|
||||
TextColumn::make('file_name_original')
|
||||
->searchable()
|
||||
->color('primary')
|
||||
->label('Name'),
|
||||
IconColumn::make('has_run')
|
||||
->label('Import')
|
||||
->alignCenter()
|
||||
->boolean()
|
||||
->falseColor('gray'),
|
||||
TextColumn::make('created_at')->dateTime(),
|
||||
|
||||
])
|
||||
->filters([
|
||||
SelectFilter::make('data_type')
|
||||
->options([
|
||||
'player' => 'Player',
|
||||
'events' => 'Events',
|
||||
'events_player' => 'Events & Player',
|
||||
]),
|
||||
])
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
DeleteAction::make()->iconButton(),
|
||||
ActionGroup::make([
|
||||
Action::make('Import')
|
||||
->label('Just Import (very fast)')
|
||||
->icon('phosphor-database'),
|
||||
Action::make('Update')
|
||||
->label('Import and Update (slow)')
|
||||
->icon('phosphor-database'),
|
||||
DeleteAction::make()
|
||||
->label('Delete file'),
|
||||
]),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
|
||||
+10
-10
@@ -3,11 +3,11 @@
|
||||
namespace App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Pages;
|
||||
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\StatistikoPlayerResource;
|
||||
use App\Filament\Imports\StatistikoPlayerImporter;
|
||||
// use App\Filament\Imports\StatistikoPlayerImporter;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Actions\ImportAction;
|
||||
// use Filament\Actions\ImportAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListStatistikoPlayers extends ListRecords
|
||||
@@ -27,14 +27,14 @@ class ListStatistikoPlayers extends ListRecords
|
||||
CreateAction::make()
|
||||
->label('New')
|
||||
->icon('phosphor-plus'),
|
||||
ImportAction::make('importPlayer')
|
||||
->maxRows(200000)
|
||||
->color('success')
|
||||
->chunkSize(250)
|
||||
->icon('phosphor-upload')
|
||||
->label('Import')
|
||||
->modalDescription('Max 20k rows per import, column separator ";"')
|
||||
->importer(StatistikoPlayerImporter::class),
|
||||
// ImportAction::make('importPlayer')
|
||||
// ->maxRows(200000)
|
||||
// ->color('success')
|
||||
// ->chunkSize(250)
|
||||
// ->icon('phosphor-upload')
|
||||
// ->label('Import')
|
||||
// ->modalDescription('Max 20k rows per import, column separator ";"')
|
||||
// ->importer(StatistikoPlayerImporter::class),
|
||||
];
|
||||
}
|
||||
}
|
||||
-3
@@ -7,7 +7,6 @@ use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Schemas\Statist
|
||||
use App\Filament\Clusters\StaticData\Resources\StatistikoPlayers\Tables\StatistikoPlayersTable;
|
||||
use App\Filament\Clusters\StaticData\StaticDataCluster;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Table;
|
||||
@@ -17,8 +16,6 @@ class StatistikoPlayerResource extends Resource
|
||||
{
|
||||
protected static ?string $model = StatistikoPlayer::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = 'icon-soccerplayer';
|
||||
|
||||
protected static ?string $navigationLabel = 'Player';
|
||||
|
||||
protected static ?string $modelLabel = 'Players';
|
||||
|
||||
@@ -15,8 +15,6 @@ class TxoddsMarketResource extends Resource
|
||||
{
|
||||
protected static ?string $model = TxoddsMarket::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-storefront';
|
||||
|
||||
protected static ?string $cluster = StaticDataCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 32;
|
||||
|
||||
Reference in new issue
Block a user