| 123456789101112131415161718192021222324252627282930313233 |
- <?php
- namespace App\Http\Controllers;
- use App\Services\SparePartInventoryService;
- use Illuminate\Http\Request;
- class SparePartInventoryController extends Controller
- {
- protected array $data = [
- 'active' => 'spare_parts',
- 'title' => 'Контроль наличия запчастей',
- 'id' => 'spare_part_inventory',
- ];
- public function __construct(protected SparePartInventoryService $inventoryService)
- {
- }
- public function index(Request $request)
- {
- $this->data['critical_shortages'] = $this->inventoryService->getCriticalShortages();
- $this->data['below_min_stock'] = $this->inventoryService->getBelowMinStock();
- $this->data['open_shortages'] = \App\Models\Shortage::query()
- ->where('status', \App\Models\Shortage::STATUS_OPEN)
- ->with(['sparePart', 'reclamation'])
- ->orderBy('created_at', 'asc')
- ->get();
- $this->data['tab'] = 'inventory';
- return view('spare_parts.index', $this->data);
- }
- }
|