wip
This commit is contained in:
1 parent
0d6181b393
commit
52a275324e
5 files changed
+79
-77
No files matched your search
@@ -39,7 +39,7 @@ class Grapper
|
||||
/**
|
||||
* daily restart always
|
||||
*/
|
||||
if ($task_id == 1) {
|
||||
if ($task_id == 1 && $restart) {
|
||||
SofaScoreEventGrapped::where('grapper_id', $task_id)->delete();
|
||||
}
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ use Filament\Tables\Contracts\HasTable;
|
||||
use Filament\Tables\Enums\FiltersLayout;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Component;
|
||||
@@ -39,6 +40,7 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
public array $sourceRecords = [];
|
||||
|
||||
public array $filters = [];
|
||||
public int $player_on_field_counter = 0;
|
||||
|
||||
// slider
|
||||
public float $x_value = 3;
|
||||
@@ -52,8 +54,6 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
|
||||
public array $activeBoxes = [2 => 'DR', 4 => 'MR', 6 => 'RW', 9 => 'DC', 10 => 'DM', 11 => 'MC', 12 => 'AM', 15 => 'SW', 16 => 'DC', 17 => 'DM', 18 => 'MC', 19 => 'AM', 20 => 'SM', 21 => 'ST', 23 => 'DC', 24 => 'DM', 25 => 'MC', 26 => 'AM', 30 => 'DL', 32 => 'ML', 34 => 'LM'];
|
||||
|
||||
public bool $copyDisabled = true;
|
||||
|
||||
public bool $calculationDisabled = true;
|
||||
|
||||
public bool $rangeXDisabled = true;
|
||||
@@ -190,11 +190,8 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
$this->beschriftung[$i] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function updateXvalue()
|
||||
{
|
||||
$this->calculationChecker();
|
||||
$this->clearResultTable();
|
||||
}
|
||||
|
||||
public function getHeadingTable(): HtmlString
|
||||
@@ -232,10 +229,6 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
{
|
||||
return $table
|
||||
->headerActions([
|
||||
// FilamentView::registerRenderHook(
|
||||
// PanelsRenderHook::GLOBAL_SEARCH_AFTER,
|
||||
// fn (): View => view('filament.modals.position-abbreviation'),
|
||||
// );
|
||||
Action::make('close')
|
||||
->size(Size::Small)
|
||||
->tooltip('Close application')
|
||||
@@ -258,7 +251,7 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
->size(Size::Small)
|
||||
->tooltip('Remove all players from field')
|
||||
->icon('phosphor-arrows-clockwise')
|
||||
->action(fn() => $this->clearAll()),
|
||||
->action(fn() => $this->clearResultTable()),
|
||||
// Action::make('calculate')
|
||||
// ->hiddenLabel()
|
||||
// ->tooltip('Calculate expected values')
|
||||
@@ -271,7 +264,6 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
->hiddenLabel()
|
||||
->size(Size::Small)
|
||||
->icon('phosphor-copy')
|
||||
->disabled($this->copyDisabled)
|
||||
->action(fn() => $this->copyResult()),
|
||||
])
|
||||
/**
|
||||
@@ -331,6 +323,15 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
return;
|
||||
}
|
||||
|
||||
// when drag from field to field remove from prviouse field to prevent doubles
|
||||
foreach ($this->boxes as $k => $record) {
|
||||
if (count($record) && $record['id'] == (int) $player['id']) {
|
||||
$this->clearBox($k);
|
||||
$this->player_on_field_counter--;
|
||||
}
|
||||
}
|
||||
|
||||
// when drag from source remove from proviuse field
|
||||
foreach ($this->sourceRecords as $k => $record) {
|
||||
if ($record['id'] == (int) $player['id']) {
|
||||
if ($this->boxes[$boxNumber]) {
|
||||
@@ -339,36 +340,17 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
$this->boxes[$boxNumber] = $record;
|
||||
$this->sourceRecords[$k]['active'] = 1;
|
||||
$this->sourceRecords[$k]['position'] = $this->activeBoxes[$boxNumber];
|
||||
|
||||
$this->player_on_field_counter++;
|
||||
}
|
||||
}
|
||||
$this->calculationChecker();
|
||||
}
|
||||
|
||||
public function calculationChecker()
|
||||
{
|
||||
$count = 0;
|
||||
foreach ($this->sourceRecords as $record) {
|
||||
if (count($record)) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if ($count >= 9) {
|
||||
$this->copyDisabled = false;
|
||||
$this->rangeXDisabled = false;
|
||||
|
||||
$this->calculateAspg();
|
||||
} else {
|
||||
$this->copyDisabled = true;
|
||||
$this->rangeXDisabled = true;
|
||||
|
||||
$this->clearAll();
|
||||
}
|
||||
$this->calculateAspg();
|
||||
}
|
||||
|
||||
public function updateLineup(?string $state)
|
||||
{
|
||||
$this->clearAll();
|
||||
$this->calculationChecker();
|
||||
$this->clearResultTable();
|
||||
|
||||
if (isset($this->lineupsMap[$state])) {
|
||||
$this->lineup = $this->lineupsMap[$state];
|
||||
@@ -393,14 +375,23 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
$this->boxes[$boxNumber] = [];
|
||||
$this->sourceRecords[$k]['position'] = '';
|
||||
$this->sourceRecords[$k]['active'] = 0;
|
||||
|
||||
$this->player_on_field_counter--;
|
||||
}
|
||||
}
|
||||
|
||||
$this->calculationChecker();
|
||||
foreach ($this->sourceRecords as $k => $record) {
|
||||
$this->sourceRecords[$k]['gls'] = '';
|
||||
$this->sourceRecords[$k]['fls'] = '';
|
||||
$this->sourceRecords[$k]['ofs'] = '';
|
||||
$this->sourceRecords[$k]['snt'] = '';
|
||||
$this->sourceRecords[$k]['tsh'] = '';
|
||||
$this->sourceRecords[$k]['crd'] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function clearAll(): void
|
||||
public function clearResultTable(): void
|
||||
{
|
||||
for ($i = 1; $i <= 35; $i++) {
|
||||
$this->boxes[$i] = [];
|
||||
@@ -408,19 +399,21 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
foreach ($this->sourceRecords as $k => $record) {
|
||||
$this->sourceRecords[$k]['position'] = '';
|
||||
$this->sourceRecords[$k]['active'] = 0;
|
||||
$this->sourceRecords[$k]['gls'] = 0;
|
||||
$this->sourceRecords[$k]['fls'] = 0;
|
||||
$this->sourceRecords[$k]['ofs'] = 0;
|
||||
$this->sourceRecords[$k]['snt'] = 0;
|
||||
$this->sourceRecords[$k]['tsh'] = 0;
|
||||
$this->sourceRecords[$k]['crd'] = 0;
|
||||
$this->sourceRecords[$k]['gls'] = '';
|
||||
$this->sourceRecords[$k]['fls'] = '';
|
||||
$this->sourceRecords[$k]['ofs'] = '';
|
||||
$this->sourceRecords[$k]['snt'] = '';
|
||||
$this->sourceRecords[$k]['tsh'] = '';
|
||||
$this->sourceRecords[$k]['crd'] = '';
|
||||
}
|
||||
|
||||
$this->calculationChecker();
|
||||
$this->player_on_field_counter = 0;
|
||||
}
|
||||
|
||||
public function copyResult()
|
||||
{
|
||||
if ($this->player_on_field_counter < 10)
|
||||
return;
|
||||
// "id" => 787607
|
||||
// "name" => "Keno"
|
||||
// "preferred_foot" => "Right"
|
||||
@@ -439,7 +432,7 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
// "tsh" => 0
|
||||
// "crd" => 0
|
||||
$header = ['name', 'foot', 'events', 'average min', 'position', 'on field', 'gls', 'fls', 'ofs', 'snt', 'tsh', 'crd'];
|
||||
$copystring = implode("\t", $header) . "\n";;
|
||||
$copystring = implode("\t", $header) . "\n";
|
||||
foreach ($this->sourceRecords as $row) {
|
||||
unset($row['id']);
|
||||
unset($row['player_position']);
|
||||
@@ -453,6 +446,17 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa
|
||||
|
||||
public function calculateAspg(): void
|
||||
{
|
||||
if ($this->player_on_field_counter < 10) {
|
||||
foreach ($this->sourceRecords as $k => $record) {
|
||||
$this->sourceRecords[$k]['gls'] = '';
|
||||
$this->sourceRecords[$k]['fls'] = '';
|
||||
$this->sourceRecords[$k]['ofs'] = '';
|
||||
$this->sourceRecords[$k]['snt'] = '';
|
||||
$this->sourceRecords[$k]['tsh'] = '';
|
||||
$this->sourceRecords[$k]['crd'] = '';
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Calcolare Aspettativa Team per GOALS
|
||||
// (il valore che appare quando viene selezionato un Evento): nell' esempio,
|
||||
// se scegliamo come Team il Remo (Home) il valore di riferimento sarà 1.2
|
||||
|
||||
@@ -38,7 +38,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
/** Alpine Plugin direct */
|
||||
FilamentView::registerRenderHook(
|
||||
'panels::head.end',
|
||||
fn (): HtmlString => new HtmlString('
|
||||
fn(): HtmlString => new HtmlString('
|
||||
<script>
|
||||
document.addEventListener("alpine:init", () => {
|
||||
(function(){function l(t){t.directive("sort",(e,{modifiers:d,expression:c},{evaluateLater:p,cleanup:f})=>{let m=p(c),v=d.includes("group")?e.getAttribute("x-sort:group"):"default";e._sortable=new Sortable(e,{group:v,animation:150,onEnd:s=>{let n=s.item.getAttribute("x-sort:item"),a=s.oldIndex,i=s.newIndex,r=s.to.getAttribute("id")||"default";m(()=>{},{scope:{$item:n,$oldIndex:a,$newIndex:i,$owner:r}})}});f(()=>e._sortable.destroy())})}l.inline=l;var u=l;document.addEventListener("DOMContentLoaded",()=>{if(typeof Sortable==="undefined"){let t=document.createElement("script");t.src="https://cloudflare.com";document.head.appendChild(t)}});})();
|
||||
@@ -48,17 +48,17 @@ class AppServiceProvider extends ServiceProvider
|
||||
);
|
||||
|
||||
FilamentAsset::register([
|
||||
Css::make('font-stylesheet', __DIR__.'/../../resources/css/font.css'),
|
||||
Js::make('number-animator', __DIR__.'/../../resources/js/number-animator.js'),
|
||||
Css::make('font-stylesheet', __DIR__ . '/../../resources/css/font.css'),
|
||||
Js::make('number-animator', __DIR__ . '/../../resources/js/number-animator.js'),
|
||||
]);
|
||||
|
||||
FilamentView::registerRenderHook(
|
||||
PanelsRenderHook::USER_MENU_PROFILE_AFTER,
|
||||
fn (): string => Blade::render('@livewire(\'konto-switcher\')'),
|
||||
fn(): string => Blade::render('@livewire(\'konto-switcher\')'),
|
||||
);
|
||||
FilamentView::registerRenderHook(
|
||||
TablesRenderHook::TOOLBAR_SEARCH_BEFORE,
|
||||
fn (): string => Blade::render('@livewire(\'sport-switcher\')'),
|
||||
fn(): string => Blade::render('@livewire(\'sport-switcher\')'),
|
||||
scopes: [
|
||||
ListEvents::class,
|
||||
]
|
||||
@@ -66,14 +66,14 @@ class AppServiceProvider extends ServiceProvider
|
||||
// PanelsRenderHook::RESOURCE_PAGES_LIST_RECORDS_TABLE_BEFORE,
|
||||
FilamentView::registerRenderHook(
|
||||
TablesRenderHook::TOOLBAR_SEARCH_AFTER,
|
||||
fn (): string => Blade::render('@livewire(\'bettype-toggle\')'),
|
||||
fn(): string => Blade::render('@livewire(\'bettype-toggle\')'),
|
||||
scopes: [
|
||||
ListEvents::class,
|
||||
]
|
||||
);
|
||||
FilamentView::registerRenderHook(
|
||||
PanelsRenderHook::GLOBAL_SEARCH_BEFORE,
|
||||
fn (): string => Blade::render('@livewire(\'top-menu-items\')')
|
||||
fn(): string => Blade::render('@livewire(\'top-menu-items\')')
|
||||
);
|
||||
|
||||
// FilamentView::registerRenderHook(
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
@endphp
|
||||
@if ($record['active'])
|
||||
<div draggable="false"
|
||||
class="w-140 max-w-140 border dark:border-gray-600 border-gray-200 text-xs my-0.5 py-1 select-none rounded transition-colors flex justify-end content-center items-center gap-1">
|
||||
class="bgFade w-140 max-w-140 border dark:border-gray-600 border-gray-200 text-xs my-0.5 py-1 select-none rounded transition-colors flex justify-end content-center items-center gap-1">
|
||||
<div class="w-86 text-[11px] min-w-86 text-center grid grid-cols-10 content-center items-center gap-1">
|
||||
<div>{{ $record['gls'] }}</div>
|
||||
<div>{{ $record['fls'] }}</div>
|
||||
|
||||
@@ -4,26 +4,22 @@
|
||||
</div>
|
||||
<div class="fixed left-147 top-5 right-0 bottom-0 h-screen max-w-4xl">
|
||||
<div>
|
||||
<div class="font-black text-2xl text-center">{{ $ss_team_name }}</div>
|
||||
<div class="font-black text-2xl text-center">{{ $ss_team_name }} {{ $player_on_field_counter }}</div>
|
||||
<div class="grid grid-cols-2">
|
||||
<div class="m-4">{{ $this->form }}</div>
|
||||
<div class="w-full max-w-md mx-auto p-4" x-data="{ x_value: {{ $x_value }} }">
|
||||
<div class="flex justify-between items-center mb-2">
|
||||
<label for="volume-slider" class="text-sm font-medium text-gray-700 dark:text-gray-300">
|
||||
<label class="text-sm font-medium text-gray-700 dark:text-gray-200">
|
||||
Factor X
|
||||
</label>
|
||||
<!-- Zeigt den Wert live an -->
|
||||
<span class="text-sm font-semibold text-gray-900 dark:text-white bg-gray-100 dark:bg-gray-800 px-2 py-0.5 rounded" x-text="x_value"></span>
|
||||
<span
|
||||
class="text-sm font-semibold text-gray-900 dark:text-white bg-gray-100 dark:bg-gray-800 px-2 py-0.5 rounded"
|
||||
x-text="x_value"></span>
|
||||
</div>
|
||||
<input
|
||||
type="range"
|
||||
wire:model.live="x_value"
|
||||
wire:change="updateXvalue"
|
||||
@disabled($rangeXDisabled)
|
||||
min="0"
|
||||
max="10"
|
||||
class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-primary-600"
|
||||
>
|
||||
<input type="range" wire:model.live="x_value" wire:change="calculateAspg" min="0"
|
||||
max="10"
|
||||
class="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer accent-primary-600">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -31,9 +27,9 @@
|
||||
style="background-image: url({{ asset('images/soccerfield-cleand.jpg') }});">
|
||||
@foreach ($beschriftung as $boxNumber => $benennung)
|
||||
@if ($benennung)
|
||||
@if(in_array($boxNumber, $lineup))
|
||||
<div x-data="{ isOver: false }" @dragover.prevent="isOver = true" @dragenter.prevent="isOver = true"
|
||||
@dragleave.prevent="isOver = false"
|
||||
@if (in_array($boxNumber, $lineup))
|
||||
<div x-data="{ isOver: false }" @dragover.prevent="isOver = true"
|
||||
@dragenter.prevent="isOver = true" @dragleave.prevent="isOver = false"
|
||||
@drop.prevent="
|
||||
isOver = false;
|
||||
const rawData = $event.dataTransfer.getData('text/plain');
|
||||
@@ -43,14 +39,11 @@
|
||||
}
|
||||
"
|
||||
:class="isOver ? 'border-red-500 bg-white/20 ring-2 ring-red-500/50 scale-[1.02]' :
|
||||
@if (in_array($benennung, ['SW', 'DR', 'DC', 'DL']))
|
||||
'border-gray-800 bg-green-500/30'
|
||||
@if (in_array($benennung, ['SW', 'DR', 'DC', 'DL'])) 'border-gray-800 bg-green-500/30'
|
||||
@elseif (in_array($benennung, ['DM', 'MR', 'MC', 'ML', 'AM']))
|
||||
'border-gray-800 bg-blue-500/30'
|
||||
@else
|
||||
'border-gray-800 bg-amber-500/30'
|
||||
@endif
|
||||
"
|
||||
'border-gray-800 bg-amber-500/30' @endif"
|
||||
class="border rounded-xl transition-all pt-0 flex flex-col justify-start transform">
|
||||
<!-- Box Header -->
|
||||
<div class="grid grid-cols-6 items-center">
|
||||
@@ -68,14 +61,19 @@
|
||||
|
||||
<!-- Box Inhalt -->
|
||||
@if ($boxes[$boxNumber])
|
||||
<div class=" bg-black text-white p-0.5 2xl:p-1 m-0.5 rounded leading-4 2xl:leading-5 text-ms">
|
||||
<div draggable="true"
|
||||
x-on:dragstart="e => {
|
||||
e.dataTransfer.effectAllowed = 'copy';
|
||||
e.dataTransfer.setData('text/plain', JSON.stringify({ id: {{ $boxes[$boxNumber]['id'] }} }));
|
||||
}"
|
||||
class="cursor-grab active:cursor-grabbing bg-black text-white p-0.5 2xl:p-1 m-0.5 rounded leading-4 2xl:leading-5 text-ms">
|
||||
{{ $boxes[$boxNumber]['name'] }}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@else
|
||||
<div x-data="{ isOver: false }" @dragover.prevent="isOver = true" @dragenter.prevent="isOver = true"
|
||||
@dragleave.prevent="isOver = false"
|
||||
<div x-data="{ isOver: false }" @dragover.prevent="isOver = true"
|
||||
@dragenter.prevent="isOver = true" @dragleave.prevent="isOver = false"
|
||||
@drop.prevent="
|
||||
isOver = false;
|
||||
const rawData = $event.dataTransfer.getData('text/plain');
|
||||
|
||||
Reference in new issue
Block a user