icons all to phosphor
This commit is contained in:
1 parent
1c766f0ee6
commit
b31f3ec005
6 files changed
+59
-35
No files matched your search
@@ -223,7 +223,7 @@ class EventsTable
|
|||||||
->searchable()
|
->searchable()
|
||||||
->preload()
|
->preload()
|
||||||
->options(function () {
|
->options(function () {
|
||||||
$res = Event::query()->where('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
$res = Event::query()->whereDate('starttime', '>', Carbon::now())->groupBy('country_id')->pluck('country_id')->toArray();
|
||||||
|
|
||||||
return Country::query()->whereIn('id', $res)->pluck('name', 'id');
|
return Country::query()->whereIn('id', $res)->pluck('name', 'id');
|
||||||
})
|
})
|
||||||
@@ -289,18 +289,18 @@ class EventsTable
|
|||||||
$end = Carbon::createFromDate($starttime_period['end']);
|
$end = Carbon::createFromDate($starttime_period['end']);
|
||||||
|
|
||||||
return $query
|
return $query
|
||||||
->where('starttime', '>=', $from->format('Y-m-d 00:00:00'))
|
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'))
|
||||||
->where('starttime', '<=', $end->format('Y-m-d 00:00:00'));
|
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00'));
|
||||||
} elseif (isset($starttime_period['start'])) {
|
} elseif (isset($starttime_period['start'])) {
|
||||||
$from = Carbon::createFromDate($starttime_period['start']);
|
$from = Carbon::createFromDate($starttime_period['start']);
|
||||||
|
|
||||||
return $query
|
return $query
|
||||||
->where('starttime', '>=', $from->format('Y-m-d 00:00:00'));
|
->whereDate('starttime', '>=', $from->format('Y-m-d 00:00:00'));
|
||||||
} elseif (isset($starttime_period['end'])) {
|
} elseif (isset($starttime_period['end'])) {
|
||||||
$end = Carbon::createFromDate($starttime_period['end']);
|
$end = Carbon::createFromDate($starttime_period['end']);
|
||||||
|
|
||||||
return $query
|
return $query
|
||||||
->where('starttime', '<=', $end->format('Y-m-d 00:00:00'));
|
->whereDate('starttime', '<=', $end->format('Y-m-d 00:00:00'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -7,4 +7,25 @@ use Filament\Tables\Columns\Column;
|
|||||||
class BookmakerIcon extends Column
|
class BookmakerIcon extends Column
|
||||||
{
|
{
|
||||||
protected string $view = 'filament.tables.columns.bookmaker-icon';
|
protected string $view = 'filament.tables.columns.bookmaker-icon';
|
||||||
|
|
||||||
|
protected ?string $size = null;
|
||||||
|
|
||||||
|
public function size(?string $size): static
|
||||||
|
{
|
||||||
|
$this->size = $size;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSize(): ?string
|
||||||
|
{
|
||||||
|
switch ($this->size) {
|
||||||
|
case 'xl':
|
||||||
|
return 'h-6 w-30';
|
||||||
|
case 'lg':
|
||||||
|
return 'h-5 w-20';
|
||||||
|
default:
|
||||||
|
return 'h-4 w-16';
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Filament\Tables\Columns;
|
namespace App\Filament\Tables\Columns;
|
||||||
|
|
||||||
use App\Models\BookmakerSport;
|
|
||||||
use Filament\Tables\Columns\Column;
|
use Filament\Tables\Columns\Column;
|
||||||
|
|
||||||
class ColumnMl extends Column
|
class ColumnMl extends Column
|
||||||
@@ -33,14 +32,6 @@ class ColumnMl extends Column
|
|||||||
return $this->bookmakers;
|
return $this->bookmakers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getActivBookmaker()
|
|
||||||
{
|
|
||||||
return BookmakerSport::with('bookmaker')
|
|
||||||
->whereNotIn('bookmaker_id', $this->having)
|
|
||||||
->where('sport_id', auth()->user()->sport_id)
|
|
||||||
->get();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function loadData($record)
|
public function loadData($record)
|
||||||
{
|
{
|
||||||
$this->has_data = count($record->odds_2ways) ? true : false;
|
$this->has_data = count($record->odds_2ways) ? true : false;
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
namespace App\Livewire;
|
namespace App\Livewire;
|
||||||
|
|
||||||
use App\Filament\Tables\Columns\BookmakerIcon;
|
use App\Filament\Tables\Columns\BookmakerIcon;
|
||||||
use App\Models\Bookmaker;
|
use App\Models\BookmakerSport;
|
||||||
use App\Models\MultilineClient;
|
use App\Models\MultilineClient;
|
||||||
|
use App\Models\MultilineSetting;
|
||||||
use Filament\Actions\Concerns\InteractsWithActions;
|
use Filament\Actions\Concerns\InteractsWithActions;
|
||||||
use Filament\Actions\Contracts\HasActions;
|
use Filament\Actions\Contracts\HasActions;
|
||||||
use Filament\Forms\Components\Radio;
|
use Filament\Forms\Components\Radio;
|
||||||
@@ -17,7 +18,6 @@ use Filament\Tables\Concerns\InteractsWithTable;
|
|||||||
use Filament\Tables\Contracts\HasTable;
|
use Filament\Tables\Contracts\HasTable;
|
||||||
use Filament\Tables\Enums\FiltersLayout;
|
use Filament\Tables\Enums\FiltersLayout;
|
||||||
use Filament\Tables\Filters\Filter;
|
use Filament\Tables\Filters\Filter;
|
||||||
use Filament\Tables\Filters\SelectFilter;
|
|
||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
@@ -29,8 +29,17 @@ class MultilineBookmaker extends Component implements HasActions, HasSchemas, Ha
|
|||||||
use InteractsWithSchemas;
|
use InteractsWithSchemas;
|
||||||
use InteractsWithTable;
|
use InteractsWithTable;
|
||||||
|
|
||||||
|
public static $default_filter;
|
||||||
|
|
||||||
|
public static function load_filter()
|
||||||
|
{
|
||||||
|
self::$default_filter = MultilineSetting::where('sport_id', auth()->user()->sport_id)->orderBy('id')->pluck('id')->first();
|
||||||
|
}
|
||||||
|
|
||||||
public function table(Table $table): Table
|
public function table(Table $table): Table
|
||||||
{
|
{
|
||||||
|
self::load_filter();
|
||||||
|
|
||||||
return $table
|
return $table
|
||||||
->query(MultilineClient::query()->where('sport_id', auth()->user()->sport_id))
|
->query(MultilineClient::query()->where('sport_id', auth()->user()->sport_id))
|
||||||
->paginated(false)
|
->paginated(false)
|
||||||
@@ -43,42 +52,45 @@ class MultilineBookmaker extends Component implements HasActions, HasSchemas, Ha
|
|||||||
}),
|
}),
|
||||||
TextColumn::make('sport.name'),
|
TextColumn::make('sport.name'),
|
||||||
TextColumn::make('multiline_setting.name')->label('Bettype'),
|
TextColumn::make('multiline_setting.name')->label('Bettype'),
|
||||||
BookmakerIcon::make('bookmaker.icon')->label('Icon'),
|
BookmakerIcon::make('bookmaker.icon')->size('xl')->label('Icon'),
|
||||||
SelectColumn::make('bookmaker_id')
|
SelectColumn::make('bookmaker_id')
|
||||||
->label('Bookmaker')
|
->label('Bookmaker')
|
||||||
->width('2rem')
|
->width('2rem')
|
||||||
->options(function () {
|
->options(function () {
|
||||||
$books = Bookmaker::where('is_active', 1)->orderBy('name')->pluck('name', 'id');
|
|
||||||
foreach ($books as $key => $value) {
|
|
||||||
$books[$key] = $key.' - '.$value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $books;
|
$res = BookmakerSport::with('bookmaker')
|
||||||
|
->where('sport_id', auth()->user()->sport_id)
|
||||||
|
->get();
|
||||||
|
$arr = [];
|
||||||
|
foreach ($res as $value) {
|
||||||
|
$arr[$value->bookmaker_id] = $value->bookmaker->name;
|
||||||
|
}
|
||||||
|
asort($arr);
|
||||||
|
|
||||||
|
return $arr;
|
||||||
}),
|
}),
|
||||||
])
|
])
|
||||||
->defaultSort('sort')
|
->defaultSort('sort')
|
||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
->filters([
|
->filters([
|
||||||
Filter::make('created_at')
|
Filter::make('multiline_setting_id')
|
||||||
->schema([
|
->schema([
|
||||||
Radio::make('multiline_setting_id')
|
Radio::make('multiline_setting_id')
|
||||||
->inline()
|
->inline()
|
||||||
->options([
|
->default(self::$default_filter)
|
||||||
'draft' => 'Draft',
|
->columnSpan(6)
|
||||||
'scheduled' => 'Scheduled',
|
->columnSpanFull()
|
||||||
'published' => 'Published',
|
->hiddenLabel()
|
||||||
]),
|
->options(fn () => MultilineSetting::where('sport_id', auth()->user()->sport_id)->orderBy('name')->pluck('name', 'id')),
|
||||||
])
|
])
|
||||||
->query(function (Builder $query, array $data): Builder {
|
->query(function (Builder $query, array $data): Builder {
|
||||||
return $query
|
return $query
|
||||||
->when(
|
->when(
|
||||||
$data['multiline_setting_id'],
|
$data['multiline_setting_id'],
|
||||||
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '<=', $date),
|
fn (Builder $query, $multiline_setting_id): Builder => $query->where('multiline_setting_id', $multiline_setting_id),
|
||||||
);
|
);
|
||||||
}),
|
})
|
||||||
// SelectFilter::make('multiline_setting_id')
|
->columns(6)->columnSpan(6),
|
||||||
// ->label('Bettype')
|
|
||||||
// ->relationship('multiline_setting', 'name'),
|
|
||||||
], layout: FiltersLayout::AboveContent)
|
], layout: FiltersLayout::AboveContent)
|
||||||
->hiddenFilterIndicators();
|
->hiddenFilterIndicators();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<div {{ $getExtraAttributeBag() }} class="h-4 w-16 bg-contain bg-center bg-no-repeat dark:opacity-85"
|
<div {{ $getExtraAttributeBag() }} class="{{ $getSize() }} bg-cover bg-center bg-no-repeat dark:opacity-85"
|
||||||
title="{{ $getState() }}"
|
title="{{ $getState() }}"
|
||||||
style="background-image: url('{{ asset('storage/bookmaker-icons/' . $getState()) }}.png')">
|
style="background-image: url('{{ asset('storage/bookmaker-icons/' . $getState()) }}.png')">
|
||||||
</div>
|
</div>
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
<div class="my-auto">
|
<div class="my-auto">
|
||||||
<x-filament::button icon="heroicon-o-arrows-pointing-out" outlined size="xs" />
|
<x-filament::button icon="phosphor-arrows-out" outlined size="xs" />
|
||||||
</div>
|
</div>
|
||||||
Reference in new issue
Block a user