<section class="border-b border-gray-300 p-2 shrink-0 bg-control-panel">
  <span class="text-sm font-bold text-gray-700">봉투 단가 수정</span>
</section>
<div class="border border-gray-300 p-4 mt-2 bg-white max-w-3xl">
  <form action="<?= base_url('admin/bag-prices/update/' . (int) $item->bp_idx) ?>" method="POST" class="space-y-4">
    <?= csrf_field() ?>

    <div class="flex flex-wrap items-center gap-2">
      <label class="block text-sm font-bold text-gray-700 w-28">봉투</label>
      <span class="text-sm font-mono"><?= esc($item->bp_bag_code) ?></span>
      <span class="text-sm text-gray-500"><?= esc($item->bp_bag_name) ?></span>
    </div>

    <div class="flex flex-wrap items-center gap-2">
      <label class="block text-sm font-bold text-gray-700 w-28">발주단가 <span class="text-red-500">*</span></label>
      <input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-40 text-right" name="bp_order_price" type="number" step="0.01" value="<?= esc(old('bp_order_price', $item->bp_order_price)) ?>" required/>
      <span class="text-sm text-gray-500">원</span>
    </div>

    <div class="flex flex-wrap items-center gap-2">
      <label class="block text-sm font-bold text-gray-700 w-28">도매가 <span class="text-red-500">*</span></label>
      <input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-40 text-right" name="bp_wholesale" type="number" step="0.01" value="<?= esc(old('bp_wholesale', $item->bp_wholesale)) ?>" required/>
      <span class="text-sm text-gray-500">원</span>
    </div>

    <div class="flex flex-wrap items-center gap-2">
      <label class="block text-sm font-bold text-gray-700 w-28">소비자가 <span class="text-red-500">*</span></label>
      <input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-40 text-right" name="bp_consumer" type="number" step="0.01" value="<?= esc(old('bp_consumer', $item->bp_consumer)) ?>" required/>
      <span class="text-sm text-gray-500">원</span>
    </div>

    <div class="flex flex-wrap items-center gap-2">
      <label class="block text-sm font-bold text-gray-700 w-28">적용시작일 <span class="text-red-500">*</span></label>
      <input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-44" name="bp_start_date" type="date" value="<?= esc(old('bp_start_date', $item->bp_start_date)) ?>" required/>
    </div>

    <div class="flex flex-wrap items-center gap-2">
      <label class="block text-sm font-bold text-gray-700 w-28">적용종료일</label>
      <input class="border border-gray-300 rounded px-3 py-1.5 text-sm w-44" name="bp_end_date" type="date" value="<?= esc(old('bp_end_date', $item->bp_end_date)) ?>"/>
    </div>

    <div class="flex flex-wrap items-center gap-2">
      <label class="block text-sm font-bold text-gray-700 w-28">상태 <span class="text-red-500">*</span></label>
      <select class="border border-gray-300 rounded px-3 py-1.5 text-sm w-32" name="bp_state" required>
        <option value="1" <?= (int) old('bp_state', $item->bp_state) === 1 ? 'selected' : '' ?>>사용</option>
        <option value="0" <?= (int) old('bp_state', $item->bp_state) === 0 ? 'selected' : '' ?>>미사용</option>
      </select>
    </div>

    <div class="flex gap-2 pt-2">
      <button type="submit" class="bg-btn-search text-white px-6 py-1.5 rounded-sm text-sm shadow hover:opacity-90 transition">수정</button>
      <a href="<?= base_url('admin/bag-prices') ?>" class="bg-gray-200 text-gray-700 px-6 py-1.5 rounded-sm text-sm hover:bg-gray-300 transition">취소</a>
    </div>
  </form>
</div>
