<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorate="~{layout/layout}">
<th:block layout:fragment="css">
  <link rel="stylesheet" th:href="@{/css/login/login.css}">
</th:block>
<th:block layout:fragment="script">
  <script type="text/javascript" th:src="@{/js/login/login.js}"></script>
</th:block>
<div layout:fragment="content">
  <img id="img02" th:src="@{/img/img02.jpg}" class="w-100 h-100" alt="배경2">
  <div id="form-signin" class="form-signin text-center bg-white">
    <!-- Security config의 loginPage("url")와 action url과 동일하게 작성-->
    <div class="row">
      <h2>반갑습니다</h2>
      <p>이곳은 외사정보시스템입니다</p>
    </div>
    <form action="/login" method="post">
      <!-- Spring Security가 적용되면 POST 방식으로 보내는 모든 데이터는 csrf 토큰 값이 필요 -->
      <input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
      <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
      <p th:if="${loginError}" class="error text-danger">로그인에 실패하였습니다.</p>
      <!-- 로그인 시 아이디의 name 애트리뷰트 값은 username -->
      <!-- 파라미터명을 변경하고 싶을 경우 config class formlogin()에서 .usernameParameter("") 명시 -->
      <div class="row">
        <label for="username" class="col-sm-4 col-form-label mb-2">아이디</label>
        <div class="col-sm-8 mb-2">
          <input type="text" class="form-control form-control-sm" id="username" name="username">
        </div>
        <label for="password" class="col-sm-4 col-form-label mb-2">비밀번호</label>
        <div class="col-sm-8 mb-2">
          <input type="password" class="form-control form-control-sm" id="password" name="password">
        </div>
      </div>
      <!--<div class="checkbox mb-3">
        <label>
          <input type="checkbox" class="disabled" value="remember-me"> 계정저장(비활성화)
        </label>
      </div>-->
      <button class="w-100 my-2 btn btn-lg btn-primary" type="submit">로그인</button>
      <div class="row my-2 justify-content-between">
        <div class="col-auto">
          <a href="#" data-bs-toggle="modal" data-bs-target="#userInsertModal">회원가입</a>
        </div>
        <div class="col-auto">
          <a href="#">아이디/비밀번호 찾기</a>
        </div>
      </div>
    </form>
  </div>

  <div class="modal fade" id="userInsertModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="userInsertModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
      <div class="modal-content " id="userInsertModalContent">
        <div class="modal-header">
          <h5 class="modal-title" id="userInsertModalLabel">사용자 신청</h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="modal-body">
          <div class="mb-3 mt-3 row">
            <label for="dicCode" class="col-sm-2 col-form-label col-form-label-sm text-center ">공무원식별번호</label>
            <div class="col-sm-3">
              <input type="text" class="form-control form-control-sm" id="dicCode" name="dicCode" autocomplete="off">
            </div>
            <button type="button" class="btn btn-sm btn-outline-primary col-sm-1" id="dicCodeSearchBtn">검색</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</html>