@extends('layouts.master') @section('title', $title) @php $pur = $product->puruom?->name; $sel = $product->sellinguom?->name; $fmtQty = fn($purQty, $selQty) => $same_unit ? number_format($purQty, 2) . ' ' . $pur : number_format($purQty, 2) . ' ' . $pur . ' = ' . number_format($selQty, 2) . ' ' . $sel; $img = !empty($product->image) && file_exists(public_path('storage/products/' . $product->image)) ? asset('storage/products/' . $product->image) : asset('default/product_default.png'); @endphp @section('content') {{-- Edit product: the same form as the product list. --}} @include($view . '.modal')
Back to products
@if ($per_store->isEmpty() && $can_add_inventory) {{-- not in inventory yet: add its first stock here --}} @elseif ($can_adjust) @if ($per_store->count()) @else @endif @endif @can($access . '-update') @endcan
{{-- Product details --}}
product

{{ $product->name }} {{ ucfirst($product->status) }}

@if ($product->generic_name)
{{ $product->generic_name }}
@endif
Barcode: {{ $product->barcode ?: '-' }}
Type: {{ $type_name ?: '-' }}
Category: {{ $category_name ?: '-' }}
Subcategory: {{ $subcategory_name ?: '-' }}
Units: {{ $same_unit ? $pur : '1 ' . $pur . ' = ' . ($product->selling_conversion + 0) . ' ' . $sel }}
Selling price: {{ currency_symbol() }} {{ number_format($product->selling_price, 2) }} / {{ $sel }}
Cost price: {{ currency_symbol() }} {{ number_format($product->cost_price, 2) }} / {{ $pur }}
Reorder level: {{ $product->reorder_level ? $product->reorder_level + 0 . ' ' . $pur : '-' }}
Tracks expiration: {{ $product->track_expiration == 'yes' ? 'Yes' : 'No' }}
@if ($product->description)
Description: {{ $product->description }}
@endif
{{-- Stock summary --}}
@php $lowStock = $product->reorder_level && $summary['pur_qty'] <= $product->reorder_level; @endphp
Total balance (all batches)
{{ $fmtQty($summary['pur_qty'], $summary['sel_qty']) }}
@if ($summary['pur_qty'] <= 0) Out of stock @elseif ($lowStock) At or below reorder level @endif
Stock value
{{ currency_symbol() }} {{ number_format($summary['value'], 2) }}
Batches with stock
{{ $summary['active_batches'] }}
Expired / expiring in 30 days
{{ $summary['expiring'] }} batch(es)
@if ($per_store->count() > 1)
Per store: @foreach ($per_store as $row) {{ $row->store }}: {{ $fmtQty($row->pur_qty, $row->sel_qty) }} @endforeach
@endif
# Batch Purchase order Store Received Expiration Balance Unit cost Value {{ __('messages.action') }}
# Date Reference Batch Store In Out Unit
{{-- Add inventory: the first stock batch of a product that has none (ProductController::addInventory) --}} @if ($per_store->isEmpty() && $can_add_inventory) @endif {{-- Product-level stock adjustment — InventoryController::adjustProduct() picks the batch: increase → oldest batch with stock (else newest); decrease → oldest first, never below zero. --}} {{-- Batch edit — posts to the existing pharmacy.inventories.create (update) endpoint. --}} @endsection @section('page_js') @endsection