wip
This commit is contained in:
1 parent
217636b564
commit
3ec2c18fed
7 files changed
+142
-29
No files matched your search
@@ -8,9 +8,14 @@ use Livewire\Component;
|
||||
class BoardDispatcher extends Component
|
||||
{
|
||||
public array $lists = [];
|
||||
public array $results = [];
|
||||
public array $destLabels = ['DR', 'MR', 'RW', 'DC', 'DM', 'MC', 'AM', 'SW', 'DC', 'DM', 'MC', 'AM', 'SM', 'ST', 'DC', 'DM', 'MC', 'AM', 'DL', 'ML', 'LM'];
|
||||
|
||||
public string $boardVersion = '';
|
||||
public bool $calculationDisabled = true;
|
||||
public bool $copyDisabled = true;
|
||||
public string $calculationColor = 'gray';
|
||||
public string $copyColor = 'gray';
|
||||
|
||||
|
||||
public function mount(array $filters)
|
||||
{
|
||||
@@ -28,6 +33,65 @@ class BoardDispatcher extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function setCalculationButton()
|
||||
{
|
||||
$count = 1;
|
||||
for ($i = 1; $i <= 35; $i++) {
|
||||
$bayKey = "dest-{$i}";
|
||||
|
||||
if (isset($this->lists[$bayKey]) && ! empty($this->lists[$bayKey])) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
if ($count > 2) {
|
||||
$this->calculationDisabled = false;
|
||||
$this->calculationColor = 'info';
|
||||
} else {
|
||||
$this->calculationDisabled = true;
|
||||
$this->calculationColor = 'gray';
|
||||
}
|
||||
}
|
||||
|
||||
public function setCopyButton()
|
||||
{
|
||||
if (\count($this->results) > 0) {
|
||||
$this->copyDisabled = false;
|
||||
$this->copyColor = 'info';
|
||||
} else {
|
||||
$this->copyDisabled = true;
|
||||
$this->copyColor = 'gray';
|
||||
}
|
||||
}
|
||||
|
||||
public function calculate()
|
||||
{
|
||||
$this->results = [];
|
||||
for ($i = 1; $i <= 35; $i++) {
|
||||
$bayKey = "dest-{$i}";
|
||||
|
||||
if (isset($this->lists[$bayKey]) && ! empty($this->lists[$bayKey])) {
|
||||
$this->results[] = $this->lists[$bayKey][0];
|
||||
}
|
||||
}
|
||||
|
||||
$this->setCopyButton();
|
||||
}
|
||||
|
||||
public function copy()
|
||||
{
|
||||
$str = '<table>';
|
||||
foreach ($this->results as $k => $result) {
|
||||
$str .= '<tr>';
|
||||
$str .= '<td>' . $result['name'] . '</td>';
|
||||
$str .= '<td>' . $result['position'] . '</td>';
|
||||
$str .= '<td>' . number_format(mt_rand(1, 100) / 100, 2) . '</td>';
|
||||
$str .= '</tr>';
|
||||
}
|
||||
$str .= '</table>';
|
||||
$this->js("navigator.clipboard.writeText('{$str}')");
|
||||
}
|
||||
|
||||
|
||||
public function moveItem($itemId, $fromList, $toList, $newIndex)
|
||||
{
|
||||
$itemId = (string) $itemId;
|
||||
@@ -50,6 +114,7 @@ class BoardDispatcher extends Component
|
||||
|
||||
foreach ($this->lists[$fromList] as $key => $item) {
|
||||
if ((string) $item['id'] === $itemId) {
|
||||
$item['position'] = $this->positions($toList);
|
||||
$foundItem = $item;
|
||||
unset($this->lists[$fromList][$key]);
|
||||
$this->lists[$fromList] = array_values($this->lists[$fromList]);
|
||||
@@ -61,9 +126,21 @@ class BoardDispatcher extends Component
|
||||
array_splice($this->lists[$toList], $newIndex, 0, [$foundItem]);
|
||||
}
|
||||
|
||||
$this->setCalculationButton();
|
||||
|
||||
$this->boardVersion = uniqid();
|
||||
}
|
||||
|
||||
public function positions(string $pos)
|
||||
{
|
||||
$pos = (int) str_replace('dest-', '', $pos);
|
||||
$options = [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'];
|
||||
if (isset($options[$pos]))
|
||||
return $options[$pos];
|
||||
else
|
||||
return $pos;
|
||||
}
|
||||
|
||||
public function returnToOrigin($itemId, $currentListId)
|
||||
{
|
||||
$itemId = (string) $itemId;
|
||||
@@ -102,6 +179,8 @@ class BoardDispatcher extends Component
|
||||
// }
|
||||
}
|
||||
|
||||
$this->setCalculationButton();
|
||||
|
||||
$this->boardVersion = uniqid();
|
||||
}
|
||||
|
||||
@@ -133,6 +212,12 @@ class BoardDispatcher extends Component
|
||||
|
||||
// Falls Sie die Javascript-Event/ignore-Logik nutzen, feuern wir das Refresh-Event:
|
||||
$this->dispatch('refreshBoard', lists: $this->lists);
|
||||
|
||||
$this->results = [];
|
||||
|
||||
$this->setCalculationButton();
|
||||
|
||||
$this->setCopyButton();
|
||||
}
|
||||
|
||||
public function render()
|
||||
|
||||
@@ -106,6 +106,9 @@ class PlayerCalculator extends Component
|
||||
|
||||
$name = $val['player_name'];
|
||||
$preferred_foot = $val['preferred_foot'] ?? '-';
|
||||
$everage_minutes = 0;
|
||||
$ecolor = '';
|
||||
if ($events_played) {
|
||||
$everage_minutes = round($minues_played / $events_played) . ' min';
|
||||
if ($colorlevel > 1 && $events_played < $colorlevel) {
|
||||
$ecolor = 'danger';
|
||||
@@ -114,6 +117,7 @@ class PlayerCalculator extends Component
|
||||
} else {
|
||||
$ecolor = 'success';
|
||||
}
|
||||
}
|
||||
|
||||
$result[$origin][] = [
|
||||
'id' => $player_id,
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 55 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.2 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg width="100%" height="100%" fill="currentColor" viewBox="0 0 294 140" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
|
||||
<g transform="matrix(1,0,0,1,-445.556641,-425.585938)">
|
||||
<g transform="matrix(1.265421,0,0,1.265421,-118.11215,-108.82243)">
|
||||
<path d="M468.9,450.03C469.438,444.702 470.88,440.254 473.226,436.686C475.572,433.118 478.48,430.271 481.95,428.145C485.421,426.019 489.282,424.516 493.534,423.636C497.786,422.757 502.087,422.317 506.437,422.317C510.005,422.317 513.5,422.463 516.921,422.757C520.343,423.05 523.495,423.392 526.379,423.783C529.263,424.174 531.755,424.565 533.857,424.956C535.959,425.347 537.498,425.64 538.476,425.836C539.062,425.983 539.356,426.251 539.356,426.642C539.356,426.74 539.307,427.033 539.209,427.522L538.109,432.801C538.011,433.143 537.877,433.351 537.706,433.424C537.535,433.497 537.376,433.534 537.229,433.534C535.079,433.534 533.222,433.9 531.658,434.634C530.093,435.367 528.798,436.393 527.772,437.713C526.745,439.032 525.963,440.597 525.426,442.405C524.888,444.213 524.522,446.168 524.326,448.27L519.927,501.57C519.536,505.871 518.437,509.927 516.628,513.74C514.82,517.552 512.303,520.876 509.077,523.71C505.851,526.545 501.892,528.794 497.2,530.455C492.508,532.117 487.131,532.948 481.071,532.948C477.014,532.948 473.104,532.753 469.34,532.362C465.577,531.971 462.156,531.506 459.076,530.969C455.997,530.431 453.346,529.906 451.122,529.392C448.898,528.879 447.297,528.5 446.32,528.256C445.733,528.109 445.44,527.841 445.44,527.45C445.44,527.401 445.489,527.132 445.587,526.643L446.833,521.071C446.931,520.729 447.065,520.521 447.236,520.448C447.407,520.375 447.566,520.338 447.713,520.338C449.863,520.338 451.855,520.02 453.688,519.385C455.521,518.75 457.121,517.699 458.49,516.232C459.858,514.766 460.995,512.86 461.899,510.514C462.803,508.168 463.426,505.284 463.768,501.863L468.9,450.03Z" style="fill-rule:nonzero;"/>
|
||||
<path d="M651.526,476.643L663.403,430.821C663.599,429.941 663.794,429.135 663.99,428.402C664.185,427.669 664.43,427.033 664.723,426.496C665.016,425.958 665.407,425.543 665.896,425.249C666.385,424.956 667.045,424.809 667.876,424.809L675.134,424.809C676.893,424.809 677.773,425.445 677.773,426.716C677.773,427.644 677.529,428.866 677.04,430.381L647.934,523.197C647.25,525.494 646.346,527.217 645.221,528.366C644.097,529.515 642.655,530.089 640.896,530.089L630.485,530.089C629.41,530.089 628.494,529.869 627.736,529.429C626.978,528.989 626.343,528.439 625.83,527.779C625.317,527.12 624.889,526.399 624.547,525.617C624.205,524.835 623.936,524.077 623.74,523.344L610.47,480.162L598.374,523.197C597.738,525.494 596.895,527.217 595.844,528.366C594.793,529.515 593.413,530.089 591.702,530.089L579.458,530.089C578.334,530.089 577.406,529.869 576.673,529.429C575.939,528.989 575.316,528.439 574.803,527.779C574.29,527.12 573.874,526.386 573.557,525.58C573.239,524.774 572.958,524.028 572.714,523.344L540.529,433.387C540.04,432.116 539.795,430.919 539.795,429.795C539.795,428.084 540.284,426.826 541.262,426.019C542.239,425.213 543.437,424.809 544.854,424.809L575.866,424.809C577.088,424.809 578.139,424.968 579.019,425.286C579.898,425.604 580.631,425.983 581.218,426.422C581.805,426.862 582.244,427.339 582.538,427.852C582.831,428.365 583.051,428.817 583.197,429.208L598.813,476.643L603.652,458.094L596.101,433.387C595.856,432.703 595.673,432.043 595.551,431.408C595.429,430.772 595.368,430.186 595.368,429.648C595.368,427.938 595.832,426.703 596.761,425.946C597.689,425.188 598.862,424.809 600.28,424.809L631.365,424.809C632.587,424.809 633.626,424.907 634.481,425.103C635.336,425.298 636.033,425.579 636.57,425.946C637.108,426.312 637.548,426.777 637.89,427.339C638.232,427.901 638.525,428.524 638.77,429.208L651.526,476.643Z" style="fill-rule:nonzero;"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.0 KiB |
@@ -8,13 +8,11 @@
|
||||
@if (str_starts_with($listId, 'source-'))
|
||||
<x-filament::tabs.item :alpine-active="'activeTab === \'' . $listId . '\''" x-on:click="activeTab = '{{ $listId }}'"
|
||||
wire:key="tab-button-{{ $listId }}" class="cursor-pointer">
|
||||
<div class="flex items-center space-x-1.5 leading-none">
|
||||
<span class="uppercase">{{ str_replace('source-', '', $listId) }}</span>
|
||||
<span
|
||||
class="inline-flex items-center justify-center px-1 py-0.5 text-[10px] font-mono font-bold bg-primary-500/10 text-primary-600 dark:text-primary-400 rounded-md">
|
||||
|
||||
<x-filament::badge size="xs">
|
||||
{{ count($items) }}
|
||||
</span>
|
||||
</div>
|
||||
</x-filament::badge>
|
||||
</x-filament::tabs.item>
|
||||
@endif
|
||||
@endforeach
|
||||
@@ -25,11 +23,11 @@
|
||||
|
||||
<!-- Copy-Button -->
|
||||
<x-filament::button icon="heroicon-o-clipboard-document-list" size="md" tooltip="Copy"
|
||||
x-on:click="$wire.resetBoard()" class="cursor-pointer" />
|
||||
:disabled="$copyDisabled" class="cursor-pointer" color="{{ $copyColor }}" x-on:click="$wire.copy()" />
|
||||
|
||||
<!-- Calculate-Button -->
|
||||
<x-filament::button icon="heroicon-o-calculator" size="md" tooltip="Calculate"
|
||||
x-on:click="$wire.resetBoard()" class="cursor-pointer" />
|
||||
<x-filament::button icon="heroicon-o-calculator" size="md" tooltip="Calculate" :disabled="$calculationDisabled"
|
||||
x-on:click="$wire.calculate()" class="cursor-pointer" color="{{ $calculationColor }}" />
|
||||
|
||||
<!-- Reset-Button -->
|
||||
<x-filament::button icon="heroicon-o-arrow-path" size="md" tooltip="Reset"
|
||||
@@ -67,39 +65,36 @@
|
||||
</div>
|
||||
|
||||
<!-- 🌟 SEKTION 2: DESTINATIONS (21 BAYS) -->
|
||||
<div class="mt-7">
|
||||
<div class="rounded-2xl grid grid-cols-7 grid-rows-5 p-5 gap-2 bg-cover bg-center bg-no-repeat aspect-7/5 max-w-4xl"
|
||||
style="background-image: url({{ asset('images/soccerfield-middle.jpg') }});">
|
||||
<div class="mt-7 w-full grid grid-cols-7 gap-3">
|
||||
<div class="rounded col-span-5 grid grid-cols-7 grid-rows-5 p-5 gap-2 bg-cover bg-center bg-no-repeat aspect-7/5 max-w-4xl"
|
||||
style="background-image: url({{ asset('images/soccerfield.jpg') }});">
|
||||
@foreach ($lists as $listId => $items)
|
||||
@if (str_starts_with($listId, 'dest-'))
|
||||
<div class="rounded-xl flex flex-col bg-white/30 backdrop-blur-none drop-shadow-xl"
|
||||
<div class="relative rounded-xl flex flex-col bg-white/30 backdrop-blur-none drop-shadow-xl"
|
||||
wire:key="box-{{ $listId }}">
|
||||
<div class="font-bold text-md mx-auto">
|
||||
{{-- {{ $destLabels[str_replace('dest-', '', $listId)] }} --}}
|
||||
{{ array_shift($destLabels) }}
|
||||
<div
|
||||
class="fixed h-6 z-5 top-0 right-0 left-0 pl-2 pt-0.5 font-black text-blue-600 text-sm bg-white/30 rounded-t-2xl">
|
||||
{{ $pos = array_shift($destLabels) }}
|
||||
</div>
|
||||
|
||||
<!-- Reiner HTML-Container mit Sortable-Klassenerkennung -->
|
||||
<div id="{{ $listId }}" class="sortable-zone flex-1 rounded-b-lg p-1 ">
|
||||
|
||||
@foreach ($items as $item)
|
||||
<x-filament::badge color="{{ $item['pcolor'] }}" data-id="{{ $item['id'] }}"
|
||||
tooltip="{{ $item['info'] }}" icon="phosphor-dots-six-vertical"
|
||||
icon-position="after"
|
||||
<div data-id="{{ $item['id'] }}" tooltip="{{ $item['info'] }}"
|
||||
wire:key="item-dst-{{ $item['id'] }}-v-{{ $boardVersion }}"
|
||||
class="m-0 p-2 w-full h-full cursor-grab active:cursor-grabbing hover:border-danger-500 transition-all">
|
||||
|
||||
<div class=" font-medium text-gray-900 dark:text-gray-100 flex-1 text-wrap my-1">
|
||||
class="static m-1 pt-4 text-sm cursor-grab active:cursor-grabbing transition-all">
|
||||
<x-filament::button icon="phosphor-x" size="xs"
|
||||
class="absolute top-0.5 right-1 z-10 p-0.5"
|
||||
wire:click="returnToOrigin('{{ $item['id'] }}', '{{ $listId }}')" />
|
||||
<x-filament::badge size="xs" color="{{ $item['pcolor'] }}">
|
||||
{{ ucfirst(str_replace('source-', '', $item['origin'])) }}
|
||||
</x-filament::badge>
|
||||
<div
|
||||
class="text-black text-wrap leading-4 tracking-tighter text-shadow-lg bg-white/50 drop-shadow p-0.5 rounded">
|
||||
{{ $item['name'] }}
|
||||
</div>
|
||||
|
||||
<div class=" flex flex-row gap-1 items-center justify-between">
|
||||
<x-filament::icon-button icon="phosphor-x-circle" size="sm" color="gray"
|
||||
wire:click="returnToOrigin('{{ $item['id'] }}', '{{ $listId }}')" />
|
||||
{{ ucfirst(str_replace('source-', '', $item['origin'])) }}
|
||||
</div>
|
||||
|
||||
</x-filament::badge>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@@ -108,6 +103,25 @@
|
||||
@endif
|
||||
@endforeach
|
||||
</div>
|
||||
<div class="col-span-2">
|
||||
<div class="rounded bg-gray-50 p-2 border border-gray-200 grid grid-cols-7 space-y-1 text-xs items-center">
|
||||
@foreach ($results as $k => $result)
|
||||
@if ($k < 11)
|
||||
<x-filament::badge color="success" size="sm">
|
||||
{{ $k + 1 }}
|
||||
</x-filament::badge>
|
||||
@else
|
||||
<x-filament::badge color="danger" size="sm">
|
||||
{{ $k + 1 }}
|
||||
</x-filament::badge>
|
||||
@endif
|
||||
<span class="font-bold col-span-4 px-2">{{ $result['name'] }}</span>
|
||||
<span class="font-bold px-2">{{ $result['position'] ?? 'none' }}</span>
|
||||
<span class="font-bold text-blue-500 p-1">{{ number_format(mt_rand(1, 100) / 100, 2) }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user