useract wip
This commit is contained in:
1 parent
10b0d334ab
commit
7e9d841856
19 files changed
+194
-51
No files matched your search
@@ -15,7 +15,7 @@ class ClientResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Client::class;
|
||||
|
||||
protected static ?int $navigationSort = 32;
|
||||
protected static ?int $navigationSort = 33;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'phosphor-baseball-helmet';
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\UserActivities\Pages;
|
||||
|
||||
use App\Filament\Resources\UserActivities\UserActivityResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateUserActivity extends CreateRecord
|
||||
{
|
||||
protected static string $resource = UserActivityResource::class;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\UserActivities\Pages;
|
||||
|
||||
use App\Filament\Resources\UserActivities\UserActivityResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditUserActivity extends EditRecord
|
||||
{
|
||||
protected static string $resource = UserActivityResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\UserActivities\Pages;
|
||||
|
||||
use App\Filament\Resources\UserActivities\UserActivityResource;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListUserActivities extends ListRecords
|
||||
{
|
||||
protected static string $resource = UserActivityResource::class;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\UserActivities\Schemas;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class UserActivityForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\UserActivities\Tables;
|
||||
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class UserActivitiesTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('user.name'),
|
||||
TextColumn::make('ip'),
|
||||
TextColumn::make('country'),
|
||||
TextColumn::make('location'),
|
||||
TextColumn::make('created_at')->dateTime('M j, Y H:i'),
|
||||
])
|
||||
->defaultSort('created_at', 'desc')
|
||||
->filters([
|
||||
//
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\UserActivities;
|
||||
|
||||
use App\Filament\Clusters\Administrator\AdministratorCluster;
|
||||
use App\Filament\Resources\UserActivities\Pages\ListUserActivities;
|
||||
use App\Filament\Resources\UserActivities\Schemas\UserActivityForm;
|
||||
use App\Filament\Resources\UserActivities\Tables\UserActivitiesTable;
|
||||
use App\Models\UserActivity;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class UserActivityResource extends Resource
|
||||
{
|
||||
protected static ?string $model = UserActivity::class;
|
||||
|
||||
protected static ?string $cluster = AdministratorCluster::class;
|
||||
|
||||
protected static ?int $navigationSort = 32;
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'User';
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return UserActivityForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return UserActivitiesTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListUserActivities::route('/'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getNavigationBadge(): ?string
|
||||
{
|
||||
return parent::getEloquentQuery()->count();
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@ class ColumnOdds extends Column
|
||||
|
||||
public $slots;
|
||||
|
||||
public $empty_slots_icons;
|
||||
|
||||
public $bookmaker;
|
||||
|
||||
protected $max;
|
||||
@@ -40,8 +42,6 @@ class ColumnOdds extends Column
|
||||
|
||||
public $partner;
|
||||
|
||||
public $partner_icon;
|
||||
|
||||
protected ?array $odds_labels;
|
||||
|
||||
protected bool $state = true;
|
||||
@@ -68,8 +68,6 @@ class ColumnOdds extends Column
|
||||
return;
|
||||
}
|
||||
|
||||
$this->setPartnerIcon();
|
||||
|
||||
$this->setSlots();
|
||||
|
||||
$this->has_data = count($this->data);
|
||||
@@ -131,11 +129,6 @@ class ColumnOdds extends Column
|
||||
return $this->columns;
|
||||
}
|
||||
|
||||
public function getPartnerBookmakerIcon()
|
||||
{
|
||||
return $this->partner_icon;
|
||||
}
|
||||
|
||||
public function getSlots()
|
||||
{
|
||||
if (auth()->user()->is_multiline_direct) {
|
||||
@@ -465,6 +458,11 @@ class ColumnOdds extends Column
|
||||
});
|
||||
}
|
||||
|
||||
public function getBookmakerIcon($bookmaker_id)
|
||||
{
|
||||
return $this->empty_slots_icons[$bookmaker_id];
|
||||
}
|
||||
|
||||
public function setPartnerIcon()
|
||||
{
|
||||
$this->partner_icon = Bookmaker::where('id', auth()->user()->partner_bookmaker_id)->value('icon');
|
||||
@@ -474,6 +472,8 @@ class ColumnOdds extends Column
|
||||
{
|
||||
$this->slots = EventsTable::$slots[$this->bettype];
|
||||
|
||||
$this->empty_slots_icons = Bookmaker::pluck('icon', 'id')->all();
|
||||
|
||||
$this->bookmaker = EventsTable::$bookmaker[$this->bettype];
|
||||
|
||||
$this->filter = EventsTable::$filter[$this->bettype];
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Edwink\FilamentUserActivity\Http\Middleware;
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Models\UserActivity;
|
||||
use Closure;
|
||||
@@ -21,18 +21,20 @@ class RecordUserActivity
|
||||
$response = $next($request);
|
||||
|
||||
$whoIsIp = request()->ip();
|
||||
$whoIsIp = '178.165.190.98';
|
||||
$position = Location::get($whoIsIp);
|
||||
$session_id = session()->getId();
|
||||
|
||||
dd($position);
|
||||
|
||||
// dd($position);
|
||||
// Perform action
|
||||
if (Auth::id() !== null) {
|
||||
UserActivity::create([
|
||||
'url' => config('app.url').'/'.$request->path(),
|
||||
'user_id' => Auth::id(),
|
||||
'session_id' => $session_id,
|
||||
'ip' => $whoIsIp,
|
||||
'country' => $position->countryName,
|
||||
'location' => $position->countryName,
|
||||
'location' => $position->cityName,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,10 +7,20 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class UserActivity extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'user_id', 'url',
|
||||
'user_id',
|
||||
'url',
|
||||
'session_id',
|
||||
'ip',
|
||||
'country',
|
||||
'location',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'created_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use Agencetwogether\HooksHelper\HooksHelperPlugin;
|
||||
use App\Http\Middleware\RecordUserActivity;
|
||||
use Awcodes\LightSwitch\Enums\Alignment;
|
||||
use Awcodes\LightSwitch\LightSwitchPlugin;
|
||||
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
||||
@@ -38,6 +39,9 @@ class AdminPanelProvider extends PanelProvider
|
||||
{
|
||||
return $panel
|
||||
->id('admin')
|
||||
->middleware([
|
||||
RecordUserActivity::class,
|
||||
])
|
||||
->path('')
|
||||
->login()
|
||||
->passwordReset(RequestPasswordReset::class)
|
||||
|
||||
@@ -15,6 +15,7 @@ return new class extends Migration
|
||||
$table->id();
|
||||
|
||||
$table->unsignedInteger('user_id')->nullable();
|
||||
$table->string('session_id');
|
||||
$table->string('url');
|
||||
$table->string('ip');
|
||||
$table->string('country');
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
@source '../../../../vendor/guava/filament-modal-relation-managers/resources/**/*';
|
||||
@source '../../../../vendor/jaocero/radio-deck/resources/views';
|
||||
|
||||
.fi-ta-header-toolbar,
|
||||
.fi-ta-filters-above-content-ctn {
|
||||
@apply pt-0
|
||||
}
|
||||
|
||||
/* Reduce gap between widgets and content */
|
||||
.fi-page-content {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<div
|
||||
class="text-primary-600 dark:text-primary-500 font-bold">
|
||||
class="text-gray-400 bg-gray-50 border border-gray-300 dark:text-primary-500 dark:!border-gray-800 dark:bg-gray-900 rounded">
|
||||
|
||||
{{ $slot }}
|
||||
</div>
|
||||
@@ -1,5 +1,5 @@
|
||||
<div
|
||||
class="grid grid-cols-4 text-xs gap-1 p-1 border rounded border-zinc-200 dark:border-zinc-800 bg-gray-100 dark:bg-gray-900 text-center shadow">
|
||||
class="grid grid-cols-4 text-xs gap-1 p-1 text-gray-400 dark:text-primary-500 border rounded border-gray-200 dark:border-gray-800 bg-gray-100 dark:bg-gray-900 text-center shadow">
|
||||
<div class="text-nowrap">{{ $title }}</div>
|
||||
|
||||
@if ($red)
|
||||
|
||||
@@ -14,19 +14,19 @@
|
||||
@if ($getColumns() == 2)
|
||||
<div {{ $getExtraAttributeBag() }} class="grid grid-cols-4 gap-1 text-xs text-center w-60 mr-3 p-1">
|
||||
@else
|
||||
<div {{ $getExtraAttributeBag() }} class="grid grid-cols-5 gap-1 text-xs text-center w-76 mr-3 p-1">
|
||||
<div {{ $getExtraAttributeBag() }} class="grid grid-cols-5 gap-1 text-xs text-center w-76 mr-3 p-1">
|
||||
@endif
|
||||
@include('filament.tables.columns.multiline.label', ['labels' => $label])
|
||||
@include('filament.tables.columns.multiline.label', ['labels' => $label])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($getColumns() == 2)
|
||||
<div {{ $getExtraAttributeBag() }} class="grid grid-cols-4 gap-1 text-xs text-center w-60 mr-2 mb-1 bg-blue-50 dark:bg-gray-950 p-1">
|
||||
<div {{ $getExtraAttributeBag() }} class="grid grid-cols-4 gap-1 text-xs text-center w-60 mr-2 mb-2">
|
||||
@else
|
||||
<div {{ $getExtraAttributeBag() }} class="grid grid-cols-5 gap-1 text-xs text-center w-76 mr-2 mb-1 bg-blue-50 dark:bg-gray-950 p-1">
|
||||
<div {{ $getExtraAttributeBag() }} class="grid grid-cols-5 gap-1 text-xs text-center w-76 mr-1 mb-2">
|
||||
@endif
|
||||
|
||||
@if(auth()->user()->partner_show == 1)
|
||||
|
||||
@if (auth()->user()->partner_show == 1)
|
||||
@include('filament.tables.columns.multiline.multiline-client-partner')
|
||||
@include('filament.tables.columns.multiline.multiline-partner')
|
||||
@else
|
||||
@@ -34,15 +34,15 @@
|
||||
@include('filament.tables.columns.multiline.multiline-compare')
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($getColumns() == 2)
|
||||
<div {{ $getExtraAttributeBag() }} class="grid grid-cols-4 gap-1 text-xs text-center w-60 mr-3 p-1 mb-5">
|
||||
@else
|
||||
<div {{ $getExtraAttributeBag() }} class="grid grid-cols-5 gap-1 text-xs text-center w-76 mr-3 p-1 mb-5">
|
||||
@else
|
||||
<div {{ $getExtraAttributeBag() }} class="grid grid-cols-5 gap-1 text-xs text-center w-76 mr-3 p-1 mb-5">
|
||||
@endif
|
||||
|
||||
@if (auth()->user()->is_multiline_direct)
|
||||
|
||||
+2
-2
@@ -233,10 +233,10 @@
|
||||
'd' => 1,
|
||||
])
|
||||
@else
|
||||
{{-- @include('filament.tables.columns.multiline.bkm', [
|
||||
@include('filament.tables.columns.multiline.bkm', [
|
||||
'bookmaker_id' => auth()->user()->bookmaker_id,
|
||||
'icon' => auth()->user()->bookmaker->icon ?? '',
|
||||
]) --}}
|
||||
])
|
||||
<div> </div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
|
||||
@@ -233,10 +233,10 @@
|
||||
'd' => 1,
|
||||
])
|
||||
@else
|
||||
{{-- @include('filament.tables.columns.multiline.bkm', [
|
||||
'bookmaker_id' => auth()->user()->bookmaker_id,
|
||||
'icon' => auth()->user()->bookmaker->icon ?? '',
|
||||
]) --}}
|
||||
@include('filament.tables.columns.multiline.bkm', [
|
||||
'bookmaker_id' => auth()->user()->partner_bookmaker_id,
|
||||
'icon' => $getBookmakerIcon(auth()->user()->partner_bookmaker_id),
|
||||
])
|
||||
<div> </div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
|
||||
|
||||
@foreach ($slots as $slot)
|
||||
|
||||
@php
|
||||
$taken = false;
|
||||
$compare_bookmaker_id = $getCompareBookmaker();
|
||||
@@ -9,14 +6,13 @@
|
||||
@endphp
|
||||
|
||||
@foreach ($multilines as $multiline)
|
||||
|
||||
@if ($multiline->bookmaker_id == $slot)
|
||||
@php
|
||||
$taken = true;
|
||||
$favorit = 0;
|
||||
$compared = $compare_bookmaker_id == $multiline->bookmaker_id ? 1 :0;
|
||||
if($compared){
|
||||
$favorit = min($client?->h3w,$client?->d3w,$client?->a3w);
|
||||
$compared = $compare_bookmaker_id == $multiline->bookmaker_id ? 1 : 0;
|
||||
if ($compared) {
|
||||
$favorit = min($client?->h3w, $client?->d3w, $client?->a3w);
|
||||
}
|
||||
@endphp
|
||||
|
||||
@@ -26,7 +22,6 @@
|
||||
])
|
||||
|
||||
@switch ($getBettype())
|
||||
|
||||
@case ('odds_2ways')
|
||||
@include('filament.tables.columns.multiline.odd-slots', [
|
||||
'odd' => $multiline->h2w,
|
||||
@@ -43,7 +38,6 @@
|
||||
'd' => 2,
|
||||
])
|
||||
@break;
|
||||
|
||||
@case ('odds_tq')
|
||||
@include('filament.tables.columns.multiline.odd', [
|
||||
'odd' => $multiline->htq,
|
||||
@@ -56,7 +50,6 @@
|
||||
'd' => 2,
|
||||
])
|
||||
@break;
|
||||
|
||||
@case ('odds_2ways_s1')
|
||||
@include('filament.tables.columns.multiline.odd', [
|
||||
'odd' => $multiline->h2w,
|
||||
@@ -69,7 +62,6 @@
|
||||
'd' => 2,
|
||||
])
|
||||
@break;
|
||||
|
||||
@case ('odds_3ways')
|
||||
@include('filament.tables.columns.multiline.odd-slots', [
|
||||
'odd' => $multiline?->h3w,
|
||||
@@ -93,7 +85,6 @@
|
||||
'd' => 2,
|
||||
])
|
||||
@break;
|
||||
|
||||
@case ('odds_3ways_ht')
|
||||
@include('filament.tables.columns.multiline.odd', [
|
||||
'odd' => $multiline->h3w,
|
||||
@@ -173,7 +164,6 @@
|
||||
'd' => 1,
|
||||
])
|
||||
@break;
|
||||
|
||||
@case ('odds_points_ht')
|
||||
|
||||
@case ('odds_points_q1')
|
||||
@@ -193,7 +183,6 @@
|
||||
'd' => 1,
|
||||
])
|
||||
@break;
|
||||
|
||||
@case ('odds_totals')
|
||||
|
||||
@case ('odds_totals_ht')
|
||||
@@ -227,15 +216,16 @@
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@if(!$taken)
|
||||
<div> </div>
|
||||
@if (!$taken)
|
||||
@include('filament.tables.columns.multiline.bkm', [
|
||||
'bookmaker_id' => $slot,
|
||||
'icon' => $getBookmakerIcon($slot),
|
||||
])
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
@if ($getColumns() == 3)
|
||||
<div></div>
|
||||
<div></div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
|
||||
@endforeach
|
||||
Reference in new issue
Block a user