diff --git a/app/Filament/Pages/PanelBoxPalletCount.php b/app/Filament/Pages/PanelBoxPalletCount.php
new file mode 100644
index 00000000..d04dca42
--- /dev/null
+++ b/app/Filament/Pages/PanelBoxPalletCount.php
@@ -0,0 +1,68 @@
+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)
+ ]);
+ }
+}
diff --git a/app/Livewire/PanelPalletCountDataTable.php b/app/Livewire/PanelPalletCountDataTable.php
new file mode 100644
index 00000000..50b08986
--- /dev/null
+++ b/app/Livewire/PanelPalletCountDataTable.php
@@ -0,0 +1,53 @@
+ 'requestRemoveSerialNumber',
+ 'loadData' => 'loadPalletData',
+ ];
+
+
+ public function loadPalletData($palletNumber, $plantId)
+ {
+ $this->plantId = $plantId;
+ $this->palletNumber = $palletNumber;
+ $this->records = [];
+
+ $this->records = PanelPalletValidation::query()
+ ->where('plant_id', $plantId)
+ ->where('pallet_number', $palletNumber)
+ ->get()
+ ->groupBy(fn ($record) => trim($record->panel_box_code ?? ''))
+ ->map(function ($items, $code) {
+ return [
+ 'panel_box_code' => $code,
+ 'count' => $items->pluck('panel_box_serial_number')
+ ->filter()
+ ->unique()
+ ->count(),
+ ];
+ })
+ ->values()
+ ->toArray();
+ }
+
+ public function render()
+ {
+ return view('livewire.panel-pallet-count-data-table');
+ }
+}
diff --git a/resources/views/filament/pages/panel-box-pallet-count.blade.php b/resources/views/filament/pages/panel-box-pallet-count.blade.php
new file mode 100644
index 00000000..c1862ed5
--- /dev/null
+++ b/resources/views/filament/pages/panel-box-pallet-count.blade.php
@@ -0,0 +1,15 @@
+
| No | +Panel Box Code | +Count | +
|---|---|---|
| {{ $index + 1 }} | ++ {{ $record['panel_box_code'] }} + | ++ {{ $record['count'] }} + | +
| + No pallet records found. + | +||