diff --git a/app/Livewire/SparePackData.php b/app/Livewire/SparePackData.php new file mode 100644 index 0000000..7b8c77e --- /dev/null +++ b/app/Livewire/SparePackData.php @@ -0,0 +1,55 @@ + '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'); + } +} diff --git a/resources/views/livewire/spare-pack-data.blade.php b/resources/views/livewire/spare-pack-data.blade.php new file mode 100644 index 0000000..4eb66fe --- /dev/null +++ b/resources/views/livewire/spare-pack-data.blade.php @@ -0,0 +1,47 @@ +
| No | +Created Datetime | +Created By | +S PACKING No | +Item Code | +Description | +Doc No | +Quantity | +Scanned Datetime | +Scanned By | +
|---|---|---|---|---|---|---|---|---|---|
| {{ $index + 1 }} | +{{ $record['created_at'] ?? '-' }} | +{{ $record['created_by'] ?? '-' }} | +{{ $record['spare_packing_number'] ?? '-' }} | +{{ $record['item_code'] ?? '-' }} | +{{ $record['item_description'] ?? '-' }} | +{{ $record['document_number'] ?? '-' }} | +{{ $record['quantity'] ?? '-' }} | +{{ $record['scanned_at'] ?? '-' }} | +{{ $record['scanned_by'] ?? '-' }} | +
| + No spare packing records found. + | +|||||||||