{% extends "base.html" %} {% from "components/ui.html" import page_header %} {% block content %} {% set breadcrumbs = [ {'text': 'Inventory', 'url': url_for('inventory.list_stock_items')}, {'text': 'Stock Items', 'url': url_for('inventory.list_stock_items')}, {'text': item.name} ] %} {{ page_header( icon_class='fas fa-cube', title_text=item.name, subtitle_text=item.sku, breadcrumbs=breadcrumbs, actions_html=('Edit' if (current_user.is_admin or has_permission('manage_stock_items')) else '') + ('History' if (current_user.is_admin or has_permission('view_stock_history')) else '') + ('Stock Levels' if (current_user.is_admin or has_permission('view_stock_levels')) else '') ) }}

{{ _('Item Details') }}

{{ item.sku }}

{{ item.category or '—' }}

{{ item.unit }}

{{ item.barcode or '—' }}

{% if item.description %}

{{ item.description }}

{% endif %}

{{ "%.2f"|format(item.default_cost) if item.default_cost else '—' }} {{ item.currency_code }}

{{ "%.2f"|format(item.default_price) if item.default_price else '—' }} {{ item.currency_code }}

{% if item.supplier_items.filter_by(is_active=True).count() > 0 %}
{% for supplier_item in item.supplier_items.filter_by(is_active=True).all() %}
{{ supplier_item.supplier.name }} {% if supplier_item.is_preferred %} {{ _('Preferred') }} {% endif %}
{% if supplier_item.unit_cost %} {{ "%.2f"|format(supplier_item.unit_cost) }} {{ supplier_item.currency_code }} {% endif %} {% if supplier_item.supplier_sku %} | SKU: {{ supplier_item.supplier_sku }} {% endif %}
{% endfor %}
{% endif %} {% if item.reorder_point %}

{{ item.reorder_point }}

{{ item.reorder_quantity or '—' }}

{% endif %}

{% if item.is_active %} {{ _('Active') }} {% else %} {{ _('Inactive') }} {% endif %}

{% if item.is_trackable %} {{ _('Yes') }} {% else %} {{ _('No') }} {% endif %}

{% if item.is_trackable and stock_levels %}

{{ _('Stock Levels by Warehouse') }}

{% for stock in stock_levels %} {% endfor %}
{{ _('Warehouse') }} {{ _('On Hand') }} {{ _('Reserved') }} {{ _('Available') }} {{ _('Location') }}
{{ stock.warehouse.code }} - {{ stock.warehouse.name }} {{ stock.quantity_on_hand }} {{ stock.quantity_reserved }} {{ stock.quantity_available }} {% if item.reorder_point and stock.quantity_on_hand < item.reorder_point %} {% endif %} {{ stock.location or '—' }}
{% endif %} {% if recent_movements %}

{{ _('Recent Stock Movements') }}

{% for movement in recent_movements %} {% endfor %}
{{ _('Date') }} {{ _('Type') }} {{ _('Warehouse') }} {{ _('Quantity') }} {{ _('Reason') }}
{{ movement.moved_at.strftime('%Y-%m-%d %H:%M') if movement.moved_at else '—' }} {{ movement.movement_type }} {{ movement.warehouse.code }} {{ '+' if movement.quantity > 0 else '' }}{{ movement.quantity }} {{ movement.reason or '—' }}
{% endif %}

{{ _('Summary') }}

{% if item.is_trackable %}

{{ item.total_quantity_on_hand or 0 }}

{{ item.total_quantity_reserved or 0 }}

{{ item.total_quantity_available or 0 }}

{% if item.is_low_stock %}

{{ _('Low Stock Alert') }}

{% endif %}
{% else %}

{{ _('This item is not trackable.') }}

{% endif %}
{% if active_reservations %}

{{ _('Active Reservations') }}

{% for reservation in active_reservations %}

{{ reservation.quantity }} {{ item.unit }}

{{ reservation.reservation_type }} #{{ reservation.reservation_id }}

{{ reservation.warehouse.code }}

{% endfor %}
{% endif %}
{% endblock %}