Added panel box pallet count page and livewire pages
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
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
This commit is contained in:
53
app/Livewire/PanelPalletCountDataTable.php
Normal file
53
app/Livewire/PanelPalletCountDataTable.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user