ADD EV3-358 statisztika modul bővítése aktuális ár megjelenítéssel phase 2 layout problem

This commit is contained in:
E98Developer 2026-07-01 19:56:01 +02:00
parent f81f285479
commit 0b1240f972
3 changed files with 136 additions and 34 deletions

View File

@ -2,10 +2,21 @@
namespace App\Filament\Pages;
use App\Models\Producer;
use App\Models\Product;
use App\Models\ProductGroup;
use App\Models\Supplier;
use Filament\Forms\Components\Select;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Schemas\Schema;
use Filament\Pages\Page;
use Illuminate\Support\Facades\DB;
class CurrentPrice extends Page
class CurrentPrice extends Page implements HasForms
{
use InteractsWithForms;
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-currency-dollar';
protected static ?string $title = 'Aktuális ár';
@ -14,14 +25,9 @@ class CurrentPrice extends Page
protected static string | \UnitEnum | null $navigationGroup = 'Statisztika';
public function getHeader(): ?\Illuminate\Contracts\View\View
public function getHeading(): string|\Illuminate\Contracts\Support\Htmlable
{
return null;
}
public function getFooter(): ?\Illuminate\Contracts\View\View
{
return null;
return '';
}
public function getBreadcrumbs(): array
@ -30,4 +36,71 @@ public function getBreadcrumbs(): array
}
protected string $view = 'filament.pages.current-price';
public ?array $data = [];
public function mount(): void
{
$this->form->fill();
}
public function form(Schema $form): Schema
{
return $form
->schema([
Select::make('supplier')
->label('Beszállító:')
->options(Supplier::orderBy('name')->pluck('name', 'id'))
->multiple()
->searchable()
->placeholder('Válasszon beszállítót...'),
Select::make('productGroup')
->label('Termékcsoport:')
->options(ProductGroup::orderBy('name')->pluck('name', 'id'))
->multiple()
->searchable()
->placeholder('Válasszon termékcsoportot...'),
Select::make('product')
->label('Termék:')
->multiple()
->searchable()
->getSearchResultsUsing(function (string $search, ?array $state) {
$query = Product::where('name', 'like', "%{$search}%");
return $query->limit(50)->pluck('name', 'name')->toArray();
})
->getOptionLabelsUsing(fn (array $values): array => Product::whereIn('name', $values)
->pluck('name', 'name')
->toArray())
->placeholder('Válasszon terméket...'),
Select::make('hooreycaName')
->label('Hooreyca megnevezés :')
->options(function () {
DB::statement("SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));");
$options = Product::orderBy('buyerProductName')
->where('buyerProductName', '!=', '')
->groupBy('buyerProductName')
->pluck('buyerProductName', 'buyerProductName')
->toArray();
DB::statement("SET sql_mode=(SELECT CONCAT(@@sql_mode, ',ONLY_FULL_GROUP_BY'));");
return $options;
})
->multiple()
->searchable()
->placeholder('Válasszon megnevezést...'),
Select::make('producer')
->label('Gyártó :')
->options(Producer::orderBy('name')->pluck('name', 'id'))
->multiple()
->searchable()
->placeholder('Válasszon gyártót...'),
])
->statePath('data');
}
public function submit(): void
{
$data = $this->form->getState();
// Itt lehet majd feldolgozni a szűrést
// dd($data);
}
}

View File

@ -8,6 +8,17 @@
.fi-main { padding-left: 0 !important; }
.fi-topbar { z-index: 10 !important; }
/* A Filament wrapper elemeinek nullázása a pontos illeszkedés érdekében */
.fi-page, .fi-page-header-main-ctn, .fi-page-main, .fi-page-content, .fi-page-header, .fi-header {
padding: 0 !important;
margin: 0 !important;
gap: 0 !important;
}
.fi-page-header, .fi-header {
display: none !important;
}
/* A legacy sidebar stílusaihoz szükséges alapok */
.page-wrapper.chiller-theme .page-content {
padding-left: 260px;
@ -18,9 +29,14 @@
}
}
/* Biztosítjuk a szürke hátteret */
/* Biztosítjük a szürke hátteret és eltüntetjük a felső üres részt */
.fi-main-ctn {
background-color: #f4f4f4 !important;
min-height: 100vh;
}
.fi-main {
padding-top: 0 !important;
margin-top: 0 !important;
}
.statistic-card {
@ -28,15 +44,17 @@
border-radius: 4px;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
margin-bottom: 20px;
border: 1px solid #dee2e6;
}
.statistic-card-header {
padding: 15px 20px;
padding: 10px 15px;
border-bottom: 1px solid #eee;
font-weight: bold;
font-weight: 600;
color: #333;
background-color: #f8f9fa;
}
.statistic-card-body {
padding: 20px;
padding: 15px;
}
/* Navigációs gombok stílusa (a modern nézetből átemelve, de a legacy-hoz igazítva) */
@ -90,33 +108,22 @@
});
</script>
<main class="page-content" style="padding-top: 20px;">
<div class="container-fluid" style="max-width: 100%;">
<main class="page-content" style="padding-top: 0;">
<div class="container-fluid" style="max-width: 100%; padding-left: 15px; padding-right: 15px;">
<div class="statistic-card">
<div class="statistic-card-header">
Statisztikai navigáció (Legacy)
Szűrés
</div>
<div class="statistic-card-body">
<div class="row">
<div class="col-md-4 mb-3">
<a href="{{ url('legacy/admin/statistics') }}?type=OrderFrequency" class="legacy-nav-item">
<i class="fa fa-wave-square"></i>
<span>Rendelés gyakoriság</span>
</a>
</div>
<div class="col-md-4 mb-3">
<a href="{{ url('legacy/admin/statistics') }}?type=PriceChange" class="legacy-nav-item">
<i class="fa fa-chart-bar"></i>
<span>Árváltozás</span>
</a>
</div>
<div class="col-md-4 mb-3">
<a href="{{ url('legacy/admin/statistics') }}?type=ProductAmount" class="legacy-nav-item">
<i class="fa fa-dollar-sign"></i>
<span>Forgalom</span>
</a>
</div>
<form wire:submit.prevent="submit">
{{ $this->form }}
<div class="mt-4 flex justify-end">
<button type="submit" class="bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded transition">
Szűrés alkalmazása
</button>
</div>
</form>
</div>
</div>

View File

@ -0,0 +1,22 @@
<?php
use App\Models\User;
use App\Models\Role;
use App\Filament\Pages\CurrentPrice;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
use Livewire\Livewire;
uses(TestCase::class, RefreshDatabase::class);
it('can render current price page', function () {
$adminRole = Role::create(['name' => 'admin', 'display_name' => 'Admin', 'description' => 'Admin']);
$user = User::factory()->create();
$user->addRole($adminRole);
$this->actingAs($user);
Livewire::test(CurrentPrice::class)
->assertOk()
->assertFormExists();
});