diff --git a/app/Livewire/StickerValidation.php b/app/Livewire/StickerValidation.php new file mode 100644 index 0000000..707c920 --- /dev/null +++ b/app/Livewire/StickerValidation.php @@ -0,0 +1,65 @@ + 'loadStickerData', + 'addStickerToList' => 'loadSticker' + ]; + + public function loadStickerData($plantId, $refNumber) + { + $this->plantId = $plantId; + $this->refNumber = $refNumber; + // $this->records = ProductionQuantity::where('plant_id', $plantId) + // ->where('production_order', $refNumber) + // ->orderBy('created_at', 'asc') + // ->get(['serial_number', 'operator_id']); + + $this->records = ProductionQuantity::query() + ->where('production_quantities.plant_id', $plantId) + ->where('production_quantities.production_order', $refNumber) + ->leftJoin( + 'sticker_validations', + 'sticker_validations.serial_number', + '=', + 'production_quantities.serial_number' + ) + ->orderBy('production_quantities.created_at', 'asc') + ->get([ + 'production_quantities.serial_number', + 'production_quantities.operator_id', + 'sticker_validations.status', + 'sticker_validations.sticker_id', + ]) + ->map(function ($row) { + $row->status = $row->status ?? ''; + return $row; + }); + + //dd($this->records); + + } + + + public function render() + { + return view('livewire.sticker-validation'); + } +} diff --git a/resources/views/livewire/sticker-validation.blade.php b/resources/views/livewire/sticker-validation.blade.php new file mode 100644 index 0000000..e54fd64 --- /dev/null +++ b/resources/views/livewire/sticker-validation.blade.php @@ -0,0 +1,54 @@ +
| No | +Sticker ID | +Production Order | +Serial Number | +Status | +Created By | +
|---|---|---|---|---|---|
| {{ $index + 1 }} | +{{ $record->sticker_id }} | +{{ $refNumber }} | +{{ $record['serial_number'] }} | +{{ $record->status }} | +{{ $record->operator_id }} | +
| No serial numbers found. | +|||||