<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
  <h5 class="modal-title" id="icaEditModalLabel" th:text="${internationalCrimeArrest.icaKey eq null ? '국제범죄검거 현황 수정' : '국제범죄검거 현황 등록'}">></h5>
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="icaEditBody">
  <form action="#" method="post" id="icaEditForm">
    <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="icaKey" th:value="${internationalCrimeArrest.icaKey}">
    <input type="hidden" name="wrtOrgan" th:value="${internationalCrimeArrest.wrtOrgan}">
    <input type="hidden" name="wrtNm" th:value="${internationalCrimeArrest.wrtNm}">
    <input type="hidden" name="wrtDt" th:value="${#temporals.format(internationalCrimeArrest.wrtDt, 'yyyy-MM-dd HH:mm')}">
    <input type="hidden" id="contentStatus" name="contentStatus">
    <div class="mb-3 row">
      <label class="col-sm-2 col-form-label text-center">사건번호</label>
      <div class="col-sm-2">
        <input type="text" class="form-control" name="caseNum" th:value="${internationalCrimeArrest.caseNum}">
      </div>
    </div>
    <div class="mb-3 row">
      <label class="col-sm-2 col-form-label text-center">지방청</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="organ">
          <option value="">선택</option>
          <th:block th:each="organConfig:${organConfigList}">
            <th:block th:if="${organConfig.parentOrgan eq 'OG001' && organConfig.organType ne 'OGC001'}">
              <option th:value="${organConfig.organCd}" th:text="${organConfig.organNm}" th:selected="${organConfig.organCd eq internationalCrimeArrest.organ}"></option>
            </th:block>
          </th:block>
        </select>
      </div>
      <label class="col-sm-2 col-form-label text-center">관할서</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="department">
          <option value="">선택</option>
          <th:block th:each="organConfig:${organConfigList}">
            <th:block th:if="${organConfig.parentOrgan ne null && organConfig.organType ne 'OGC002'}">
              <option th:value="${organConfig.organCd}" th:text="${organConfig.organNm}" th:selected="${organConfig.organCd eq internationalCrimeArrest.department}"></option>
            </th:block>
          </th:block>
        </select>
      </div>
      <div class="col-sm-4 row" id="crimeNameDiv">
        <label class="col-sm-2 col-form-label text-center">죄명</label>
        <div class="col-sm-10 input-daterange">
          <input type="text" class="form-control" name="crimeName" th:value="${internationalCrimeArrest.crimeName}">
        </div>
      </div>
    </div>
    <div class="mb-3 row">
      <label class="col-sm-2 col-form-label text-center">범죄테마</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="crimeType" id="crimeType">
          <option value="">선택</option>
          <th:block th:each="commonCode:${session.commonCode.get('CTH')}">
            <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                    th:selected="${commonCode.itemCd eq internationalCrimeArrest.crimeType}"></option>
          </th:block>
        </select>
      </div>
      <label class="col-sm-2 col-form-label text-center">위반유형</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="violationType" id="violationType">
          <option value="">선택</option>
          <th:block th:each="commonCode:${session.commonCode.get('VLT')}">
            <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                    th:selected="${commonCode.itemCd eq internationalCrimeArrest.violationType}"></option>
          </th:block>
        </select>
      </div>
    </div>
    <div class="mb-3 row" id="smugglingAmountDiv">
      <th:block th:if="${internationalCrimeArrest.crimeType eq 'CTH002'}">
        <label class="col-sm-2 col-form-label text-center">밀수입출 품목</label>
        <div class="col-sm-2">
          <select class="form-select form-select-sm" name="smuggledGoods" id="smugglingAmount">
            <option value="">선택</option>
            <th:block th:each="commonCode:${session.commonCode.get('SG')}">
              <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
            </th:block>
            <option value="etc" th:selected="${internationalCrimeArrest.smuggledGoods ne null && internationalCrimeArrest.smuggledGoods ne '' && !#strings.contains(internationalCrimeArrest.smuggledGoods, 'SG')}">기타</option>
          </select>
          <th:block th:if="${internationalCrimeArrest.smuggledGoods ne null && internationalCrimeArrest.smuggledGoods ne '' && !#strings.contains(internationalCrimeArrest.smuggledGoods, 'SG')}">
            <div class="col-auto">
              <input type="text" class="form-control" name="smuggledGoodsEtc" th:value="${internationalCrimeArrest.smuggledGoods}">
            </div>
          </th:block>
        </div>
        <label class="col-sm-2 col-form-label text-center">밀수가액</label>
        <div class="col-sm-2">
          <input type="number" min="0" name="smugglingAmount" th:value="${internationalCrimeArrest.smugglingAmount}">
        </div>
        <label class="col-sm-2 col-form-label text-center">단속 인원(경찰관)</label>
        <div class="col-sm-2">
          <input type="number" min="0" name="caseNum" th:value="${internationalCrimeArrest.caseNum}">
        </div>
      </th:block>
    </div>
    <div class="mb-3 row">
      <label class="col-sm-2 col-form-label text-center">발생원표</label>
      <div class="col-sm-2">
        <input type="text" name="occurTable" th:value="${internationalCrimeArrest.occurTable}">
      </div>
      <label class="col-sm-2 col-form-label text-center">검거원표</label>
      <div class="col-sm-2">
        <input type="text" name="arrestTable" th:value="${internationalCrimeArrest.arrestTable}">
      </div>
      <label class="col-sm-2 col-form-label text-center">피의자원표</label>
      <div class="col-sm-2">
        <input type="text" name="suspectTable" th:value="${internationalCrimeArrest.suspectTable}">
      </div>
    </div>
    <div class="mb-3 row">
      <label class="col-sm-2 col-form-label text-center">범행형태</label>
      <div class="col-sm-2" id="crimeFormDiv">
        <select class="form-select form-select-sm" name="crimeForm" id="crimeForm">
          <th:block th:each="commonCode:${session.commonCode.get('CMF')}">
            <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                    th:selected="${commonCode.itemCd eq internationalCrimeArrest.crimeForm}"></option>
          </th:block>
        </select>
      </div>
      <th:block th:if="${internationalCrimeArrest.crimeForm ne 'CMF001'}">
        <button type="button" class="col-sm-1 btn btn-sm btn-primary" id="spiAddBtn">+</button>
      </th:block>
    </div>
    <div class="mb-3 row" id="spiParentDiv">
      <label class="col-sm-2 col-form-label text-center">피의자 인적사항</label>
      <div class="col-sm-10" id="spiDiv">
        <th:block th:if="${#lists.isEmpty(internationalCrimeArrest.suspectPersonInfoList)}">
          <div class="row spi-list">
            <label class="col-sm-1 col-form-label text-center">성별</label>
            <div class="col-sm-2" id="sexFormDiv">
              <select class="form-select form-select-sm" name="sex">
                <th:block th:each="commonCode:${session.commonCode.get('SEX')}">
                  <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
                </th:block>
              </select>
            </div>
            <label class="col-sm-1 col-form-label text-center">나이</label>
            <div class="col-sm-2" id="ageFormDiv">
              <select class="form-select form-select-sm" name="age">
                <th:block th:each="commonCode:${session.commonCode.get('AGE')}">
                  <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
                </th:block>
              </select>
            </div>
            <label class="col-sm-1 col-form-label text-center">국적</label>
            <div class="col-sm-2" id="countryFormDiv">
              <select class="form-select form-select-sm country" name="country">
                <th:block th:each="commonCode:${session.commonCode.get('NNY')}">
                  <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
                </th:block>
                <option value="etc">기타</option>
              </select>
            </div>
          </div>
        </th:block>
        <th:block th:if="${!#lists.isEmpty(internationalCrimeArrest.suspectPersonInfoList)}">
          <th:block th:each="suspectPersonInfo, i : ${internationalCrimeArrest.suspectPersonInfoList}">
            <div class="row spi-list" th:classappend="${i.index > 0 ? 'dynamic' : ''}">
              <input type="hidden" name="spiKey" th:value="${suspectPersonInfo.spiKey}">
              <label class="col-sm-1 col-form-label text-center">성별</label>
              <div class="col-sm-2" id="sexFormDiv">
                <select class="form-select form-select-sm" name="sex">
                  <th:block th:each="commonCode:${session.commonCode.get('SEX')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                            th:selected="${suspectPersonInfo.sex ne null && commonCode.itemCd eq suspectPersonInfo.sex}"></option>
                  </th:block>
                </select>
              </div>
              <label class="col-sm-1 col-form-label text-center">나이</label>
              <div class="col-sm-2" id="ageFormDiv">
                <select class="form-select form-select-sm" name="age">
                  <th:block th:each="commonCode:${session.commonCode.get('AGE')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                            th:selected="${suspectPersonInfo.age ne null && commonCode.itemCd eq suspectPersonInfo.age}"></option>
                  </th:block>
                </select>
              </div>
              <label class="col-sm-1 col-form-label text-center">국적</label>
              <div class="col-sm-2" id="countryFormDiv">
                <select class="form-select form-select-sm country" name="country" id="country">
                  <th:block th:each="commonCode:${session.commonCode.get('NNY')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                            th:selected="${suspectPersonInfo.country ne null && commonCode.itemCd eq suspectPersonInfo.country}"></option>
                  </th:block>
                  <option value="etc" th:selected="${suspectPersonInfo.country ne null && suspectPersonInfo.country ne '' && !#strings.contains(suspectPersonInfo.country, 'NNY')}">기타</option>
                </select>
              </div>
              <th:block th:if="${suspectPersonInfo.country ne null && suspectPersonInfo.country ne '' && !#strings.contains(suspectPersonInfo.country, 'NNY')}">
                <div class="col-sm-2">
                  <input type="text" class="form-control" name="countryEtc" th:value="${suspectPersonInfo.country}">
                </div>
              </th:block>
              <th:block th:if="${i.index > 0}">
                <button type="button" class="col-sm-1 btn btn-sm btn-primary spiCancelBtn">-</button>
              </th:block>
            </div>
          </th:block>
        </th:block>
      </div>
    </div>
    <div class="mb-3 row" id="spiInfoDiv">
      <th:block th:if="${!#lists.isEmpty(internationalCrimeArrest.suspectPersonInfoList)}">
        <th:block th:if="${internationalCrimeArrest.crimeType eq 'CTH002' || internationalCrimeArrest.violationType eq 'VLT005'}">
          <label class="col-sm-2 col-form-label text-center" th:text="${internationalCrimeArrest.violationType eq 'VLT005' ? '불법체류 및 취업' : '피의자 정보'}">피의자 정보</label>
          <div class="col-sm-10">
            <div class="row" id="spiWrapper">
              <th:block th:if="${internationalCrimeArrest.violationType eq 'VLT005'}">
                <label class="col-sm-2 col-form-label text-center entryVisa">입국비자</label>
                <div class="col-sm-2 entryVisa">
                  <input type="text" class="form-control" name="entryVisa" th:value="${internationalCrimeArrest.suspectPersonInfoList[0].entryVisa}">
                </div>
              </th:block>
              <label class="col-sm-2 col-form-label text-center">체류 자격</label>
              <div class="col-sm-2">
                <input type="text" class="form-control" name="stayQualification" th:value="${internationalCrimeArrest.suspectPersonInfoList[0].stayQualification}">
              </div>
              <label class="col-sm-2 col-form-label text-center">체류기간 만료일</label>
              <div class="col-sm-2 input-daterange" id="stayQualificationDiv">
                <input type="text" class="form-control" name="stayPeriodExpiredDt" id="stayPeriodExpiredDt" th:value="${#temporals.format(internationalCrimeArrest.suspectPersonInfoList[0].stayPeriodExpiredDt, 'yyyy-MM-dd HH:mm')}">
              </div>
            </div>
          </div>
        </th:block>
      </th:block>
    </div>
    <th:block th:if="${internationalCrimeArrest.violationType eq 'VLT001' || internationalCrimeArrest.violationType eq 'VLT002' || internationalCrimeArrest.violationType eq 'VLT003'|| internationalCrimeArrest.violationType eq 'VLT004'}">
      <div class="mb-3 row" id="meansDiv">
        <th:block th:if="${internationalCrimeArrest.violationType eq 'VLT001' || internationalCrimeArrest.violationType eq 'VLT003'|| internationalCrimeArrest.violationType eq 'VLT004'}">
          <label class="col-sm-2 col-form-label text-center" th:text="${internationalCrimeArrest.violationType eq 'VLT001' ? '밀입국 출발지(국가)' : (internationalCrimeArrest.violationType eq 'VLT003' ? '밀출국 행선지(도착예정지)' : '밀항 행선지(도착예정지)')}"></label>
          <div class="col-sm-2">
            <input type="text" class="form-control" name="destination">
          </div>
        </th:block>
        <label class="col-sm-2 col-form-label text-center" th:text="${internationalCrimeArrest.violationType eq 'VLT001' ? '밀입국 수단(방법)' : (internationalCrimeArrest.violationType eq 'VLT002' ? '도외이탈 수단(방법)' : (internationalCrimeArrest.violationType eq 'VLT003' ? '밀출국 수단(방법)' : '밀항 수단(방법)'))}"></label>
        <div class="col-sm-2">
          <select class="form-select form-select-sm" name="means" id="means">
            <option value="">선택</option>
            <th:block th:if="${internationalCrimeArrest.violationType eq 'VLT001'}" th:each="commonCode:${session.commonCode.get('MS1')}">
              <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                      th:selected="${commonCode.itemCd eq internationalCrimeArrest.means}"></option>
            </th:block>
            <th:block th:if="${internationalCrimeArrest.violationType ne 'VLT001'}" th:each="commonCode:${session.commonCode.get('MS2')}">
              <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                      th:selected="${commonCode.itemCd eq internationalCrimeArrest.means}"></option>
            </th:block>
            <option value="etc" th:selected="${internationalCrimeArrest.means ne null && internationalCrimeArrest.means ne '' && !#strings.contains(internationalCrimeArrest.means, 'MS1') && !#strings.contains(internationalCrimeArrest.means, 'MS2')}">기타</option>
          </select>
          <th:block th:if="${internationalCrimeArrest.means ne null && internationalCrimeArrest.means ne '' && !#strings.contains(internationalCrimeArrest.means, 'MS1') && !#strings.contains(internationalCrimeArrest.means, 'MS2')}">
            <div class="col-auto">
              <input type="text" class="form-control" name="meansEtc" th:value="${internationalCrimeArrest.means}">
            </div>
          </th:block>
        </div>
        <label class="col-sm-2 col-form-label text-center" th:text="${internationalCrimeArrest.violationType eq 'VLT001' ? '밀입국 목적(사유)' : (internationalCrimeArrest.violationType eq 'VLT002' ? '도외이탈 목적(시유)' : (internationalCrimeArrest.violationType eq 'VLT003' ? '밀출국 목적(사유)' : '밀항 목적(사유)'))}"></label>
        <div class="col-sm-2">
          <select class="form-select form-select-sm" name="purpose" id="purpose">
            <option value="">선택</option>
            <th:block th:each="commonCode:${session.commonCode.get('PPS')}">
              <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                      th:selected="${commonCode.itemCd eq internationalCrimeArrest.purpose}"></option>
            </th:block>
            <option value="etc" th:selected="${internationalCrimeArrest.purpose ne null && internationalCrimeArrest.purpose ne '' && !#strings.contains(internationalCrimeArrest.purpose, 'PPS')}">기타</option>
          </select>
          <th:block th:if="${internationalCrimeArrest.purpose ne null && internationalCrimeArrest.purpose ne '' && !#strings.contains(internationalCrimeArrest.purpose, 'PPS')}">
            <div class="col-auto">
              <input type="text" class="form-control" name="purposeEtc" th:value="${internationalCrimeArrest.purpose}">
            </div>
          </th:block>
        </div>
      </div>
      <div class="mb-3 row" id="arrestAreaDiv">
        <label class="col-sm-2 col-form-label text-center">검거 지역 </label>
        <div class="col-sm-2">
          <input type="text" class="form-control" name="arrestArea" th:value="${internationalCrimeArrest.arrestArea}">
        </div>
        <label class="col-sm-2 col-form-label text-center" th:text="${internationalCrimeArrest.violationType eq 'VLT001' ? '밀입국 시도 해역(해안)' : (internationalCrimeArrest.violationType eq 'VLT002' ? '도외이탈 시도 해역(해안)' : (internationalCrimeArrest.violationType eq 'VLT003' ? '밀출국 시도 해역(해안)' : '밀항 시도 해역(해안)'))}"></label>
        <div class="col-sm-3">
          <select class="form-select form-select-sm" name="seaArea">
            <option value="">선택</option>
            <th:block th:each="commonCode:${session.commonCode.get('SAA')}">
              <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                      th:selected="${commonCode.itemCd eq internationalCrimeArrest.seaArea}"></option>
            </th:block>
          </select>
        </div>
      </div>
    </th:block>
    <th:block th:if="${internationalCrimeArrest.violationAmount ne null}">
      <div class="mb-3 row" id="violationAmountDiv">
        <label class="col-sm-2 col-form-label text-center">표시위반 금액(만원)</label>
        <div class="col-sm-2">
          <input type="number" min="0" class="form-control" name="violationAmount" th:value="${internationalCrimeArrest.violationAmount}">
        </div>
      </div>
    </th:block>
    <div class="mb-3 row">
      <label class="col-sm-2 col-form-label text-center">범죄인지</label>
      <div class="col-sm-2 input-daterange" id="crimeAwarenessDtDiv">
        <input type="text" class="form-control" name="crimeAwarenessDt" id="crimeAwarenessDt" th:value="${#temporals.format(internationalCrimeArrest.crimeAwarenessDt, 'yyyy-MM-dd HH:mm')}">
      </div>
      <label class="col-sm-2 col-form-label text-center">사건송치</label>
      <div class="col-sm-2 input-daterange" id="caseSentDtDiv">
        <input type="text" class="form-control" name="caseSentDt" id="caseSentDt" th:value="${#temporals.format(internationalCrimeArrest.caseSentDt, 'yyyy-MM-dd HH:mm')}">
      </div>
      <label class="col-sm-2 col-form-label text-center">신병처리</label>
      <div class="col-sm-2">
        <select class="form-select form-select-sm" name="processResult" id="processResult">
          <option value="">선택</option>
          <th:block th:each="commonCode:${session.commonCode.get('PCR')}">
            <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"
                    th:selected="${commonCode.itemCd eq internationalCrimeArrest.processResult}"></option>
          </th:block>
          <option value="etc" th:selected="${internationalCrimeArrest.processResult ne null && internationalCrimeArrest.processResult ne '' && !#strings.contains(internationalCrimeArrest.processResult, 'PCR')}">기타</option>
        </select>
        <th:block th:if="${internationalCrimeArrest.processResult ne null && internationalCrimeArrest.processResult ne '' && !#strings.contains(internationalCrimeArrest.processResult, 'PCR')}">
          <div class="col-auto">
            <input type="text" class="form-control" name="processResultEtc" th:value="${internationalCrimeArrest.processResult}">
          </div>
        </th:block>
      </div>
    </div>
    <div class="mb-3 row justify-content-center">
      <label for="caseOverviewDiv" class="col-sm-2 col-form-label text-center">범죄사실(사건개요)</label>
      <div class="col-sm-10" id="caseOverviewDiv">
        <textarea type='text' name='caseOverview' th:utext="${internationalCrimeArrest.caseOverview}"></textarea>
      </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="saveIcaBtn">저장</button>
</div>
</html>