<?= $this->extend('layout/management_layout') ?>
<?= $this->section('content') ?>

<div class="container my-4">
  <h3 class="mb-3">Adjust Stock — <?= esc($item['name']) ?></h3>
  <?= view('partials/flash_messages') ?>

  <form method="post" action="<?= site_url('inventory/adjust/'.$item['id']) ?>">
    <?= csrf_field() ?>

    <div class="row g-3">
      <div class="col-md-3">
        <label class="form-label">Mode</label>
        <select class="form-select" name="mode" required>
          <option value="in">Add to Stock</option>
          <option value="out">Deduct from Stock</option>
          <option value="adjust">Adjust (signed)</option>
        </select>
      </div>
      <div class="col-md-3">
        <label class="form-label">Quantity</label>
        <input type="number" min="1" class="form-control" name="quantity" required>
      </div>
      <div class="col-md-6">
        <label class="form-label">Reason</label>
        <input class="form-control" name="reason" placeholder="Purchase, Donation, Correction, etc.">
      </div>
      <div class="col-12">
        <label class="form-label">Note (optional)</label>
        <textarea class="form-control" rows="3" name="note"></textarea>
      </div>
    </div>

    <div class="mt-3 d-flex gap-2">
      <button class="btn btn-primary">Save</button>
      <a class="btn btn-outline-secondary" href="<?= site_url('inventory/summary/'.$item['type']) ?>">Cancel</a>
    </div>
  </form>
</div>

<?= $this->endSection() ?>
