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
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use App\Models\PanelPalletValidation;
|
|
use Livewire\Component;
|
|
|
|
class PanelPalletCountDataTable extends Component
|
|
{
|
|
|
|
public $plantId;
|
|
|
|
public $palletNumber;
|
|
|
|
public $snoCount = 0;
|
|
|
|
public $records = [];
|
|
|
|
protected $listeners = [
|
|
//'removeSno' => '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');
|
|
}
|
|
}
|