sackey e839d40a99
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
Initial commit
2025-07-30 17:15:50 +00:00

57 lines
1.4 KiB
PHP

<?php
namespace App\Livewire\Inventory\Parts;
use App\Models\Part;
use Livewire\Component;
class Show extends Component
{
public Part $part;
public $tab = 'details';
public function mount(Part $part)
{
$this->part = $part->load(['supplier', 'stockMovements.createdBy']);
$this->tab = request()->get('tab', 'details');
}
public function showHistory()
{
return $this->redirect(route('inventory.parts.show', $this->part) . '?tab=history', navigate: true);
}
public function addStockMovement()
{
return $this->redirect(route('inventory.stock-movements.create') . '?part_id=' . $this->part->id, navigate: true);
}
public function createPurchaseOrder()
{
return $this->redirect(route('inventory.purchase-orders.create') . '?part_id=' . $this->part->id, navigate: true);
}
public function goBack()
{
return $this->redirect(route('inventory.parts.index'), navigate: true);
}
public function edit()
{
return $this->redirect(route('inventory.parts.edit', $this->part), navigate: true);
}
public function render()
{
if ($this->tab === 'history') {
return view('livewire.inventory.parts.show', [
'showHistory' => true
]);
}
return view('livewire.inventory.parts.show', [
'showHistory' => false
]);
}
}