<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
  <h5 class="modal-title" id="menuEditModalLabel">등록</h5>
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
  <form id="equipEditForm" th:action="@{/equip/saveEquip}" method="post" enctype="multipart/form-data">
    <input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
    <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
    <div class="row mb-3">
      <label for="cat1Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">관리처</label>
      <div class="col-sm-6">
        <select class="form-select form-select-sm" id="mgtOrgan" name="mgtOrgan" th:disabled="${accessAuth ne 'ACC003'}">
          <option value="">선택</option>
          <th:block th:each="commonCode:${session.commonCode.get('OG')}">
            <th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}">
              <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq userOrgan}"></option>
            </th:block>
          </th:block>
        </select>
      </div>
    </div>
    <div class="row mb-3">
      <label for="cat1Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">분류</label>
      <div class="col-sm-6">
        <select class="form-select form-select-sm" id="equType" name="equType">
          <option value="">-분류 선택-</option>
           <th:block th:each="commonCode:${session.commonCode.get('IT')}">
             <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
           </th:block>
        </select>
      </div>
    </div>
    <div class="row mb-3">
      <label for="cat2Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">세부분류</label>
      <div class="col-sm-6">
        <select class="form-select form-select-sm" id="detailType" name="detailType">
          <option value="">-세부분류 선택-</option>
        </select>
      </div>
    </div>
    <div class="row mb-3">
      <label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">취득연도</label>
      <div class="col-sm-6">
        <input type="text" class="form-control storedYear" name="storedYear" readonly>
      </div>
    </div>
    <div class="row mb-3">
      <label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">보유량</label>
      <div class="col-sm-6">
        <input type="number" class="form-control" id="itemQty" name="itemQty" placeholder="수량 직접입력">
      </div>
    </div>
     <div class="row mb-3">
      <label for="cat2Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">상태</label>
      <div class="col-sm-6">
        <select class="form-select form-select-sm" name="itemCondition">
          <option value="">상태 선택</option>
          <th:block th:each="commonCode:${session.commonCode.get('ITCON')}">
             <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
           </th:block>
        </select>
      </div>
    </div>
    <div class="row mb-3">
      <label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">비고</label>
      <div class="col-sm-6">
        <input type="text" class="form-control" name="note">
      </div>
    </div>
    <div class="row mb-3">
      <label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">장비사진</label>
      <div class="col-sm-6">
        <input type="file" class="form-control" name="file" accept="image/gif,image/jpeg,image/png">
      </div>
    </div>
  </form>
</div>
<div class="modal-footer justify-content-between">
  <div class="col-auto">
    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
    <button type="button" class="btn btn-primary" id="saveEquip">저장</button>
  </div>
</div>
</html>