All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 20s
56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Livewire;
|
|
|
|
use App\Models\SparePacking;
|
|
use Livewire\Component;
|
|
|
|
class SparePackData extends Component
|
|
{
|
|
|
|
public $plantId;
|
|
|
|
public $sparePackNo;
|
|
|
|
public $snoCount = 0;
|
|
|
|
public $records = [];
|
|
|
|
protected $listeners = [
|
|
'loadData' => 'loadSparePackingData',
|
|
];
|
|
|
|
public function loadSparePackingData($sparePackNo, $plantId)
|
|
{
|
|
$this->plantId = $plantId;
|
|
$this->sparePackNo = $sparePackNo;
|
|
$this->records = [];
|
|
|
|
$this->records = SparePacking::query()
|
|
->where('plant_id', $this->plantId)
|
|
->where('spare_packing_number', $this->sparePackNo)
|
|
->orderBy('scanned_at')
|
|
->get()
|
|
->map(function ($record) {
|
|
return [
|
|
'created_at' => $record->created_at,
|
|
'created_by' => $record->created_by ?? '',
|
|
'spare_packing_number' => $record->spare_packing_number,
|
|
'item_code' => $record->item?->code ?? '',
|
|
'item_description' => $record->item?->description ?? '',
|
|
'document_number' => $record->document_number,
|
|
'quantity' => $record->quantity,
|
|
'scanned_at' => $record->scanned_at,
|
|
'scanned_by' => $record->scanned_by ?? '',
|
|
];
|
|
})
|
|
->toArray();
|
|
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
return view('livewire.spare-pack-data');
|
|
}
|
|
}
|