<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<form id="userInfoUpdate" class="row-cols-auto p-3" action="#" th:action="@{/admin/updateUserInfo}" method="post">
  <input type="hidden" name="userSeq" th:value="${userInfo.userSeq}">
  <div class="mb-3 row">
    <label for="userId" class="col-sm-4 col-form-label">아이디</label>
    <div class="col-sm-6">
      <input type="text" class="form-control" id="userId" name="userId" th:value="${userInfo.userId}" readonly>
    </div>
  </div>
  <div class="row">
    <div class="col-sm-4"></div>
    <div class="col-sm-auto form-check ms-3">
      <input class="form-check-input" type="checkbox" id="passwordUpdateFlag">
      <label class="form-check-label" for="passwordUpdateFlag">비밀번호 수정</label>
    </div>
  </div>
  <div class="mb-3 row passwordDiv" style="display: none">
    <label for="password" class="col-sm-4 col-form-label">비밀번호</label>
    <div class="col-sm-6">
      <input type="password" class="form-control" id="password" name="password" disabled>
    </div>
    <div class="col-sm-auto form-text mx-auto">
      8~16자 사이의 알파벳, 숫자, 특수문자 조합을 입력해주세요.
    </div>
  </div>
  <div class="mb-3 row passwordDiv" style="display: none">
    <label for="passwordConfirm" class="col-sm-4 col-form-label">비밀번호 확인</label>
    <div class="col-sm-6">
      <input type="password" class="form-control" id="passwordConfirm" disabled>
    </div>
  </div>
  <div class="mb-3 row">
    <label for="name" class="col-sm-4 col-form-label">이름</label>
    <div class="col-sm-6">
      <input type="text" class="form-control" id="name" name="name" autocomplete="off" th:value="${userInfo.name}">
    </div>
  </div>
  <div class="mb-3 row">
    <label for="department" class="col-sm-4 col-form-label">부서</label>
    <div class="col-sm-6">
      <select class="form-select" id="department" name="department">
        <th:block th:each="commonCode:${session.departmentList}">
          <option th:value="${commonCode.codeSq}" th:text="${commonCode.value}" th:selected="${commonCode.codeSq == userInfo.department}"></option>
        </th:block>
      </select>
    </div>
  </div>
  <div class="mb-3 row">
    <label for="position" class="col-sm-4 col-form-label">직급</label>
    <div class="col-sm-6">
      <select class="form-select" id="position" name="position">
        <th:block th:each="commonCode:${session.positionList}">
          <option th:value="${commonCode.codeSq}" th:text="${commonCode.value}" th:selected="${commonCode.codeSq==userInfo.position}"></option>
        </th:block>
      </select>
    </div>
  </div>
  <div class="mb-3 row">
    <label for="userStatus" class="col-sm-4 col-form-label">사용여부</label>
    <div class="col-sm-6">
      <select class="form-select" id="userStatus" name="userStatus">
        <option value="T" th:selected="${userInfo.userStatus=='T'}">활성화</option>
        <option value="F" th:selected="${userInfo.userStatus=='F'}">비활성화</option>
      </select>
    </div>
  </div>
  <div class="mb-3 row">
    <div class="col-sm-4"></div>
    <div class="col-sm-auto form-check ms-3">
      <input type="hidden" name="userRole" value="ROLE_USER">
      <input class="form-check-input" type="checkbox" value="ROLE_ADMIN" id="roleAdmin" name="userRole" th:checked="${#strings.contains(userInfo.userRole,'ADMIN')}">
      <label class="form-check-label" for="roleAdmin">관리자 계정</label>
    </div>
  </div>
</form>
<div class="row-cols-6 gap-2 p-3">
  <input type="button" class="btn btn-warning w-50" id="updateBtn" value="수정하기">
</div>