{% extends 'base.html' %}
{% block title %}Adjust Stock — {{ product.name }}{% endblock %}

{% block content %}
<div class="flex justify-between items-center mb-6">
  <h1 class="text-2xl font-bold">Adjust Stock — {{ product.name }}</h1>
  <a href="{% url 'inventory:product_detail' product.pk %}" class="btn btn-ghost btn-sm">← Back</a>
</div>

{% load form_tags %}
<div class="card bg-base-100 shadow max-w-md">
  <div class="card-body">
    <div class="stats mb-4">
      <div class="stat p-0">
        <div class="stat-title text-xs">Current Stock</div>
        <div class="stat-value text-lg">{{ product.stock_quantity }} {{ product.unit }}</div>
      </div>
    </div>
    <form method="post">
      {% csrf_token %}
      {% for field in form %}
        <div class="form-control mb-3">
          <label class="label">
            <span class="label-text">{{ field.label }}</span>
          </label>
          {{ field|daisyui }}
          {% for error in field.errors %}
            <span class="text-error text-sm">{{ error }}</span>
          {% endfor %}
        </div>
      {% endfor %}
      <div class="card-actions justify-end mt-4">
        <a href="{% url 'inventory:product_detail' product.pk %}" class="btn btn-ghost">Cancel</a>
        <button type="submit" class="btn btn-primary">Update Stock</button>
      </div>
    </form>
  </div>
</div>
{% endblock %}