<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
  <h5 class="modal-title" id="processResultEditModalLabel" th:text="${processResult.cdsKey eq null ? '불법조업 외국어선 처리현황' : '불법조업 외국어선 처리현황'}">></h5>
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<!-- 탭 메뉴 -->
<ul class="nav nav-tabs" role="tablist">
  <li class="nav-item" role="presentation">
    <button class="nav-link processResultTab active" id="processResult-tab" data-bs-toggle="tab"
            data-bs-target="#processResult" type="button" role="tab" aria-controls="processResult" data-processResult-type="processResult"
            aria-selected="true">상세</button>
  </li>
  <li class="nav-item" role="presentation">
    <button class="nav-link processResultTab" id="history-tab" data-bs-toggle="tab"
            data-bs-target="#history" type="button" role="tab" data-history-type="history"
            aria-controls="history">수정이력</button>
  </li>
</ul>
<!-- 내용 -->
<div class="tab-content" style="overflow-y: auto;">
  <div class="tab-pane fade show active" id="processResult" role="tabpanel" aria-labelledby="processResult-tab">
    <div class="modal-body" id="processResultEditBody">
      <form action="#" method="post" id="processResultEditForm">
        <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="cdsKey" th:value="${processResult.crackdownStatus.cdsKey}">
        <input type="hidden" name="fbKey" th:value="${processResult.fbKey}">
        <input type="hidden" name="prKey" th:value="${processResult.prKey}">
        <input type="hidden" name="wrtOrgan" th:value="${processResult.wrtOrgan}">
        <input type="hidden" name="wrtUserNm" th:value="${processResult.wrtUserNm}">
        <input type="hidden" name="wrtDt" th:value="${#temporals.format(processResult.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">
            <input class="form-control form-control-sm" name="caseNum" id="caseNum" th:value="${processResult.crackdownStatus.caseNum}" readonly>
          </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="crackdownPolice" id="crackdownPolice" disabled>
              <option value="">선택</option>
              <th:block th:each="commonCode:${session.commonCode.get('CPO')}">
                <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                th:selected="${processResult.crackdownStatus.crackdownPolice eq commonCode.itemCd}"></option>
              </th:block>
              <option value="etc" th:selected="${processResult.crackdownStatus.crackdownPolice ne null && processResult.crackdownStatus.crackdownPolice ne '' && !#strings.contains(processResult.crackdownStatus.crackdownPolice, 'CPO')}">직접입력</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="boatNameKr" id="boatNameKr" th:value="${processResult.boatNameKr}" readonly>
          </div>
          <label class="col-sm-1 col-form-label col-form-label-sm text-center">위반장소</label>
          <div class="col-sm-6">
            <input class="form-control form-control-sm" name="napoSeaPointLon" id="napoSeaPointLon" th:value="${processResult.crackdownStatus.napoSeaPointLon}" readonly>
            <input class="form-control form-control-sm" name="napoSeaPointLat" id="napoSeaPointLat" th:value="${processResult.crackdownStatus.napoSeaPointLat}" readonly>
            <input class="form-control form-control-sm" name="napoSeaPointDetail" id="napoSeaPointDetail" th:value="${processResult.crackdownStatus.napoSeaPointDetail}" readonly>
          </div>
        </div>
        <div class="mb-3 row">
          <div class="col-sm-1">
            <label class="col-form-label col-form-label-sm text-center">위반내용</label>
          </div>
          <div class="col-auto" id="violationDiv">
            <th:block th:if="${#lists.isEmpty(processResult.violationList)}">
              <div class="row">
                <select class="form-select form-select-sm violation" name="violation" disabled>
                  <option value="">선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('VT')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
                  </th:block>
                  <option value="etc">직접입력</option>
                </select>
              </div>
            </th:block>
            <th:block th:if="${!#lists.isEmpty(processResult.violationList)}">
              <th:block th:each="violation : ${processResult.violationList}">
                <div class="row">
                  <input type="hidden" name="violationKey" th:value="${violation.violationKey}">
                  <select class="form-select form-select-sm violation" name="violation" disabled>
                    <option value="">선택</option>
                    <th:block th:each="commonCode:${session.commonCode.get('VT')}">
                      <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                              th:selected="${processResult.violationList != null and commonCode.itemCd eq violation.violation}"></option>
                    </th:block>
                    <option th:selected="${violation.violation ne null and !#strings.contains(violation.violation, 'VT')}" value="etc">직접입력</option>
                  </select>
                  <th:block th:if="${violation.violation ne null and !#strings.contains(violation.violation, 'VT')}">
                    <div class="col-auto">
                      <input type="text" class="form-control form-control-sm" name="violationEtc" th:value="${violation.violation}" readonly>
                    </div>
                  </th:block>
                </div>
              </th:block>
            </th:block>
          </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="sentencingCourt" id="sentencingCourt" th:value="${processResult.sentencingCourt}" readonly>
          </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="sentencingDetail" id="sentencingDetail" th:value="${processResult.sentencingDetail}" readonly>
          </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="executionDetail" id="executionDetail" disabled>
              <option value="">선택</option>
              <th:block th:each="commonCode:${session.commonCode.get('PR')}">
                <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                        th:selected="${commonCode.itemCd eq processResult.executionDetail}"></option>
              </th:block>
              <option th:selected="${processResult.executionDetail ne '' && processResult.executionDetail ne null && !#strings.contains(processResult.executionDetail, 'PR')}" value="etc">직접입력</option>
            </select>
            <th:block th:if="${processResult.executionDetail ne '' && processResult.executionDetail ne null && !#strings.contains(processResult.executionDetail, 'PR')}">
              <div class="col-auto">
                <input type="text" class="form-control form-control-sm" name="processStatusEtc" th:value="${processResult.executionDetail}" readonly>
              </div>
            </th:block>
          </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="returnDt" id="returnDt" th:value="${#temporals.format(processResult.returnDt, 'yyyy-MM-dd')}" readonly>
          </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="consignmentStartDt" id="consignmentStartDt" th:value="${#temporals.format(processResult.consignmentStartDt, 'yyyy-MM-dd')}" readonly>
          </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="consignmentEndDt" id="consignmentEndDt" th:value="${#temporals.format(processResult.consignmentEndDt, 'yyyy-MM-dd')}" readonly>
          </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="confiscationDt" id="confiscationDt" th:value="${#temporals.format(processResult.confiscationDt, 'yyyy-MM-dd')}" readonly>
          </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="boatDisposalDt" id="boatDisposalDt" th:value="${#temporals.format(processResult.boatDisposalDt, 'yyyy-MM-dd')}" readonly>
          </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="boatDisposalDt" id="boatDisposalDt" th:value="${#temporals.format(processResult.boatDisposalDt, 'yyyy-MM-dd')}" readonly>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
<div class="modal-footer">
  <th:block th:if="${userSeq eq processResult.wrtUserSeq or accessAuth eq 'ACC003'}"><!--작성자일 경우 수정 허용--><!--관리자일 경우 수정 허용-->
    <button type="button" class="btn btn-warning" id="processResultEditBtn">수정</button>
  </th:block>
  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
</div>
</html>