<!-- Add Expense Sub Type Modal -->
<div class="modal fade" id="editSubTypeModal" tabindex="-1" role="dialog" aria-labelledby="editSubTypeModal" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <form action="<?= base_url('admin/expense/update_subtype') ?>" method="post">
  <input type="hidden" name="<?= $this->security->get_csrf_token_name(); ?>" 
         value="<?= $this->security->get_csrf_hash(); ?>" />
  
  <!-- hidden field for subtype id -->
  <input type="hidden" name="id" id="edit-subtype-id" />

  <div class="modal-content">
    <div class="modal-header">
      <h5 class="modal-title">Edit Expense Sub Type</h5>
      <button type="button" class="close" data-dismiss="modal" aria-label="Close">
        <span aria-hidden="true">&times;</span>
      </button>
    </div>
    <div class="modal-body">
      <div class="form-group">
        <label for="expense_type_id">Parent Type</label>
        <select name="expense_type_id" id="edit-subtype-type-id" class="form-control" required>
          <option value="">Select Type</option>
          <?php foreach ($expense_types as $type): ?>
            <option value="<?= $type->id ?>"><?= $type->expense_type ?></option>
          <?php endforeach; ?>
        </select>
      </div>
      <div class="form-group">
        <label for="sub_expense_type">Sub Type Name</label>
        <input type="text" name="sub_expense_type" class="form-control" id="edit-subtype-name" required>
      </div>
      <div class="form-group">
        <label for="note">Note (optional)</label>
        <textarea name="note" class="form-control" id="edit-subtype-note" rows="2"></textarea>
      </div>
    </div>
    <div class="modal-footer">
      <button type="submit" class="btn btn-primary">Update</button>
      <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
    </div>
  </div>
</form>

  </div>
</div>
