<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
  <h5 class="modal-title" id="sailorAddModalLabel">선원 세부 현황 등록</h5>
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="sailorAddBody">
  <form action="#" method="post" id="sailorEditForm">
    <input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
    <input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
    <input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
    <input type="hidden" name="sailorKey" th:value="${sailor.sailorKey}">
    <input type="hidden" name="fbKey">
    <input type="hidden" name="cdsKey">
    <input type="hidden" name="wrtOrgan" th:value="${sailor.wrtOrgan}">
    <input type="hidden" name="wrtPart" th:value="${sailor.wrtPart}">
    <input type="hidden" name="wrtUserGrd" th:value="${sailor.wrtUserGrd}">
    <input type="hidden" name="wrtUserNm" th:value="${sailor.wrtUserNm}">
    <input type="hidden" name="wrtDt" th:value="${#temporals.format(sailor.wrtDt, 'yyyy-MM-dd HH:mm')}">
    <input type="hidden" id="saveYn" name="saveYn">
    <div class="mb-3 row">
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">선박명</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="boatNameKr">
          <option value="">선택</option>
          <th:block th:each="fishingBoat : ${sailor.fishingBoatList}">
            <option th:value="${fishingBoat.boatNameKr}" th:text="${fishingBoat.boatNameKr}" th:data-key="${fishingBoat.fbKey}" th:data-key2="${fishingBoat.cdsKey}"></option>
          </th:block>
        </select>
      </div>
    </div>
    <div class="mb-3 row">
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">선원명(한글)</label>
      <div class="col-sm-2">
        <input class="form-control form-control-sm" name="sailorNameKr" id="sailorNameKr" th:value="${sailor.sailorNameKr}">
      </div>
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">선원명(중문)</label>
      <div class="col-sm-2">
        <input class="form-control form-control-sm" name="sailorNameCn" id="sailorNameCn" th:value="${sailor.sailorNameCn}">
      </div>
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">생년월일</label>
      <div class="col-sm-2">
          <input class="form-control form-control-sm" name="birthdate" id="birthdate" th:value="${#temporals.format(sailor.birthdate, 'yyyy-MM-dd')}">
      </div>
    </div>
    <div class="mb-3 row">
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">거주지</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="residence">
          <option value="">선택</option>
          <th:block th:each="commonCode:${session.commonCode.get('RSC')}">
            <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                    th:selected="${commonCode.itemCd eq sailor.residence}"></option>
          </th:block>
        </select>
      </div>
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">학력</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="education">
          <option value="">선택</option>
          <th:block th:each="commonCode:${session.commonCode.get('SED')}">
            <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                    th:selected="${commonCode.itemCd eq sailor.education}"></option>
          </th:block>
        </select>
      </div>
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">선박 내 직책</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="position">
          <option value="">선택</option>
          <th:block th:each="commonCode:${session.commonCode.get('POS')}">
            <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                    th:selected="${commonCode.itemCd eq sailor.position}"></option>
          </th:block>
        </select>
      </div>
    </div>
    <div class="mb-3 row">
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">승선경력</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="career">
          <option value="">선택</option>
          <th:block th:each="commonCode:${session.commonCode.get('BE')}">
            <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                    th:selected="${commonCode.itemCd eq sailor.career}"></option>
          </th:block>
        </select>
      </div>
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">동종 범죄경력</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="similarCriminalHistory">
          <option value="">선택</option>
          <option value="1" th:selected="${sailor.similarCriminalHistory == 1}">1건</option>
          <option value="2" th:selected="${sailor.similarCriminalHistory == 2}">2건</option>
          <option value="3" th:selected="${sailor.similarCriminalHistory == 3}">3건</option>
          <option value="4" th:selected="${sailor.similarCriminalHistory == 4}">4이상</option>
          <option value="0" th:selected="${sailor.similarCriminalHistory == 0}">없음</option>
        </select>
      </div>
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">이종 범죄경력</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="heterogeneousCriminalHistory">
          <option value="">선택</option>
          <option value="1" th:selected="${sailor.heterogeneousCriminalHistory == 1}">1건</option>
          <option value="2" th:selected="${sailor.heterogeneousCriminalHistory == 2}">2건</option>
          <option value="3" th:selected="${sailor.heterogeneousCriminalHistory == 3}">3건</option>
          <option value="4" th:selected="${sailor.heterogeneousCriminalHistory == 4}">4이상</option>
          <option value="0" th:selected="${sailor.heterogeneousCriminalHistory == 0}">없음</option>
        </select>
      </div>
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">검거이력<br>(나포이력, 선원 포함)</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="arrestHistory">
          <option value="">선택</option>
          <option value="1" th:selected="${sailor.arrestHistory == 1}">1건</option>
          <option value="2" th:selected="${sailor.arrestHistory == 2}">2건</option>
          <option value="3" th:selected="${sailor.arrestHistory == 3}">3건</option>
          <option value="4" th:selected="${sailor.arrestHistory == 4}">4이상</option>
          <option value="0" th:selected="${sailor.arrestHistory == 0}">없음</option>
        </select>
      </div>
    </div>
    <div class="mb-3 row">
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">범죄경력<br>세부내용</label>
      <div class="col-sm-2">
        <input class="form-control form-control-sm" name="criminalHistoryDetail" th:value="${sailor.criminalHistoryDetail}">
      </div>
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">임금<br>(월급여)</label>
      <div class="col-sm-2">
        <input class="form-control form-control-sm" name="monthlyWages" th:value="${sailor.monthlyWages}">
      </div>
      <label class="col-sm-1 col-form-label col-form-label-sm text-center">비고</label>
      <div class="col-sm-2">
        <input class="form-control form-control-sm" name="note" th:value="${sailor.note}">
      </div>
    </div>
  </form>
</div>
<div class="modal-footer">
  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
  <!--<button type="button" class="btn btn-warning" id="saveTempBtn">임시저장</button>-->
  <button type="button" class="btn btn-primary" id="saveSailorBtn">저장</button>
</div>
</html>