Files
pds/app/Filament/Pages/PanelBoxPalletCount.php
dhanabalan 3c909e51e6
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Laravel Larastan / larastan (pull_request) Failing after 3m57s
Laravel Pint / pint (pull_request) Successful in 4m19s
Added panel box pallet count page and livewire pages
2026-12-01 08:39:13 +05:30

69 lines
2.6 KiB
PHP

<?php
namespace App\Filament\Pages;
use Filament\Pages\Page;
use Filament\Forms\Form;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Facades\Filament;
use App\Models\Plant;
class PanelBoxPalletCount extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-document-text';
protected static string $view = 'filament.pages.panel-box-pallet-count';
protected static ?string $navigationGroup = 'Panel Box Pallet';
public array $filters = [];
public function form(Form $form): Form
{
return $form
->statePath('filters')
->schema([
Section::make('')
->schema([
Select::make('plant_id')
->label('Plant')
->relationship('plant', 'name')
->reactive()
// ->searchable()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
})
->required()
->afterStateUpdated(function ($state, callable $get, $set) {
$set('pallet_count', null);
}),
Select::make('pallet_count')
->label('Select Pallet')
->required()
->columnSpan(1)
->options(function (callable $get) {
if (!$get('plant_id')) {
return [];
}
return \App\Models\PanelPalletValidation::where('plant_id', $get('plant_id'))
->pluck('pallet_number', 'pallet_number')
->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $get, $set) {
$plantId = $get('plant_id');
$this->dispatch('loadData',$state, $plantId);
}),
])
->columns(2)
]);
}
}