<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">

<div class="modal-header">
  <h5 class="modal-title" id="menuEditModalLabel" th:text="${menuMgt.menuKey eq null?'메뉴 추가':'메뉴 수정'}"></h5>
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
  <form id="menuEditForm" action="#" method="post">
    <th:block th:if="${menuMgt.menuKey ne null}">
      <input type="hidden" name="menuKey" id="menuKey" th:value="${menuMgt.menuKey}">
    </th:block>
    <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="cat1Cd" name="cat1Cd">
          <option value="">대분류 선택</option>
          <th:block th:each="cat1:${cat1List}">
            <option th:value="${cat1.itemCd}" th:text="${cat1.itemValue}" th:selected="${cat1.itemCd==menuMgt.cat1Cd}"></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="cat2Cd" name="cat2Cd">
          <option value="">중분류 선택</option>
          <th:block th:each="cat2:${cat2List}">
            <option th:value="${cat2.itemCd}" th:text="${cat2.itemValue}" th:selected="${cat2.itemCd==menuMgt.cat2Cd}"></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">
        <select class="form-select form-select-sm" id="cat3Cd" name="cat3Cd">
          <option value="">소분류 선택</option>
          <th:block th:each="cat3:${cat3List}">
            <option th:value="${cat3.itemCd}" th:text="${cat3.itemValue}" th:selected="${cat3.itemCd==menuMgt.cat3Cd}"></option>
          </th:block>
        </select>
      </div>
    </div>
    <div class="row mb-3">
      <label for="menuUrl" class="col-sm-4 col-form-label col-form-label-sm text-center">URL</label>
      <div class="col-sm-6">
        <input type="text" class="form-control form-control-sm" id="menuUrl" name="menuUrl" th:value="${menuMgt.menuUrl}">
      </div>
    </div>
    <div class="row mb-3">
      <label for="approvalChk" class="col-sm-4 col-form-label col-form-label-sm text-center">결재권한설정</label>
      <div class="col-sm-6">
        <input type="checkbox" id="approvalChk" name="approvalChk" value="T" th:checked="${menuMgt.approvalChk eq 'T'}">
      </div>
    </div>
    <div class="row mb-3">
      <label for="useChk" class="col-sm-4 col-form-label col-form-label-sm text-center">사용여부</label>
      <div class="col-sm-6">
        <input type="checkbox" id="useChk" name="useChk" value="T" th:checked="${menuMgt.useChk eq 'T'}">
      </div>
    </div>
  </form>
</div>
<div class="modal-footer justify-content-between">
  <div class="col-auto">
    <th:block th:if="${menuMgt.menuKey ne null}">
      <button type="button" class="btn btn-danger" id="deleteMenuBtn">삭제</button>
    </th:block>
  </div>
  <div class="col-auto">
    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
    <button type="button" class="btn btn-primary" id="saveMenuBtn">저장</button>
  </div>
</div>
</html>